Created
April 20, 2009 01:32
-
-
Save oliyoung/98312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'httparty' | |
class Representative | |
include HTTParty | |
end | |
get '/' do | |
erb :form | |
end | |
get '/:username' do | |
require 'cgi' | |
@oprah_joined = Date.parse("Fri Jan 23 15:18:34 +0000 2009") | |
data = Representative.get("http://twitter.com/users/show/#{params[:username]}.json", :format => :json) | |
@user_joined = data.has_key?(:status) ? Date.parse(data['status']['created_at']) : Date.parse(data['created_at']) | |
@text = @oprah_joined > @user_joined ? "was" : "wasn't" | |
erb :index | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment