Skip to content

Instantly share code, notes, and snippets.

@webmat
Last active December 29, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmat/7743980 to your computer and use it in GitHub Desktop.
Save webmat/7743980 to your computer and use it in GitHub Desktop.
Pick a winner out of EventBrite attendees (in CSV format)
Attendee # Date Last Name First Name Email QTY Ticket Type Date Attending Order # Order Type Total Paid (USD) Fees Paid (USD) Eventbrite Fees (USD) CC Processing (USD) Attendee Status Home Address 1 Home Address 2 Home City Home State/Province Home Postcode Home Country
277877635 21 Oct 2013 Martin Mathieu webmat@gmail.com 1 DevOps Enthusiast (80) 4 Nov 2013 218440551 Free Order 0.00 0.00 0.0 0.00 Attending
#!/usr/bin/env ruby
require 'csv'
attendees = CSV.read(ARGV.first, :headers => true) # load attendees
winner = attendees[ rand(attendees.size) ] # pick a winner
puts "Winner: #{winner['First Name']} #{winner['Last Name']} " +
"(Attendee # #{winner['Attendee #']})"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment