Skip to content

Instantly share code, notes, and snippets.

@sferik sferik/winner.rb
Created Oct 1, 2009

Embed
What would you like to do?
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
You can’t perform that action at this time.