Skip to content

Instantly share code, notes, and snippets.

@donfrancisco
Forked from oliyoung/gist:98312
Created June 16, 2012 08:06
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 donfrancisco/2940456 to your computer and use it in GitHub Desktop.
Save donfrancisco/2940456 to your computer and use it in GitHub Desktop.
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