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; | |
using System.Collections.Generic; | |
using System.Linq; | |
public interface IBox<TClass, out T> | |
{ | |
TClass Value { get; } | |
} | |
public interface IFunctor<F> |
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
class Box<F, T> { } | |
class IsArray {} | |
interface IFunctor<F> { | |
fmap<A, B>(f: (a: A) => B, fa: Box<F, A>) : Box<F, 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
interface IPost { | |
title: string; | |
comments?: string[]; | |
} | |
interface IUser { | |
posts: IPost[]; | |
} | |
interface IData { |
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
class ImmutableArray<T> { | |
private _data : Array<T>; | |
public get value() : Array<T>{ | |
return this._data.slice(0); | |
} | |
constructor(data : Array<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
function getAllPropertyNames(obj) { | |
var props = {}; | |
do { | |
Object.getOwnPropertyNames(obj).forEach(function (prop) { | |
if (prop !== 'constructor') { | |
props[prop] = undefined; | |
} | |
}); | |
} while ((obj = Object.getPrototypeOf(obj)) !== Object.prototype); |
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
interface IMessage<T> { | |
data : T; | |
} | |
interface IObserver<T> { | |
update(message : IMessage<T>) : void; | |
unregister() : void; | |
unregisterAction : () => void; | |
} |
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; | |
using System.Linq; | |
using NSubstitute; | |
namespace ConsoleApplication | |
{ | |
public static class EntityFrameworkHelper | |
{ | |
public static DbSet<R> AsDbSetSubstitute<R>(this IEnumerable<R> data) where R : class |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace ConsoleApplication | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |