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 PrincipalStub : IPrincipal | |
{ | |
public IIdentity Identity | |
{ | |
get { return new IdentityStub(); } | |
} | |
public bool IsInRole(string role) | |
{ |
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.Reactive.Disposables; | |
namespace ReactiveExtensions.Rx | |
{ | |
public class ObservableCollection<T> : IList<T>, System.IObservable<T> | |
{ | |
private IList<T> list; | |
private IList<IObserver<T>> observers; |
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
def test(): | |
T = [] | |
T.append("it is what it is") | |
T.append("what is it") | |
T.append("it is a banana") | |
ii = inverseIndex(T) | |
for i in ii: | |
print(i) |
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 $ClassName$ | |
{ | |
[NUnit.Framework.Test] | |
public void $name$() | |
{ | |
$END$ | |
} | |
} |
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 class EnumEx | |
{ | |
public static IEnumerable<IEnumerable<T>> Split<T>(this IEnumerable<T> list, int maxItemsByPart) | |
{ | |
return SplitImpl(list, maxItemsByPart, 0, new List<IEnumerable<T>>()); | |
} | |
public static IEnumerable<IEnumerable<T>> SplitImpl<T>( | |
IEnumerable<T> list, | |
int maxItemsByPart, |
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 Async | |
{ | |
static IEnumerable<Uri> uris = new List<Uri>() | |
{ | |
new Uri("http://www.google.com"), | |
new Uri("http://www.bing.com"), | |
new Uri("http://www.yahoo.com") | |
}; | |
public static void DownloadStringAsync() |
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 static class EnumerableEx | |
{ | |
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> enumerable) | |
{ | |
var array = enumerable.ToArray(); | |
var random = new Random(DateTime.Now.Millisecond); | |
for (int i = array.Length - 1; i >= 1; i--) | |
{ |
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
private $Type$ $FieldName$; | |
public $Type$ $PropertyName$ | |
{ | |
get | |
{ | |
return $FieldName$; | |
} | |
set | |
{ |
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
import scala.util.{Try, Success, Failure} | |
def div = (x:Int, y:Int) => x / y | |
div(4, 2) | |
type Enumerable[T] = () => () => Option[T] | |
def empty[T]:Enumerable[T] = { | |
() => () => None | |
} |
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
//use read-only properties | |
class MyClass { | |
public int Prop1 { get; private set; } | |
public float Prop2 { get; private set; } | |
} | |
//GENERATED | |
class MyClass { | |
public int Prop1 { get; private set; } |