Skip to content

Instantly share code, notes, and snippets.

@worldeggplant
Created June 27, 2013 08:21
Show Gist options
  • Save worldeggplant/5874846 to your computer and use it in GitHub Desktop.
Save worldeggplant/5874846 to your computer and use it in GitHub Desktop.
Draws n random instagram followers for competitions etc.
/**
* Draws random winners from followers on Instagram
* To be used on Statigram's My Followers page
* @author Jonas Skovmand (jonas.skovmand@tres-bien.com)
* @usage Paste the code in to your browser console and let it rip.
* You will have to scroll to the bottom of your followers list as well.
**/
var followers = $('.detailUser'),
winner_count = 5,
winners = [];
console.log('@instagramaccount has ' + followers.length + ' followers!');
console.log('Picking ' + winner_count + ' winners...');
console.log('');
for (var temp_i=0; temp_i < winner_count; temp_i++){
console.log('#' + (temp_i+1) + '...');
var winner = Math.floor(Math.random()*followers.length);
var winner_username = followers.eq(winner).find('.name').text();
winners.push(winner_username);
console.log('@' + winner_username.toUpperCase());
console.log('');
}
console.log('');
console.log('All winners have been drawn! Congratulations to those who won, and better luck next time for everyone else');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment