I hereby claim:
- I am ascjones on github.
- I am ascjones (https://keybase.io/ascjones) on keybase.
- I have a public key ASBTq9RVfmKxJwI8qnHwlnEq2P7FItUz0kuPzITwwCBJBwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // translated to F# Script from https://gist.github.com/brianlow/1553265 | |
| open System.IO | |
| open System.Reflection | |
| type Reference = { | |
| Assembly : AssemblyName | |
| ReferencedAssembly : AssemblyName | |
| } |
| let optionList l = | |
| let rec bindList xs acc = | |
| match xs with | |
| | [] -> Some acc | |
| | h::t -> h |> Option.bind (fun x -> bindList t (x::acc)) | |
| bindList l [] | |
| module Option = | |
| let map2 f a b = | |
| a |> Option.bind (fun a' -> b |> Option.map (fun b' -> f a' b')) |
| module Blob | |
| type Cell = | |
| | Black | |
| | White | |
| type Grid = Cell [,] | |
| Array2D.init 4 4 (fun x y -> x + y) |> Array2D.mapi (fun x y _ -> (x,y)) |
| public static class MemoryCacheExtensions | |
| { | |
| public static T AddOrGetExistingLazy<T>(this MemoryCache cache, string key, Func<T> valueFactory, CacheItemPolicy cacheItemPolicy) | |
| { | |
| var newValue = new Lazy<T>(valueFactory); | |
| var value = (Lazy<T>)cache.AddOrGetExisting(key, newValue, cacheItemPolicy); | |
| return (value ?? newValue).Value; // Lazy<T> handles the locking itself | |
| } | |
| public static void SetLazy<T>(this MemoryCache cache, string key, T value, CacheItemPolicy cacheItemPolicy) |
| <?xml version="1.0" encoding="utf-8"?> | |
| <key name="Software"> | |
| <key name="ConEmu"> | |
| <key name=".Vanilla" modified="2015-02-19 17:28:16" build="140505"> | |
| <value name="ColorTable00" type="dword" data="00000000"/> | |
| <value name="ColorTable01" type="dword" data="00800000"/> | |
| <value name="ColorTable02" type="dword" data="00008000"/> | |
| <value name="ColorTable03" type="dword" data="00808000"/> | |
| <value name="ColorTable04" type="dword" data="00000080"/> | |
| <value name="ColorTable05" type="dword" data="00800080"/> |
| public static class EventStoreHelpers | |
| { | |
| public static IEnumerable<T> ReadAllStreamEventsForward<T>(this IEventStoreConnection conn, string streamName, Func<RecordedEvent, T> createEvent, int pageSize) | |
| { | |
| StreamEventsSlice currentSlice; | |
| var nextSliceStart = StreamPosition.Start; | |
| do | |
| { | |
| var task = conn.ReadStreamEventsForwardAsync(streamName, nextSliceStart, pageSize, true); task.Wait(); | |
| currentSlice = task.Result; |
| class ProgressBar | |
| { | |
| private const char Start = '['; | |
| private const char End = ']'; | |
| private const char InProgress = '>'; | |
| private const char Done = '-'; | |
| private readonly int totalSize; | |
| private readonly int progressLength; | |
| private readonly int chunkSize; |
| let stripZeros d = d / 1.000000000000000000000000000000000M | |
| // > stripZeros 1.5000M;; | |
| // val it : decimal = 1.5M |
| class YesOrNo<TState> | |
| { | |
| private readonly TState state; | |
| private readonly bool keepGoing; | |
| public bool Success { get { return keepGoing; } } | |
| public YesOrNo(TState state = default (TState), bool keepGoing = true) | |
| { | |
| this.state = state; |