Skip to content

Instantly share code, notes, and snippets.

View pius's full-sized avatar

Pius Uzamere pius

View GitHub Profile
~ Connecting to database...
~ Loaded slice 'MerbAuthSlicePassword' ...
~ Loaded slice 'MerbPhotos' ...
~ Loaded slice 'MerbUi' ...
~ Loaded slice 'OohAuth' ...
~ Parent pid: 27616
You have specified Story.has(:involved_people) with :class_name => "Person". You probably also want to specify the :child_key option.
~ Compiling routes...
~ Could not find resource model AuthenticatingClient
~ Could not find resource model Token
Warning: please use bin/merb to load merb-core-1.0.6.1 from ./gems
Loading init file from /Users/pius/q/myapp/config/init.rb
Loading /Users/pius/q/myapp/config/environments/development.rb
~ Connecting to database...
~ Loaded slice 'MerbAuthSlicePassword' ...
~ Loaded slice 'MerbPhotos' ...
~ Loaded slice 'MerbUi' ...
~ Loaded slice 'OohAuth' ...
~ Parent pid: 28557
You have specified Story.has(:involved_people) with :class_name => "Person". You probably also want to specify the :child_key option.
[22:29][me@phoenix-2:~/cutting/k]$ thin start -R config.ru
>> Thin web server (v1.0.0 codename That's What She Said)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
!! Unexpected error while processing request: Could not load sqlite adapter:
no such file to load -- sqlite3
****MEANWHILE, IN ANOTHER TERMINAL WINDOW****
[22:30][me@phoenix-2:~]$ curl -i http://localhost:3000/cloudkit-meta
>> fn = Satisfaction.new
=> #<Satisfaction:0x2417498 @identity_map=#<Satisfaction::IdentityMap:0x24173bc @records={}, @pages={}>, @loader=#<Satisfaction::Loader:0x24173f8 @options={:cache=>:hash}, @cache=#<Satisfaction::Loader::HashCache:0x2417358 @cached_responses={}>>, @options={:access_token_url=>"http://getsatisfaction.com/api/access_token", :root=>"http://api.getsatisfaction.com", :autoload=>false, :request_token_url=>"http://getsatisfaction.com/api/request_token", :authorize_url=>"http://getsatisfaction.com/api/authorize"}>
>> fn.set_consumer("REDACTED","REDACTED")
=> #<OAuth::Consumer:0x2412600 @secret="REDACTED", @key="REDACTED", @options={:request_token_path=>"/oauth/request_token", :scheme=>:header, :authorize_path=>"/oauth/authorize", :access_token_path=>"/oauth/access_token", :http_method=>:post, :oauth_version=>"1.0", :signature_method=>"HMAC-SHA1"}>
>> fn.companies.post(:name => "REDACTED", :url => "REDACTED", :description => "A REDACTED Spinoff")
=> [:unauthorized, "Access Denied"]
>> fn.req
irb(main):012:0> @satisfaction.request_token
=> #<OAuth::Token:0x180ed40 @secret=[REDACTED], @token=[REDACTED]>
irb(main):013:0> @satisfaction.companies.post(:name => REDACTED, :url => REDACTED, :description => REDACTED)
NoMethodError: undefined method `<=>' for nil:NilClass
from /Library/Ruby/Gems/1.8/gems/oauth-0.3.4/lib/oauth/helper.rb:35:in `<=>'
from /Library/Ruby/Gems/1.8/gems/oauth-0.3.4/lib/oauth/helper.rb:35:in `sort'
from /Library/Ruby/Gems/1.8/gems/oauth-0.3.4/lib/oauth/helper.rb:35:in `normalize'
from /Library/Ruby/Gems/1.8/gems/oauth-0.3.4/lib/oauth/request_proxy/base.rb:89:in `normalized_parameters'
from /Library/Ruby/Gems/1.8/gems/oauth-0.3.4/lib/oauth/request_proxy/base.rb:104:in `signature_base_string'
from /Library/Ruby/Gems/1.8/gems/oauth-0.3.4/lib/oauth/signature/base.rb:66:in `signature_base_string'
irb(main):005:0> satisfaction = Satisfaction.new
=> #<Satisfaction:0x180dff8 @identity_map=#<Sfn::IdentityMap:0x180df30 @pages={}, @records={}>, @options={:root=>"http://api.getsatisfaction.com", :autoload=>false, :authorize_url=>"http://getsatisfaction.com/api/authorize", :request_token_url=>"http://getsatisfaction.com/api/request_token", :access_token_url=>"http://getsatisfaction.com/api/access_token"}, @loader=#<Sfn::Loader:0x180df58 @cache=#<Sfn::Loader::HashCache:0x180decc @cached_responses={}>, @options={:cache=>:hash}>>
irb(main):006:0> satisfaction.set_consumer REDACTED, REDACTED
=> #<OAuth::Consumer:0x1808788 @options={:oauth_version=>"1.0", :request_token_path=>"/oauth/request_token", :authorize_path=>"/oauth/authorize", :access_token_path=>"/oauth/access_token", :signature_method=>"HMAC-SHA1", :scheme=>:header, :http_method=>:post, :proxy=>nil}, @secret=REDACTED, @key=REDACTED>
irb(main):007:0> request_token = satisfaction.request_token
=> #<OAuth::Token:0x18014c4 @secret=[REDACTED], @token=[REDACT
def predicate_nominative_pronoun
case gender
when 'm', 'M'
'him'
when 'f', 'F'
'her'
else
last_name
end
end
def predicate_nominative_pronoun
case gender
when 'm'
return 'him'
when 'M'
return 'him'
when 'f'
return 'her'
when 'F'
return 'her'
def predicate_nominative_pronoun
case gender
when 'm', 'M'
return 'him'
when 'f', 'F'
return 'her'
else
return last_name
end
end
#obligatory clever one-liner in response to http://rubyflow.com/items/2904
def sum_of_multiples_of_3_and_5_less_than(limit)
1.upto(limit-1).reject { |x| (x.modulo(3) != 0) and (x.modulo(5) != 0) }.inject(0) {|n,sum| n + sum}
end