This file contains 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
type CodeListElement = CodeListElement of int * string |
This file contains 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
using(var pub = new ChangeReceiver("tcp://*:5555")) | |
{ | |
Console.WriteLine("Listening..."); | |
var staffSender = new NotificationSender("tcp://localhost:5556"); | |
var customerSender = new NotificationSender("tcp://localhost:5557"); | |
var obs = Observable.FromEventPattern<Tuple<Guid, string>>(pub, "ChangeRecieved").Select(ep => ep.EventArgs); | |
obs.GroupBy(x => x.Item2) |
This file contains 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 countChar (c:char) (s:string) = | |
let mutable length = s.Length | |
let mutable k = 0 | |
while (length <- length - 1; length >= 0) do | |
if s.[length] = c then k <- k + 1 | |
k |
This file contains 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
[<EntryPoint>] | |
let main argv = | |
let rec loop () = async { | |
do! Async.Sleep 10 | |
return! loop () } | |
Async.Start <| loop () | |
System.Console.ReadLine() |> ignore | |
0 | |
(* compled representations of loop |
This file contains 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
[<EntryPoint>] | |
let main argv = | |
let rec loop () = async { | |
do! Async.Sleep 10 | |
return! loop () | |
return! loop () } | |
Async.Start <| loop () | |
System.Console.ReadLine() |> ignore | |
0 | |
This file contains 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 | |
[<EntryPoint>] | |
let main argv = | |
let create wait = | |
let agent = new MailboxProcessor<_>(fun inbox -> | |
let rec loop () = async { | |
let! msg = inbox.TryReceive wait | |
match msg with | |
| Some _ -> | |
() //no return |
This file contains 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
#r "libgit2sharp/Build/LibGit2Sharp.dll" | |
open System | |
open System.IO | |
open LibGit2Sharp | |
let stores = (Path.GetTempPath() + "local") |> Directory.CreateDirectory | |
let remote = (Path.GetTempPath() + "remote") |> Directory.CreateDirectory | |
let repoName = string (Guid.NewGuid()) | |
let first = (remote.FullName + "//" + repoName) |> Directory.CreateDirectory |
This file contains 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
(expired | |
(where* (fn [e] (not (tagged-any? ["iis"] e))) | |
...)) |
This file contains 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
2015-07-08 12:56:01 +0100 [warn]: temporarily failed to flush the buffer. next_retry=2015-07-08 12:57:09 +0100 error_class="NoMethodError" error="undefined method `&' for 1436356479.1659427:Float" instance=70010588238460 | |
2015-07-08 12:56:01 +0100 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/beefcake-0.5.0/lib/beefcake/buffer/encode.rb:86:in `append_uint64' | |
2015-07-08 12:56:01 +0100 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/beefcake-0.5.0/lib/beefcake/buffer/encode.rb:61:in `append_int64' | |
2015-07-08 12:56:01 +0100 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/beefcake-0.5.0/lib/beefcake/buffer/encode.rb:13:in `append' | |
2015-07-08 12:56:01 +0100 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/beefcake-0.5.0/lib/beefcake.rb:102:in `block in encode!' | |
2015-07-08 12:56:01 +0100 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/beefcake-0.5.0/lib/beefcake.rb:90:in `each' | |
2015-07-08 12:56:01 +0100 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/beefcake-0.5.0/li |
This file contains 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
//invaluable for all those Choice<'a, exn> flows | |
let exnf f = Printf.ksprintf (fun s -> exn s) f | |
//combine paths | |
let (</>) x y = System.IO.Path.Combine(x, y) | |
//allows you to pattern match on values in the current scope rather than just literals | |
let (|Eq|_|) expected value = | |
if expected = value then Some () | |
else None |