This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = function() { | |
b() | |
} | |
b = function() { | |
print('b') | |
} | |
a() // prints 'b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = function () | |
b() | |
end | |
b = function () | |
print 'b' | |
end | |
a() -- prints 'b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module LumberJack::ExplicitContext | |
def with(object) | |
raise "need an object" if not object | |
yield(object) | |
object | |
end | |
end | |
include LumberJack::ExplicitContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TreeFace | |
def with(object, &block) | |
raise "need an object" if not object | |
object.instance_eval(&block) | |
object | |
end | |
end | |
include TreeFace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try_do_thingo! | |
if thingo_worked_out? | |
sweet! | |
else | |
whatever! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Enumerable | |
def fuck_off_you_fucking_nil_cunts! | |
reject { |el| el.nil? } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def if | |
yield if self | |
end | |
def else | |
yield if not self | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |