Skip to content

Instantly share code, notes, and snippets.

@nagachika
Created July 30, 2009 05:19
Show Gist options
  • Save nagachika/158573 to your computer and use it in GitHub Desktop.
Save nagachika/158573 to your computer and use it in GitHub Desktop.
irb initialization file
require "irb/completion"
require "irb/ext/save-history"
IRB.conf[:SAVE_HISTORY] = 500
IRB.conf[:HISTORY_FILE] = ENV['HOME']+'/.irb_history'
if ENV["TS_SERVER"]
begin
require "drb"
require "rinda/rinda"
$ts = Rinda::TupleSpaceProxy.new(DRbObject.new_with_uri(ENV["TS_SERVER"]))
rescue Exception
end
end
module Enumerable
def sum(origin = 0)
inject(origin) do |s, i| s + i end
end
def avg(origin = 0)
sum(0).to_f / size
end
end
class Object
def eigenclass
class << self; self; end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment