Skip to content

Instantly share code, notes, and snippets.

@mastoj
Created March 23, 2015 18:15
Show Gist options
  • Save mastoj/35e442a1e5f34522baf7 to your computer and use it in GitHub Desktop.
Save mastoj/35e442a1e5f34522baf7 to your computer and use it in GitHub Desktop.
F# Draw for meetup on meetups.com
#r "./FSharp.Data.2.2.0/lib/net40/FSharp.Data.dll"
open FSharp.Data
open System
let rnd = Random()
type RSVP = JsonProvider<"https://api.meetup.com/2/rsvps?&sign=true&photo-host=public&event_id=220966177&page=200&key=KEY">
let rsvps = RSVP.Load("https://api.meetup.com/2/rsvps?&sign=true&photo-host=public&event_id=220966177&page=200&key=KEY")
let mutable names = rsvps.Results
|> Array.filter (fun x -> (x.Response.Boolean |> Option.isSome) && (x.Response.Boolean |> Option.get))
|> Array.map (fun x -> x.Member.Name)
|> Set.ofArray
let draw() =
let index = rnd.Next(names.Count)
let name = names |> Seq.skip index |> Seq.head
names <- (Set.remove name names)
name
draw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment