Skip to content

Instantly share code, notes, and snippets.

View michael-newton-15below's full-sized avatar

Michael Newton michael-newton-15below

View GitHub Profile
module FifteenBelow.MailWatcher.ErrorHandling.Audit
open ...
type AuditBuilder (auditClient : IAuditClient, log : ILog, config : IConfigurationManager) =
let app = config.ApplicationInformation
member this.Bind (expr, func) =
match expr with
| None -> None
| Some r ->
try func r
@michael-newton-15below
michael-newton-15below / IErrorHandlerBuilder.fs
Created January 14, 2013 21:02
Error handler interface
open System
type IErrorHandlerBuilder =
abstract member Bind : Option<'T> * ('T -> Option<'U>) -> Option<'U>
abstract member Delay : (unit -> Option<'T>) -> Option<'T>
abstract member Return : 'T -> Option<'T>
abstract member ReturnFrom : Option<'T> -> Option<'T>
abstract member TryFinally : Option<'T> * (unit -> unit) -> Option<'T>
abstract member Using : 'T * ('T -> Option<'U>) -> Option<'U> when 'T :> IDisposable
abstract member Zero : unit -> Option<'T>
@michael-newton-15below
michael-newton-15below / NuGetStuff.fsx
Created November 23, 2012 16:19
Compiler error minimal case
#r "FAKE\Nuget.Core.dll"
#r "System.Xml.Linq"
#r "FAKE\FakeLib.dll"
new SemanticVersion("5.5.0.0")
@michael-newton-15below
michael-newton-15below / GrabNugets.fsx
Created November 20, 2012 15:07
Nuget.Core example
#r "Nuget.Core"
#r "System.Xml.Linq"
open NuGet
open System
open System.Linq
let repoFac = new PackageRepositoryFactory()
let repo = repoFac.CreateRepository("http://btn-tc01:8083")
let FiveFiveVersion = new SemanticVersion("5.5.0")
let packages = repo.FindPackages("Database.PASNGR", new VersionSpec(), false, false)
let FizzBuzz i =
let rec inner i c =
printf "%d:\t" c
if c % 3 = 0 then printf "Fizz"
if c % 5 = 0 then printf "Buzz"
printfn ""
if c < i then c + 1 |> inner i else ()
inner i 1
let KarlFizzBuzz i =
@michael-newton-15below
michael-newton-15below / Program.fs
Created October 4, 2012 09:03
Service stress testing with EasyNetQ and F#
// Learn more about F# at http://fsharp.net
open EasyNetQ
open EasyNetQ.Loggers
open FifteenBelow.WindowsServices.Messages
open FifteenBelow.WindowsServices
open FifteenBelow.Utilities.Configuration
open FifteenBelow.Configuration.AppConfig
let mutable logger = new ConsoleLogger()
logger.Debug <- false