Skip to content

Instantly share code, notes, and snippets.

View guenin's full-sized avatar

John Guenin guenin

View GitHub Profile
@guenin
guenin / gist:3668146
Created September 7, 2012 17:51
why?
$ irb
>> a
NameError: undefined local variable or method `a' for main:Object
>> b = b
=> nil
>> b
=> nil
@guenin
guenin / faceparty.rb
Created March 7, 2012 20:16
Help HTTParty cope with Facebook's invalid JSON
class Faceparty
class FacebookParser < HTTParty::Parser
def parse
super if body != "false"
end
end
include HTTParty
parser FacebookParser
end
@guenin
guenin / gist:1855086
Created February 17, 2012 19:46
rspec wishes
class Foo
attr_accessor :bar
def initialize(bar)
self.bar = bar
end
end
# what I do now...
@guenin
guenin / event❤.coffee
Created August 24, 2011 16:10
jQuery Event love
# Event love!
Pinger =
ping: ->
console.log 'ping!'
$(this).trigger('pinged')
Ponger =
pong: ->
console.log 'pong!'
module RouteMatcher
class NoSubdomain
def === (other)
other.blank? || SubdomainFu.mirrors.include?(other)
end
end
class Subdomain < NoSubdomain
def === (other)
def make_sandwiches(however_many)
sandwiches = []
however_many.times do
sandwiches << make_sandwich { |sandwich| yield sandwich }
end
sandwiches
end
def make_sandwich
puts "makin a sandwich"