Skip to content

Instantly share code, notes, and snippets.

View oguzhaneren's full-sized avatar
🐍
it depends

Oğuzhan Eren oguzhaneren

🐍
it depends
View GitHub Profile
@oguzhaneren
oguzhaneren / LazySessionContext.cs
Last active December 28, 2015 05:49 — forked from anonymous/gist:852307
NHibernate Session Per Web Request
using System;
using System.Collections.Generic;
using System.Web;
using NHibernate;
using NHibernate.Context;
using NHibernate.Engine;
namespace WebHub.Infrastracture.SessionManagement
{
public class LazySessionContext : ICurrentSessionContext
@oguzhaneren
oguzhaneren / test1.js
Created February 25, 2014 15:58 — forked from jmblog/test1.js
Examples of shim config in RequireJS 2.0 - Backbone and underscore
require.config({
paths: {
underscore: '../underscore-min'
},
shim: {
underscore: {
exports: function() {
return _.noConflict();
}
}
@oguzhaneren
oguzhaneren / 0_reuse_code.js
Created April 25, 2014 09:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@oguzhaneren
oguzhaneren / latency.txt
Last active August 29, 2015 14:27 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
define(['durandal/system', './transitionHelper'], function(system, helper) {
var settings = {
inAnimation: 'fadeInLeftBig',
outAnimation: 'fadeOutRight'
},
fadeIn = function(context) {
system.extend(context, settings);
return helper.create(context);
};
@oguzhaneren
oguzhaneren / ko.utils.signatures.js
Created October 21, 2015 13:50 — forked from hyle/ko.utils.signatures.js
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }
@oguzhaneren
oguzhaneren / gist:e36b843813f9baefd7c148dfb9179238
Created June 2, 2016 14:25 — forked from stevenkuhn/gist:5062660
This PowerShell script generates release notes for Octopus Deploy that contain the GitHub commits and JIRA issues from the current build to the latest production release. It will also create the Octopus release based on the TeamCity build number.
#
# Assumptions
#
# 1. If you have a Octopus release deployed, say 1.0.0.73, there is a git
# tag set for that commit in GitHub that is "v1.0.0.73".
#
# 2. You have TeamCity label each successful build in GitHub with the format
# "v{build number}. Sidenote: it appears that TeamCity only labels the
# default branch, but not feature branches.
#
@oguzhaneren
oguzhaneren / windows-vm.json
Created August 16, 2016 16:32 — forked from ritasker/windows-vm.json
Packer script for creating Windows VMs in Azure
{
"variables": {
"client_id": "",
"client_secret": "",
"subscription_id": "",
"tenant_id": "",
"object_id": "",
"resource_group": "",
"storage_account": "",
@oguzhaneren
oguzhaneren / Customer.cs
Created August 18, 2016 11:47 — forked from ThomasArdal/Customer.cs
Elasticsearch migration c# example
namespace ConsoleApplication1
{
public class Customer
{
public int Zipcode { get; set; }
}
}
public class ReliableSqlCommand : IDbCommand
{
private static readonly Policy RetryPolicy = Policy
.Handle<SqlException>(ex => ex.Number == 11001 || ex.Number == 1205)
.WaitAndRetry(new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(3)
});