Skip to content

Instantly share code, notes, and snippets.

@klochner
Created October 12, 2011 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klochner/1281767 to your computer and use it in GitHub Desktop.
Save klochner/1281767 to your computer and use it in GitHub Desktop.
irbrc.rb
def history(num=100)
h = Readline::HISTORY.to_a
start = [0,h.size-num-1].max
h.zip((0..h.size).to_a)[start...h.size].each do |e,i|
puts " #{(i).to_s.rjust(4)} #{e}"
end;nil
end
def hg(term)
num=500
h = Readline::HISTORY.to_a
start = [0,h.size-num-1].max
h.zip((0..h.size).to_a)[start...h.size].each do |e,i|
puts " #{(i).to_s.rjust(4)} #{e}" if e =~ /#{term}/
end;nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment