Skip to content

Instantly share code, notes, and snippets.

View ashic's full-sized avatar

Ashic Mahtab ashic

View GitHub Profile
public class SomeCommandHandler
{
public void Handle(SomeCommand command)
{
}
}
public class UoWWrapper
{
public UoWWrapper(Action<object> next)
public class SomeCommandHandler
{
public SomeCommandhandler(uow){_uow = uow};
public void Handle(SomeCommand command)
{
}
}
public class UoWWrapper
@ashic
ashic / gist:1780910
Created February 9, 2012 16:26
Behold...my 4 line "framework"
public class Bus
{
public Dictionary<Type, Action<object>> _handlers = new ();
public void Register<T>(Action<T> handler) { _handlers[typeof(T)] = x=> (T)handler; }
public void Handle(object message) { _handlers[message.GetType()](message); }
}
public class ReqRepExample : Example
{
Context _context;
public void Start(Context context)
{
_context = context;
Task.Factory.StartNew(startServer);
Task.Factory.StartNew(()=> startClient("1"));
open System
open MSDN.FSharp.Charting
open System.Windows.Forms.DataVisualization.Charting
[<EntryPoint>]
let main argv =
let r = Random()
let chart = [for d in 0..100 ->
(d, d*2)]
@ashic
ashic / gist:5196918
Created March 19, 2013 15:09
Simple command wrappers in F#. Would love ideas about the comment.
// Learn more about F# at http://fsharp.net
// See the 'F# Tutorial' project for more help.
type DoSomething = { Id:string ; Name : string }
type DoSomethingElse = { Id:string ; Name : string }
type UnhandledSomething = { Id:string ; Name : string }
type Handlers () =
static member Handle (cmd:DoSomething) =
Powershell build step.
Script:Source.
Script source: & {$host.UI.RawUI.BufferSize = new-object System.Management.Automation.Host.Size(512, 50); .\tools\psake\psake .\build\build.ps1 ci;
if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }}
[replace .\tools\psake\psake .\build\build.ps1 ci with whatever your command line build is.
@ashic
ashic / gist:7136850
Created October 24, 2013 13:02
F# Console app (tried .NET 4.5 and 4.5.1). Chart seems to hang with Not Responding on Windows 8.1.
open FSharp.Charting
open System
[<EntryPoint>]
let main argv =
printfn "%A" argv
Chart.Line([ for x in 0 .. 10 -> x, x*x ]).ShowChart()
Console.ReadLine() |> ignore
0 // return an integer exit code
public class Worker
{
private readonly NetMQContext _context;
private readonly string _id;
public Worker(NetMQContext context, string id)
{
_context = context;
_id = id;
}
@ashic
ashic / gist:7371417
Last active December 27, 2015 18:39
C# vs F# 0MQ sync REP server
public class Server
{
private readonly NetMQContext _context;
private readonly string _id;
public Server(NetMQContext context, string id)
{
_context = context;
_id = id;
}