Skip to content

Instantly share code, notes, and snippets.

View AlexCuse's full-sized avatar

Alex Ullrich AlexCuse

View GitHub Profile
@AlexCuse
AlexCuse / gist:1008510
Created June 5, 2011 00:02
Seq.concat wasn't working right (was only checking the recipe queue). Async wasn't working either but this seems to do ok.
module Program
#light
open System.Threading
open StructureMap
open BrewTelligence.Domain
open BrewTelligence.Search.Indexing
open BrewTelligence.ApplicationServices
open BrewTelligence.ApplicationServices.Messaging
ObjectFactory.Initialize(fun x -> x.AddRegistry (new SearchRegistry()))
let write<'T> item =
async {
ObjectFactory.GetAllInstances<Indexer<'T>>()
|> Seq.iter (fun idxr -> idxr.Index item)
}
let itemsToIndex<'T when 'T:null and 'T:not struct and 'T:equality> =
let p = QueueProvider<'T>.Create()
@AlexCuse
AlexCuse / gist:894707
Created March 30, 2011 16:17
euler repl
#light
module ProjectEuler.Program
open System;
open System.Diagnostics;
open System.Reflection;
let dynamicExecute prob =
let probNum = prob.ToString()
let ass = Assembly.GetExecutingAssembly()
let modul = ass.GetType("ProjectEuler.Problem" + probNum)
@AlexCuse
AlexCuse / Membership.cs
Created October 1, 2010 01:11
NHibernate based Membership Provider - I found this on the code project. Modified it to use a single session, and maybe a few other things. Need to change references around, supply own user. But it's definitely come in handy
/*
//Software usage License : Fluent Nhibernate membership and role provider
//--------------------------------------------------
//Copyright (c) 2010, Suhel Shah (suhel.shah@gmail.com)
//All rights reserved.
//Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.