This file contains 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 TradeController | |
{ | |
private readonly IRepository<Trade> _Trades; | |
public TradeController(IRepository<Trade> trades) | |
{ | |
_Trades = trades; | |
} | |
[ValidationExceptionFilter] |
This file contains 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
int* mergesort(int input[], size_t length) | |
{ | |
if(length == 1) | |
{ | |
return input; | |
} | |
int pivot = length/2; | |
size_t a_length = pivot; | |
size_t b_length = length-pivot; | |
int *a = mergesort(input, a_length); |
This file contains 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
mergesort = (input) -> | |
n = input.length | |
if n == 1 | |
return input | |
pivot = Math.floor n/2 | |
a = mergesort input[0...pivot] # coffee script does not include the last element in a slice | |
b = mergesort input[pivot...n] | |
merge(a, b) | |
merge = (a, b) -> |
This file contains 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.IO; | |
public class LogSearcher | |
{ | |
public static int DateLength = "2013-12-29 17:37:56".Length; | |
public void Search(string path, DateTime start, DateTime end, TextWriter results) | |
{ | |
using (var file = File.Open(path, FileMode.Open)) |
This file contains 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
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" /> | |
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script> | |
<script src="us-states.js"></script> | |
</head> | |
<body> | |
<div id="map" style="height: 580px"></div> | |
<script> |
This file contains 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 SystemTime | |
{ | |
private static readonly ThreadLocal<Func<DateTime>> _Now = new ThreadLocal<Func<DateTime>>(() => () => DateTime.Now); | |
public static DateTime Now | |
{ | |
get { return _Now.Value(); } | |
} | |
public static ResetSystemTime Set(DateTime executionTime) |
This file contains 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; | |
using PagedList; | |
public class DataTablesSearch | |
{ | |
public string Value { get; set; } | |
public bool Regex { get; set; } | |
} |
This file contains 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 FastAccessor<T> where T : class | |
{ | |
private static readonly Hashtable _cache = new Hashtable(); | |
public static FastAccessor<T> For(T target) | |
{ | |
if (_cache.ContainsKey(typeof(T))) | |
{ | |
var dlg = (Action<T, string, object>)_cache[typeof(T)]; | |
return new FastAccessor<T>(dlg, target); |
This file contains 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 WhereBuilder | |
{ | |
private readonly IProvider _provider; | |
private TableDefinition _tableDef; | |
public WhereBuilder(IProvider provider) | |
{ | |
_provider = provider; | |
} |
OlderNewer