Skip to content

Instantly share code, notes, and snippets.

View coderberry's full-sized avatar

Eric Berry coderberry

View GitHub Profile
@coderberry
coderberry / w2-e6.rb
Created August 23, 2012 03:06
w2-e6.rb
mclovin = {
"Name" => "McLOVIN",
"City" => "HONOLULU",
"DOB" => "06/03/1981",
"Address" => {
"Street" => "892 MOMONA ST",
"City" => "HONOLULU",
"State" => "HI",
"Zip" => "96820"
},
@coderberry
coderberry / w2-e5.rb
Created August 23, 2012 03:08
w2-e5.rb
mclovin = {
"Name" => "McLOVIN",
"City" => "HONOLULU",
"DOB" => "06/03/1981"
}
>> mclovin["Name"]
=> "McLOVIN"
>> mclovin["City"]
@coderberry
coderberry / gem-list.sh
Created September 12, 2012 21:17
gem-list
$ gem list
*** LOCAL GEMS ***
redcarpet (2.1.1)
sinatra (1.3.3)
@coderberry
coderberry / install-twitter-gem.sh
Created September 12, 2012 21:37
Install twitter gem
$ gem install twitter
Fetching: multipart-post-1.1.5.gem (100%)
Fetching: faraday-0.8.4.gem (100%)
Fetching: simple_oauth-0.1.9.gem (100%)
Fetching: twitter-3.7.0.gem (100%)
Successfully installed multipart-post-1.1.5
Successfully installed faraday-0.8.4
Successfully installed simple_oauth-0.1.9
Successfully installed twitter-3.7.0
@coderberry
coderberry / irb-1.rb
Created September 12, 2012 22:03
irb-1
>> require 'twitter'
=> true
@coderberry
coderberry / irb-2.rb
Created September 12, 2012 22:06
irb-2
>> client = Twitter::Client.new
=> #<Twitter::Client:0x007f90aa988ba8 ... lots of stuff ... @attrs={}>>
@coderberry
coderberry / irb-3.rb
Created September 12, 2012 22:13
irb-3
>> results = client.search("#iphone5")
=> #<Twitter::SearchResults:0x007f90aaab7970 ... YIKES ... :since_id_str=>"0"}>
@coderberry
coderberry / irb-4.rb
Created September 12, 2012 22:20
irb-4
>> results.completed_in
=> 0.332
>> results.max_id
=> 246008041437294592
>> results.next_page
=> "?page=2&max_id=246008041437294592&q=%23iphone5"
>> results.page
=> 1
>> results.query
=> "%23iphone5"
@coderberry
coderberry / irb-5.rb
Created September 12, 2012 22:22
irb-5
>> results.results.class
=> Array
>> results.results.count
=> 15
>> results.results[0]
=> #<Twitter::Tweet:0x007f90aa97d2d0 ... :to_user_name=>nil}>
>> tweet = results.results[0]
=> #<Twitter::Tweet:0x007f90aa97d2d0 ... :to_user_name=>nil}>
>> tweet.text
=> "#WTF where is the #NFC ship ? #iPhone #iPhone5 #Apple"
@coderberry
coderberry / arithmentic_operators.rb
Created September 18, 2012 21:11
arithmetic operators
>> 1 + 2 # => 3
>> 2 - 1 # => 1
>> 2 * 5 # => 10
>> 10 % 3 # => 1
>> 10 ** 3 # => 1000
>> 10 / 3 # => 3
>> ((5 * 2) - 2) # => 8
>> (5 * (2 - 2)) # => 0