Skip to content

Instantly share code, notes, and snippets.

@szilard
Last active December 25, 2015 20:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szilard/7036195 to your computer and use it in GitHub Desktop.
Save szilard/7036195 to your computer and use it in GitHub Desktop.
LA R meetup raffle
library(yaml)
library(RJSONIO)
library(httr)
event_id <- 132296372
n_max <- 20
api_key <- yaml.load_file("meetup_api_key.yml")$api_key
## get your api key from http://www.meetup.com/meetup_api/key/ while logged in
set.seed(123)
get_ssl <- function(url) rawToChar(GET(url, config = list(sslversion = 3, ssl.verifyhost = FALSE))$content)
## wrap httr::GET with ssl options that work with meetup.com
req_url <- paste0("https://www.meetup.com/2/rsvps?key=", api_key, "&event_id=", event_id, "&rsvp=yes")
rsvp_data <- fromJSON(get_ssl(req_url))
participants <- sort(sapply(rsvp_data$results, function(x) x$member$name))
data.frame(winners = sample(participants, n_max))
@nanodust
Copy link

:D

@mapmakerlol
Copy link

This is great. I am a winner! yay. I hope the 14 people before me are not present :P

@ajzz
Copy link

ajzz commented Oct 22, 2013

No book here. I blame seed 123!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment