Skip to content

Instantly share code, notes, and snippets.

View mikehadlow's full-sized avatar

Mike Hadlow mikehadlow

View GitHub Profile
FROM nornagon/postgres
MAINTAINER mike@suteki.co.uk
ADD sql sql
ADD create_db.sh /src/
USER postgres
RUN /src/create_db.sh
@mikehadlow
mikehadlow / README.md
Last active August 29, 2015 14:02
Segment Clock

A little D3js demo of a clock based on circle segments, more normally used for creating pie charts. I've speeded up time to 1 second == 1 hour to make it a little more visually interesting.

@mikehadlow
mikehadlow / README.md
Last active August 29, 2015 14:02
Predict Your Awesomeness

The results of playing with building graphs using D3js. This doesn't really predict your awesomeness over the next 100 days, it's entirely random, so if you don't like the results, just hit refresh to see if you get a better prediction :)

@mikehadlow
mikehadlow / Program.fs
Created April 20, 2015 11:11
Basic Nowin self host. No dependencies on Microsoft.Owin.* assemblies.
open System
open System.IO
open System.Net
open System.Collections.Generic
open System.Threading.Tasks
let port = 8888
let endWithCompletedTask = fun x -> Task.FromResult(null) :> Task
type OwinEnvironment = {
let private Main () =
// traverse that works for 'get' only
let traverse ((f1, f2): PLens<'a, 'b>): Lens<'a list, 'b list> =
(fun x -> x |> List.map f1 |> List.choose id),
(fun _ -> fun x -> x) // this doesn't work
let resourceMapLens =
Json.ObjectPLens
>??> mapPLens "links"
@mikehadlow
mikehadlow / AwaitableCompositionSpike.cs
Created July 9, 2015 15:27
Composing monadic async results using Linq
using System;
using System.Threading.Tasks;
namespace Monads
{
public static class AwaitableCompositionSpike
{
/// <summary>
/// First spike composes three aysnc results using Bind(..) extension method
/// </summary>
open System
open Microsoft.Owin.Hosting
[<EntryPoint>]
let main argv =
let baseAddress = "http://localhost:8888"
use application = WebApp.Start<Startup.Startup>(baseAddress)
@mikehadlow
mikehadlow / add-1.fs
Created September 10, 2015 09:51
Partial application in C#
let add a b = a + b
using System;
using System.Collections.Generic;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.Resolvers.SpecializedResolvers;
using Castle.Windsor;
namespace Mike.Spikes
{
public class WindsorCircularArrayRefs
{
using System;
using System.Collections.Generic;
using System.Linq;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
namespace Mike.Spikes
{
public class CanResolveByGenericTypeConstraints
{