Skip to content

Instantly share code, notes, and snippets.

@sferik
Created October 1, 2009 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sferik/198610 to your computer and use it in GitHub Desktop.
Save sferik/198610 to your computer and use it in GitHub Desktop.
require 'curb'
require 'json'
followers_response = Curl::Easy.http_get("http://twitter.com/followers/ids/perpetually.json")
followers = JSON.parse(followers_response.body_str)
winner_id = followers[rand(followers.length)]
users_response = Curl::Easy.http_get("http://twitter.com/users/show/#{winner_id}.json")
winner = JSON.parse(users_response.body_str)
puts "We have a winner!"
puts "Name: #{winner['name']}"
puts "Screen Name: #{winner['screen_name']}"
puts "Location: #{winner['location']}"
puts "Bio: #{winner['description']}"
puts "URL: #{winner['url']}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment