Skip to content

Instantly share code, notes, and snippets.

@AniFichadia
Last active August 29, 2015 14:24
Show Gist options
  • Save AniFichadia/f07dca20bff3df3ca716 to your computer and use it in GitHub Desktop.
Save AniFichadia/f07dca20bff3df3ca716 to your computer and use it in GitHub Desktop.
A quick and dirty meetup raffle. Just run it through your browser console on your meetups event page before it ends to draw a random winner. If the event has ended, use the commented code at the top of the Gist to retrieve more attendees. There's no dependencies since it uses the scripts included by meetup.com
// If you need it, use this to get more meetup attendee. eg. after an event.
// This should run and complete it's operation before running the other code
// $('a.nav-appendPager').click();
// Get the attendees list, this excludes members who haven't RSVP'd
var attendees = $('.event-attendees .member-name a');
var attendeesCount = attendees.length;
// Draw a random winner
var winner = attendees[Math.floor(Math.random() * attendeesCount)].text;
// Present winner details and fanfare!
console.log('Drumroll!! *insert sound effects here*');
console.log('(out of ' + attendeesCount + ' attendees)');
console.log('The winner is: ' + winner + '!');
console.log('*insert fireworks and fanfare*');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment