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
a = function() {
b()
}
b = function() {
print('b')
}
a() // prints 'b'
a = function ()
b()
end
b = function ()
print 'b'
end
a() -- prints 'b'
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!
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
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.
try_do_thingo!
if thingo_worked_out?
sweet!
else
whatever!
end
module Enumerable
def fuck_off_you_fucking_nil_cunts!
reject { |el| el.nil? }
end
end
class Object
def if
yield if self
end
def else
yield if not self
end
end
#!/usr/bin/env ruby
%w(rubygems hpricot).each { |lib| require(lib) }
if ARGV.length < 2
puts "Usage: './backup-databases /path/to/backups label databases,to,ignore'"
puts "Example: './backup-databases /tmp/db-backups weekly mysql,information_schema,test'"
else