This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git config alias.browse '!start `git config remote.origin.url`' | |
| git config --global alias.df diff | |
| git config --global alias.dft difftool | |
| git config --global alias.mgt mergetool | |
| git config --global alias.logg 'log --abbrev-commit --decorate --oneline --graph -30' | |
| git config --global alias.logga 'log --abbrev-commit --decorate --oneline --graph -30 --all' | |
| git config --global alias.ss 'status -s' | |
| git config --global alias.co checkout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Option | |
| let Else second = function | |
| | Some _ as first -> first | |
| | None -> second | |
| let ofNullable = function | |
| | null -> None | |
| | i -> Some i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module WebJobShutdownWatcher | |
| open System | |
| open System.IO | |
| /// Allows to handle an event that fires when a WebJob process is about to close. | |
| /// Based on a blog-post: http://blog.amitapple.com/post/2014/05/webjobs-graceful-shutdown | |
| let subscribe handler = | |
| let shutdownFile = Environment.GetEnvironmentVariable "WEBJOBS_SHUTDOWN_FILE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // simplified version a snipped found here: http://fssnip.net/sT | |
| let inline tryParse text : ^a option = | |
| let mutable result = Unchecked.defaultof<_> | |
| if (^a : (static member TryParse: string * ^a byref -> bool) (text, &result)) | |
| then Some result | |
| else None | |
| // usage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Option = | |
| let (|??) = defaultArg | |
| let (|?) nullable d = if isNull nullable then d else nullable | |
| // usage | |
| open Option | |
| [] |> List.tryHead |?? 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // An example of Kleisli composition | |
| let (>>=) m f = Option.bind f m | |
| let (>=>) mf mg = fun x -> mf x >>= mg | |
| let tryParseInt s = | |
| match System.Int32.TryParse s with | |
| | true, v -> Some v | |
| | _ -> None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open System | |
| open FsCheck | |
| let positiveDecimal = gen { | |
| let! low = Gen.elements [0..1000] | |
| let! mid = Gen.elements [0..100] | |
| let! scale = Gen.elements [0..5] | |
| return! | |
| Gen.elements [ | |
| Decimal(low, mid, 0, false, byte scale) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let optionListMap f = (Option.map >> List.map) f | |
| let square x = x * x | |
| let squareLifted = optionListMap square | |
| squareLifted [Some 2; None; Some 3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module List | |
| let rec diffDups minuend subtrahend = | |
| let rec removeFirst i = function | |
| | h::t -> if h = i then t else h::(removeFirst i t) | |
| | [] -> [] | |
| match subtrahend with | |
| | h::t -> diffDups (removeFirst h minuend) t |
OlderNewer