Skip to content

Instantly share code, notes, and snippets.

View tibbon's full-sized avatar

David Fisher tibbon

View GitHub Profile
@tibbon
tibbon / gist:2393556
Created April 15, 2012 15:57
Helping Dave S get started on Rails 3.x with Heroku
# This creates your rails site in the directory called 'davesite'. You can replace 'davesite' with anything that starts with a letter.
rails new davesite
#Change to the davesite directory.
cd davesite
#Logs you onto Heroku. You only really need to do this once unless you have multiple accounts
heroku login
@tibbon
tibbon / gist:2430478
Created April 20, 2012 17:30
Basic Blog Post HTML5 Layout
<article>
<header>
<hgroup>
<h1>Name of my post</h1>
<h2>subheading</h2>
</hgroup>
<p>By <author><a href="/bio/David_Fisher" rel="author">David Fisher</a></author></p>
<p><time>June 23, 2012</time></p>
</header>
<p>
@tibbon
tibbon / Gemfile
Created September 13, 2012 15:03
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@tibbon
tibbon / gist:4172304
Created November 29, 2012 22:23
Twitter Gem attempted Test, which is failing
describe "#friends" do
context "with a screen_name passed" do
before do
stub_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.friends("sferik")
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
end
@tibbon
tibbon / gist:4172305
Created November 29, 2012 22:23
Twitter Test Failure results
Failures:
1) Twitter::API::FriendsAndFollowers#friends with a screen_name passed requests the correct resource
Failure/Error: @client.friends("sferik")
WebMock::NetConnectNotAllowedError:
Real HTTP connections are disabled. Unregistered request: GET https://api.twitter.com/1.1/friends/list.json?screen_name=sferik with headers {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'OAuth oauth_nonce="3d48576db86a5390bdc1deaec65c4a13", oauth_signature="h5gsi6Xj8li8Jqn7VzivG399rQc%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1354227722", oauth_version="1.0"', 'User-Agent'=>'Twitter Ruby Gem 4.3.0'}
You can stub this request with the following snippet:
stub_request(:get, "https://api.twitter.com/1.1/friends/list.json?screen_name=sferik").
@tibbon
tibbon / gist:4172823
Created November 30, 2012 00:12
Newest Twitter Friends Code
# In lib/twitter/api/friends_and_followers.rb
def friends(*args)
options = extract_options!(args)
merge_user!(options, args.pop || screen_name)
merge_default_cursor!(options)
cursor_from_response(:users, Twitter::User, :get, "/1.1/friends/list.json", options)
end
# In spec/twitter/api/friends_and_followers.rb
@tibbon
tibbon / gist:4172664
Created November 29, 2012 23:34
Non-working Twitter Method
def friends(*args)
options = extract_options!(args)
merge_default_cursor!(options)
users_from_response(:get, "/1.1/friends/list.json", options)
end
1) Twitter::API::FriendsAndFollowers#friends with a screen_name passed requests the correct resource
Failure/Error: @client.friends("sferik")

Keybase proof

I hereby claim:

  • I am tibbon on github.
  • I am tibbon (https://keybase.io/tibbon) on keybase.
  • I have a public key whose fingerprint is B234 4A25 8C8E D30E 8FA0 D104 6723 7CA6 BD17 D4D5

To claim this, I am signing this object:

@tibbon
tibbon / gist:4428394
Created January 1, 2013 16:25
My Unicorn config file. Having crashy EOF issues with Postgres with workers.
# What the timeout for killing busy workers is, in seconds
timeout 60
# Whether the app should be pre-loaded
preload_app true
# How many worker processes
worker_processes 3
before_fork do |server, worker|

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg