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
def maybe_a_sandwich | |
nil | |
end | |
# Methods that might return nil are annoying. We want to write a nice | |
# confident chain: | |
result = nil | |
result = maybe_a_sandwich.add_horseradish.get_into_my_belly! rescue $! | |
result # => #<NoMethodError: undefined method `add_horseradish' for nil:NilClass> |
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/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby | |
# | |
# This file was generated by Julik. | |
begin | |
require 'rubygems' | |
version = ">= 0" | |
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then | |
version = $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
#!/usr/bin/env ruby | |
# based on http://gist.github.com/29838 | |
# logging to syslog added | |
# added killing orphaned procs | |
# added culling applications to maintain some per application limits | |
# Find bloating passengers and kill them gracefully. Run from cron every so often. | |
# | |
require "rubygems" | |
require "logging" |