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
require 'rubygems' | |
def irbrc_load_safely(lib) | |
begin | |
require lib | |
yield if block_given? | |
rescue LoadError => e | |
$stderr.puts "Couldn't load #{lib}: #{e}" | |
end | |
end | |
irbrc_load_safely('ap') | |
irbrc_load_safely('wirble') do | |
Wirble.init | |
Wirble.colorize | |
# provides history along with the following shortcuts | |
# ri - calls the "ri" command on the specified value | |
# po - lists an object's instance methods | |
# poc - lists an object's constants | |
end | |
irbrc_load_safely('utility_belt') do | |
UtilityBelt.equip :all | |
# PROVIDES | |
# edit(:the_name_of_my_editor) <- aliased to e, below | |
# Clipboard.read | |
# Clipboard.write('something') | |
# pastie -> creates pastie from clipboard | |
# | |
# Use "h" or "history" to view your command history, and "h! 123" to re-invoke | |
# command #123 in your buffer. "h!" with no args will run the last command. | |
# | |
# grep_classes("ixnum") | |
# object.grep_methods("pretty") | |
end | |
# irbrc_load_safely('hirb') do | |
# Hirb.enable | |
# # http://github.com/cldwalker/hirb | |
# # | |
# # "Hirb provides a mini view framework for console applications and uses | |
# # it to improve irb’s default inspect output" | |
# end | |
class Object | |
def local_methods | |
(methods - Object.instance_methods).sort | |
end | |
end | |
alias q exit | |
def ee(editor = :mate) | |
edit_interactively(editor) | |
end | |
def reset | |
Dispatcher.reset_application! | |
end | |
# Log to STDOUT if in Rails | |
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
require 'logger' | |
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
end | |
# Define some standard test data | |
ARRAY = [ "Cafe", | |
"Espresso", | |
"Cappuccino", | |
"Latte", | |
"Macchiato", | |
"Mocha", | |
"Americano", | |
"Au Lait", | |
"Con Leche", | |
"Freddo", | |
"Doppio", | |
"Solo", | |
"Roast", | |
"Decaf", | |
"Robusta", | |
"Arabica", | |
"Canephora", | |
"Drip", | |
"Press", | |
"Demitasse", | |
"Yrgacheffe", | |
"Redeyekenya" | |
] | |
HASH = { | |
:spanish => "gato", | |
:german => "katze", | |
:german => "loewe", | |
:italian => "gatto", | |
:japanese => "neko", | |
:russian => "kashka", | |
:swahili => "paka", | |
:finnish => "kissa", | |
:bulgarian => "kotka", | |
:dutch => "kat", | |
:french => "chat", | |
:swedish => "katt" | |
} | |
ADDRESS = { | |
:street_address => '1715 NW Marshall', | |
:city => 'Portland', | |
:state => 'OR', | |
:zip => '97209' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment