Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Created May 18, 2009 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jerodsanto/113270 to your computer and use it in GitHub Desktop.
Save jerodsanto/113270 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'twitter'
base = Twitter::Base.new(Twitter::HTTPAuth.new('username', 'password'))
my_friends = base.friend_ids
candidates = my_friends.inject(Array.new) { |array,id| array += Twitter.friend_ids(id); array }
candidates -= my_friends
tallied = candidates.inject(Hash.new(0)) { |hash, can| hash[can] += 1; hash }
ordered = tallied.sort { |x,y| y[1] <=> x[1] }
ordered[0..9].each do |array|
user = base.user(array[0])
puts "#{user.screen_name} is followed by #{array[1]} of the people you follow."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment