Last active
December 29, 2015 23:39
-
-
Save webmat/7743980 to your computer and use it in GitHub Desktop.
Pick a winner out of EventBrite attendees (in CSV format)
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
Attendee # | Date | Last Name | First Name | 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 | [email protected] | 1 | DevOps Enthusiast (80) | 4 Nov 2013 | 218440551 | Free Order | 0.00 | 0.00 | 0.0 | 0.00 | Attending |
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
#!/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