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 / circle-progress-ko.js
Created August 5, 2015 11:59
Knockout binding for circle progress
ko.bindingHandlers.progressCircle = {
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var $element = $(element),
opt = ko.unwrap(valueAccessor());
var options = $.extend( {}, {
showText:true,
size:48,
thickness:3,
value:100
@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 / keybinding-user.json
Last active November 6, 2015 15:14
My Sublime Settings - Plugins
[
{ "keys": ["ctrl+k","ctrl+d"], "command": "reindent" , "args": { "single_line": false } },
{ "keys": ["ctrl+alt+e"], "command": "open_dir", "args": {"dir": "$file_path", "file": "$file_name"} },
{ "keys": ["ctrl+k","ctrl+c"], "command": "toggle_comment" , "args": { "block": false } },
{ "keys": ["ctrl+k","ctrl+u"], "command": "toggle_comment" , "args": { "block": false } },
{
"keys": ["f10"],
"command": "open_project_folder"
@oguzhaneren
oguzhaneren / example.cs
Created October 8, 2015 15:39
How C# killed the Strategy Pattern
void Main()
{
Console.WriteLine ("Add: "+Execute(add,3,4));
Console.WriteLine ("Subtract: "+Execute(subtract,3,4));
Console.WriteLine ("Multiply: "+Execute(multiply,3,4));
}
Func<int,int,int> add = (a,b) => a+b;
Func<int,int,int> subtract = (a,b) => a-b;
Func<int,int,int> multiply = (a,b) => a*b;
@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 / OAuthAuthorizationServerProvider.cs
Created January 12, 2016 11:00
from XacronDevelopment/oauth-aspnet
using System;
using System.Threading.Tasks;
namespace OAuth.AspNet.AuthServer
{
/// <summary>
/// Default implementation of IOAuthAuthorizationServerProvider used by Authorization
/// Server to communicate with the web application while processing requests. OAuthAuthorizationServerProvider provides some default behavior,
/// may be used as a virtual base class, and offers delegate properties which may be used to
@oguzhaneren
oguzhaneren / WebApiConfig.cs
Created March 8, 2016 17:13
Using controllers from an external assembly in ASP.NET Web API
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
config.Services.Replace(typeof(IAssembliesResolver),new DynamicAssemblyResolver());
// Web API routes
@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": "",