Public Gists by jotto

gist: 235745 Drop this middleware into y...
Gravatar
Sun Nov 15 20:59:45 -0800 2009
1
2
3
# how to call from rails app
# REFERRER_ARRAY = []
# config.middleware.use "ReferrerMiddleware", /^http:\/\/localhost:3000|^http:\/\/example\.com/, REFERRER_ARRAY
Gravatar
Mon Jun 29 13:56:20 -0700 2009
1
2
3
# To demo in irb:
# load 'spinner.rb' ; include Spinner ; spinner_demo
#
Gravatar
Wed Jun 10 09:12:12 -0700 2009
1
2
3
# oauth gem 0.3.5 send oob as the oauth_callback parameter which forces twitter into desktop mode
# this patches oauth gem to send a blank value instead
module OAuth
Gravatar
Sun May 24 14:40:23 -0700 2009
1
2
3
# first arg is goal time in either seconds or ##:##
# second arg is distance in meters (optional)
# EXAMPLE ruby running_pace.rb 15:30 5000
Gravatar
Wed May 06 12:22:18 -0700 2009
1
2
3
# Lo-fi client for the Facebook API. E.g.:
#
# fb = FacebookClient.new(:api_key => 'api-key', :secret => 'secret')
Gravatar
Tue Apr 28 14:09:51 -0700 2009
1
2
3
class Float
  def to_percent
    (self*100).to_s.gsub(/(.\.)(\d\d).*/,'\1\2')
Gravatar
Wed Mar 18 22:55:08 -0700 2009
1
2
3
[GEMS]/activesupport-2.2.2/lib/active_support/json/encoding.rb:28:raise_on_circular_reference
[GEMS]/activesupport-2.2.2/lib/active_support/json/encoding.rb:20:encode
[GEMS]/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb:42:to_json