Skip to content

Instantly share code, notes, and snippets.

@coderberry
Created October 3, 2009 04:38
Show Gist options
  • Select an option

  • Save coderberry/200404 to your computer and use it in GitHub Desktop.

Select an option

Save coderberry/200404 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'twitter'
password = File.read(File.join(File.dirname(__FILE__), "password.txt")).strip
httpauth = Twitter::HTTPAuth.new('teachmetocode', password)
client = Twitter::Base.new(httpauth)
followers = client.followers
puts "Out of #{followers.count} followers ..."
people = []
followers.each do |follower|
if Twitter::Search.new('@teachmetocode').from(follower.screen_name).count > 0
people << follower.screen_name
puts " + #{follower.screen_name} qualified ..."
else
puts " - #{follower.screen_name} did not qualify ..."
end
end
puts "#{people.length} followers qualified ..."
puts "and the winner is ..."
people = people.uniq
people.delete("cavneb")
puts "@" + people[rand(people.length)]
# RETURNED
Out of 61 followers ...
 + opalbaker qualified ...
 - decisionstats did not qualify ...
 - Cheech92007 did not qualify ...
 + BriansWifey05 qualified ...
 + macsupportcasts qualified ...
 - instant_website did not qualify ...
 - nanochrome did not qualify ...
 + thomashullin qualified ...
 + chadjardine qualified ...
 - JOSETTE989dn did not qualify ...
 + GentlyMad qualified ...
 - mandoescamilla did not qualify ...
 - yuikk did not qualify ...
 + DrDestructo qualified ...
 + dbrady qualified ...
 - SamuelTonini did not qualify ...
 - raduboncea did not qualify ...
 - PaulKinlan did not qualify ...
 - wpmuorg did not qualify ...
 + cesarfong qualified ...
 - jeffpoulton did not qualify ...
 + johnmquick qualified ...
 + LaurentBechir qualified ...
 + jtbandes qualified ...
 + justice_nd qualified ...
 + annepz qualified ...
 - BradfordBenn did not qualify ...
 + nikalston qualified ...
 - jlknott did not qualify ...
 + TechSmith qualified ...
 - matteomoci did not qualify ...
 - carlisia did not qualify ...
 - joshbuddy did not qualify ...
 + justinpease qualified ...
 - mully did not qualify ...
 + hornbeck qualified ...
 - jayfallon did not qualify ...
 - neokain did not qualify ...
 - mixpanel did not qualify ...
 - nileshnk did not qualify ...
 + k776 qualified ...
 + NAudo qualified ...
 - nkanthikiran did not qualify ...
 - bestteachertips did not qualify ...
 - mwoods79 did not qualify ...
 - linki85 did not qualify ...
 - learnivore did not qualify ...
 - orangea did not qualify ...
 - grantmichaels did not qualify ...
 - bbuckley did not qualify ...
 - bmabey did not qualify ...
 - jakemallory did not qualify ...
 - JohnDel did not qualify ...
 - spig did not qualify ...
 - codaset did not qualify ...
 - eltiare did not qualify ...
 - gnupate did not qualify ...
 + brackenm qualified ...
 - littleidea did not qualify ...
 - travisbhartwell did not qualify ...
 + cavneb qualified ...
22 followers qualified ...
and the winner is ...
@NAudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment