Skip to content

Instantly share code, notes, and snippets.

@qwo
Last active August 29, 2015 14:03
Show Gist options
  • Save qwo/9de443b149c7ab37573a to your computer and use it in GitHub Desktop.
Save qwo/9de443b149c7ab37573a to your computer and use it in GitHub Desktop.
Meetup Raffle Script
//pass in number of winners
//todo UNIQUE winners and prize mapping
var pickWinners = function(numberOfWinners){
var meetup = $(".member-name");
var winners = [];
var picked_numbers = {};
while (numberOfWinners){
var winner = Math.floor(Math.random() * meetup.length);
////bug in duplciates ins winners array
if(winners.indexOf($(meetup[winner]).text().trim()) < 0 ){
winners.push($(meetup[winner]).text().trim());
numberOfWinners = numberOfWinners - 1;
}
}
//generate winner/s
return winners
}
//pickWinners(5)
@qwo
Copy link
Author

qwo commented Aug 19, 2014

updated to make robust

@qwo
Copy link
Author

qwo commented Sep 15, 2014

fixed errors works 100% now.

clippers(generateWinners(5))

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