Skip to content

Instantly share code, notes, and snippets.

View ryan-allen's full-sized avatar
🐢
Turtles

Ryan Allen ryan-allen

🐢
Turtles
View GitHub Profile
module Enumerable
def fuck_off_you_fucking_nil_cunts!
reject { |el| el.nil? }
end
end
try_do_thingo!
if thingo_worked_out?
sweet!
else
whatever!
end
Evening drive home, mind wandering, thinking.
Suddenly I realise, I have no beer.
Honourable intentions cast aside.
Fuck it, tonight, I will get right plastered.
module LumberJack::ExplicitContext
def with(object)
raise "need an object" if not object
yield(object)
object
end
end
include LumberJack::ExplicitContext
module TreeFace
def with(object, &block)
raise "need an object" if not object
object.instance_eval(&block)
object
end
end
include TreeFace
a = lambda {
b.call()
}
b = lambda {
:IMA_B_LOL
}
b.call() # raises nothing
a.call() # raises NameError: undefined local variable or method ‘b’ for main:Object ... WTF!
a = function ()
b()
end
b = function ()
print 'b'
end
a() -- prints 'b'
a = function() {
b()
}
b = function() {
print('b')
}
a() // prints 'b'
a, b = nil, nil
a = lambda {
b.call()
}
b = lambda {
puts :IMA_B_LOL
}
@ryan-allen
ryan-allen / 1_pi.rb
Created November 16, 2010 02:16 — forked from geelen/1_pi.rb
def poop1(x,y)
Math.sqrt(x * x + y * y)
end
def poop2(x,y)
poop1(x,y) < 1
end
def random_poop
rand * 2 - 1