This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var immutable = (function(){ | |
function isFunction(f) { | |
var getType = {}; | |
return f && getType.toString.call(f) === '[object Function]'; | |
} | |
function shallowCopy(object){ | |
var copy = Object.create(Object.getPrototypeOf(object)); | |
Object.getOwnPropertyNames(object).forEach(function (name){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConnectionListView : MmcListView, IConnectionListView | |
{ | |
private readonly IConnectionListPresenter presenter; | |
public ConnectionListView() | |
{ | |
var container = this.SnapIn.Tag as IUnityContainer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RootBindingExtension : IMarkupExtension<Binding> | |
{ | |
public string Path { get; set; } | |
public Binding ProvideValue(IServiceProvider serviceProvider) | |
{ | |
IRootObjectProvider rootProvider = (IRootObjectProvider) serviceProvider.GetService(typeof(IRootObjectProvider)); | |
var view = rootProvider.RootObject; | |
var fe = view as FrameworkElement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
needleContainer | |
.Map<IForceEnlightened>() | |
.To<Jedi>() | |
.WithId("Yoda") | |
.UsingLifetime(RegistrationLifetime.Singleton) | |
.Commit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Data.Entity; | |
public class CompositeDatabaseInitializer<T> : IDatabaseInitializer<T> where T : DbContext | |
{ | |
private readonly List<IDatabaseInitializer<T>> initializers; | |
public CompositeDatabaseInitializer(params IDatabaseInitializer<T>[] databaseInitializers) | |
{ | |
this.initializers = new List<IDatabaseInitializer<T>>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyClass = (function () { | |
function MyClass() { | |
} | |
MyClass.prototype.add = function (a, b) { | |
return a + b; | |
}; | |
MyClass.prototype.partialAdd = function (a) { | |
var _this = this; | |
return function (b) { | |
return _this.add(a, b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = Require<Net>(); | |
var server = net.CreateServer(socket => | |
{ | |
Console.WriteLine("New connection"); | |
socket.On( | |
data: bytes => Console.Write(bytes.AsString()), | |
close: () => Console.WriteLine("Connection closed"), | |
error: e => Console.WriteLine("Error: {0}\r\nStackTrace: {1}", e.Message, e.StackTrace)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Owin.IpFilter | |
{ | |
using System; | |
using System.Net; | |
public static class Extensions | |
{ | |
public static IAppBuilder UseIpFiltering(this IAppBuilder appBuilder, Func<IPAddress, bool> rejectRequest) | |
{ | |
appBuilder.Use(typeof(IpFilterMiddleware), rejectRequest); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main() | |
{ | |
var fs = new FileStream("test.txt", FileMode.Open, FileAccess.Read, FileShare.None, 1024, true); | |
var buffer = new byte[1024]; | |
fs.BeginRead(buffer, 0, 1024, ReadCallback, new State { Buffer = buffer, FileStream = fs }); | |
Console.ReadLine(); | |
} |