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 ReadableBigDecimal | |
def inspect | |
"<#{self.class.name}: #{self.to_f}>" | |
end | |
end | |
BigDecimal(10) # => #<BigDecimal:7fcd7103ee68,'0.1E2',9(36)> | |
BigDecimal.send(:prepend, ReadableBigDecimal) | |
BigDecimal(10) # => #<BigDecimal: 10> |
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
var ids = [...]; | |
rottenTweets; | |
_(ids).each(function(id) { | |
getTweet(id, function(tweetBody) { | |
rot13(tweetBody, function(rottenTweet) { | |
rottenTweets.push(rottenTweet); | |
if (rottenTweets.length == ids.length) { | |
useRottenTweets(); |
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 program which outputs "error" to STDERR and "output" to STDOUT. | |
a_program() { | |
echo error >&2 | |
echo output | |
} | |
# Run a_program. | |
# - Redirect a_program's STDERR (file descriptor 2) to the STDIN of a tee process. | |
# - tee echoes its STDIN to the given filename and to its STDOUT. | |
# - Redirect tee's STDOUT to its STDERR. |
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
Gemfile.lock |
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
# Fix pbcopy etc. | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# act like vim | |
setw -g mode-keys vi | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R |
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
task :foo do | |
sh 'echo $FOO' | |
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
The command you ran: | |
$ rails runner ';' | |
Exception backtrace(s), if any: (warnings, in this case) | |
/Users/peeja/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/psych.bundle: warning: already initialized constant ANY | |
/Users/peeja/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/psych.bundle: warning: already initialized constant UTF8 | |
/Users/peeja/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/psych.bundle: warning: already initialized constant UTF16LE | |
/Users/peeja/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/psych.bundle: warning: already initialized constant UTF16BE | |
/Users/peeja/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/psych.bundle: warning: already initialized constant ANY | |
/Users/peeja/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/psych.bundle: warning: already initialized constant UTF8 |
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
source "https://rubygems.org" | |
gem "rspec" | |
gem "rake" |
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
#!/bin/zsh | |
export TIMEFMT='%E' | |
main() { | |
echo "Purging the disk cache..." | |
purge | |
# time's output is on stderr. | |
zsh_elapsed_time=$( (time zsh -ilc exit) 2>&1 ) |
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
finalized = false | |
finalizer = lambda { finalized = true } | |
# Hide all direct references to the object in a lambda. | |
lambda do | |
object = Object.new | |
ObjectSpace.define_finalizer(object, finalizer) | |
end.call | |
ObjectSpace.garbage_collect |