Skip to content

Instantly share code, notes, and snippets.

@wmene
Created October 15, 2014 17:39
Show Gist options
  • Save wmene/db7bfce59ea8463739e5 to your computer and use it in GitHub Desktop.
Save wmene/db7bfce59ea8463739e5 to your computer and use it in GitHub Desktop.
For a rails project
Pry.prompt = [proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} Pry > " }, proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " }]
#%w{map_by_method hirb}.each { |gem| require gem }
# Toys methods
# Stealed from https://gist.github.com/807492
class Array
def self.toy(n=10, &block)
block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1}
end
end
class Hash
def self.toy(n=10)
Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})]
end
end
# loading rails configuration if it is running as a rails console
load File.dirname(__FILE__) + '/.railsrc' if defined?(Rails) && Rails.env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment