Skip to content

Instantly share code, notes, and snippets.

Ruben Bartelink bartelink

Block or report user

Report or block bartelink

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Buthrakaur / gist:1613003
Created Jan 14, 2012
NHibernate QueryOver.List extension to support casting to anonymous types
View gist:1613003
public static IList<TRes> ListAs<TRes>(this IQueryOver qry, TRes resultByExample)
var ctor = typeof (TRes).GetConstructors().First();
return qry.UnderlyingCriteria
public void ListAs_Should_CastQueryOverResultToTypeSameAsSupliedExampleInstance()
jboner / latency.txt
Last active Oct 23, 2019
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

bradwilson / Cacheability.cs
Created Jan 23, 2014
Using chaining to create cached results in ASP.NET Web API v2
View Cacheability.cs
public enum Cacheability
ploeh / gist:9702672
Created Mar 22, 2014
ASP.NET Web API 2 ApiController AutoFixture Customization
View gist:9702672
type ApiControllerCustomization() =
let controllerSpecification =
{ new IRequestSpecification with
member this.IsSatisfiedBy request =
match request with
| :? Type as t when typeof<ApiController>.IsAssignableFrom t ->
| _ -> false }
interface ICustomization with
filipw / gist:9846071
Last active May 3, 2016
ASP.NET Web API hosted in Azure Worker Role with OWIN in F#
View gist:9846071
namespace WebApi.AzureWorker
open Owin
open System
open System.Diagnostics
open System.Net
open System.Threading
open System.Net.Http
open System.Web.Http
open Microsoft.Owin.Hosting
eulerfx / EvetStore.fs
Last active Feb 20, 2016
EventStore pull-to-push subscription transition
View EvetStore.fs
let subscribeAsAsyncSeq (conn:IEventStoreConnection) (stream:string) (resolveLinks:bool) (bufferSize:int) (ct:CancellationToken) = asyncSeq {
use buffer = new System.Collections.Concurrent.BlockingCollection<ResolvedEvent>(bufferSize)
let inline onEvent subs (evt:ResolvedEvent) =
let inline onDrop (subs:EventStoreSubscription) (reason:SubscriptionDropReason) (ex:exn) =
printfn "SUBSCRIPTION DROPPED! last position=%i reason=%O ex=%O" (subs.LastEventNumber.GetValueOrDefault()) reason ex
let! subs = conn.SubscribeToStreamAsync(stream, resolveLinks, Action<_,_>(onEvent), Action<_,_,_>(onDrop), null) |> Async.AwaitTask
yield! buffer.GetConsumingEnumerable(ct) |> AsyncSeq.ofSeq
View SampleDeclarativeProjection.cs
public static class PlaceHolderForProjections {
public static readonly PortfolioProjection = TSql.Projection().
When<PortfolioAdded>(@event =>
"INSERT INTO [Portfolio] (Id, Name) VALUES (@P1, @P2)",
new { P1 = TSql.Int(@event.Id), P2 = TSql.NVarChar(@event.Name, 40) }
When<PortfolioRemoved>(@event =>
"DELETE FROM [Portfolio] WHERE Id = @P1",
View gist:8943d1b0f884f88bd8ae
#r @"c:\prg\Fuchu\Fuchu\bin\Debug\Fuchu.dll" //
open System
open Fuchu
// Write your tests as a list of string * Async<unit>
let tests = [
"Check google response", async {
use client = new System.Net.WebClient()
let! a = client.AsyncDownloadString (Uri(""))
isaacabraham / idiomaticjsonserialiser.fs
Created Sep 7, 2014
This JSON.Net converter handles F# discriminated unions with more "idiomatic" JSON than what is generated by the current version of JSON .NET. Option types and single case DUs are transparently handled, and tuple-style properties are used rather than array notation.
View idiomaticjsonserialiser.fs
namespace Newtonsoft.Json.Converters
open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open System
type IdiomaticDuConverter() =
inherit JsonConverter()
You can’t perform that action at this time.