This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| $source = @" | |
| using System; | |
| using System.Runtime.InteropServices; | |
| namespace MyTools | |
| { | |
| public static class cache | |
| { | |
| [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)] | 
| interface IFin | |
| { | |
| int Ordinal { get; } | |
| } | |
| class Fin3 { } | |
| class Fin2 : Fin3 { } | |
| class Fin1 : Fin2 { } | |
| class Fin0 : Fin1 { } | |
| class Foo | 
| function prompt { | |
| # Admin ? | |
| if( ( | |
| New-Object Security.Principal.WindowsPrincipal ( | |
| [Security.Principal.WindowsIdentity]::GetCurrent()) | |
| ).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) | |
| { | |
| # Admin-mark in WindowTitle | |
| $Host.UI.RawUI.WindowTitle = "[Admin] " + $Host.UI.RawUI.WindowTitle | |
| module EventStoreHelpers = | |
| open System | |
| open System.Net | |
| open EventStore.ClientAPI | |
| let inline private (!>) (x:^a) : ^b = ((^a or ^b) : (static member op_Implicit : ^a -> ^b) x) | |
| let private dnsLookup (host : string) = | |
| let hostEntry = Dns.GetHostEntry(host) | 
| open System | |
| // THE MODEL represents only allowed states | |
| // ======================================== | |
| type Game = | |
| { F1 : Frame; F2 : Frame; F3 : Frame; F4 : Frame; F5 : Frame; F6 : Frame; F7 : Frame; F8 : Frame; F9 : Frame; F10 : FinalFrame } // todo: add extra frames, and FinalFrame type? | |
| and Frame = | |
| | Strike | |
| | Spare of PinCount | 
| Verifying that +ascjones is my Bitcoin username. You can send me #bitcoin here: https://onename.io/ascjones | 
| [<AutoOpen>] | |
| module JsonExtensions = | |
| open System | |
| open Fleece | |
| open Fleece.Operators | |
| open FSharpPlus | |
| open System.Globalization | |
| type FromJSONClass with | 
| / ***********************************************************/ | |
| / * Exercise: Fibonacci closure, http://tour.golang.org/#44 */ | |
| / ***********************************************************/ | |
| package main | |
| import "fmt" | |
| func fibonacci() func() int { | |
| x, y := 0, 1 | 
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer