Skip to content

Instantly share code, notes, and snippets.

using System;
using System.IO;
using System.Net;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace NodeSharp
{
class Program
using System;
using System.IO;
using System.Net;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace NodeSharp
{
class Program
@thinkbeforecoding
thinkbeforecoding / gist:5305933
Created April 3, 2013 22:15
F# Statically resolved types
let inline count (counter: ^T) =
let value = (^T: (member Count : int) counter)
value
function Upgrade-ESProjections {
<#
.SYNOPSIS
Upgrades projections for EventStore v2.
.DESCRIPTION
Start the EventStore v2 on existing data.
Run this Cmdlet with the store http endpoint and user credentials.
Restart the EventStore v2. Projections should be updated.
@thinkbeforecoding
thinkbeforecoding / PureFunc
Created July 27, 2013 22:08
Pure functions for Event Sourcing
Decide:
Command -> State -> Event list
ApplyStateChange:
State -> Event -> State
@thinkbeforecoding
thinkbeforecoding / Json.fs
Created August 9, 2013 12:37
JObj for Newtonsoft.Json in F#
module Json
open System
open Newtonsoft.Json
type JObj =
| JNull
| JInt of int64
| JString of string
| JFloat of float
#r @"..\packages\SharpDX.2.5.0\lib\net40\SharpDX.dll"
#r @"..\packages\SharpDX.Direct3D11.2.5.0\lib\net40\SharpDX.Direct3D11.dll"
#r @"..\packages\SharpDX.DXGI.2.5.0\lib\net40\SharpDX.DXGI.dll"
#r @"..\packages\SharpDX.Toolkit.2.5.0\lib\net40\SharpDX.Toolkit.dll"
#r @"..\packages\SharpDX.Toolkit.Game.2.5.0\lib\net40\SharpDX.Toolkit.Game.dll"
#r @"..\packages\SharpDX.Toolkit.Graphics.2.5.0\lib\net40\SharpDX.Toolkit.Graphics.dll"
open System
open SharpDX
open SharpDX.Toolkit
@thinkbeforecoding
thinkbeforecoding / Zip computation
Created January 20, 2014 23:30
This is an example of the Zip (applicative functor) experimental extension to Computation Expression. using for .. and ... do, sources are merges using the .Merge(xs,f) method. If Select is defined and the rest of the expression is a simple projections, the result is Select(Merge(xs,ys), projection) else it is Bind(Merge(xs,ys), rest of the expr…
open System
type ZipBuilder() =
member t.Zip(xs,ys) = List.zip xs ys
member t.For(xs,f) = List.collect f xs
member t.Yield x = [x]
member t.Select(xs,f) =
List.map f xs
member t.Zero() = []
@thinkbeforecoding
thinkbeforecoding / csharp.cs
Last active August 29, 2015 13:56 — forked from ToJans/csharp.cs
Here is a cleaner, shorter version.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace TDDCoverage
{
public class Order
{
@thinkbeforecoding
thinkbeforecoding / csharp.cs
Last active August 29, 2015 13:56 — forked from ToJans/csharp.cs
Other try without query expression. articles is now a map.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace TDDCoverage
{
public class Order
{