Skip to content

Instantly share code, notes, and snippets.

View mikehadlow's full-sized avatar

Mike Hadlow mikehadlow

View GitHub Profile
@mikehadlow
mikehadlow / UserTypeSpike.cs
Created February 7, 2011 10:08
Fluent NHibernate failing test (can insert into FluentNHibernate.Testing and run)
using System;
using System.Data;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using FluentNHibernate.Conventions;
using FluentNHibernate.Mapping;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.SqlTypes;
using NHibernate.Tool.hbm2ddl;
@mikehadlow
mikehadlow / Identity.cs
Created January 25, 2011 23:14
The simplest possible Monad in three languages: C#, F# and Haskell
using System;
namespace Suteki.Monads
{
public class FunctionComposition
{
public void AddTwoNumbers()
{
var result =
from a in 3.ToIdentity()
@mikehadlow
mikehadlow / Suteki.TestRunner.js
Created January 20, 2011 12:22
A little javascript test runner for node.js
// run unit tests in node like this:
// node Suteki.TestRunner.js
//
// Unit tests should be named like this:
// Suteki.<name target>.Tests.js
//
// A test looks like this:
//
// (function(){
//
@mikehadlow
mikehadlow / Suteki.EventBus.js
Created January 19, 2011 16:18
A simple javascript event bus
var Suteki = Suteki || {};
Suteki.new_eventBus = (function(){
var self = {};
var subscriptions = {};
var unsubscribeTokens = [];
var subscriptionPointers = [];
@mikehadlow
mikehadlow / Geolocation.htm
Created November 17, 2010 10:35
HTML5 / Google maps api, Get the long name of the current user's coujntry
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Geolocation Demo</title>
<script src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="Geolocation.js" type="text/javascript"></script>
<style type="text/css">
body
using System;
using System.Collections.Generic;
using System.Linq;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
namespace Mike.Spikes
{
public class CanResolveByGenericTypeConstraints
{
using System;
using System.Collections.Generic;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.Resolvers.SpecializedResolvers;
using Castle.Windsor;
namespace Mike.Spikes
{
public class WindsorCircularArrayRefs
{