Skip to content

Instantly share code, notes, and snippets.

View ConradIrwin's full-sized avatar

Conrad Irwin ConradIrwin

View GitHub Profile
#!/bin/bash
if git rev-parse --verify "$1"
then
git reset HEAD^ --hard
git checkout "$1"
git cherry-pick "HEAD@{2}"
fi
Pry.config.commands.command "edit-line", "Edits the current line in your editor" do
require 'tempfile' unless defined? Tempfile
to_edit = (eval_string =~ /^\s*$/ ? target.eval('inp[-1] || ""') : eval_string)
temp_file = Tempfile.new('edit-line')
temp_file.puts to_edit
temp_file.close
pry(main)> 2
=> 2
pry(main)>
pry(main)> edit-line
pry(main)> _
=> 3
pry(main)> 1
=> 1
pry(main)> edit-line
1: puts(
pry(main)* 2)
2
=> nil
>> A.new
NoMethodError: undefined method `inspect' for #<A:0x26cec40>
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb.rb:310:in `output_value'
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb.rb:159:in `eval_input'
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb.rb:155:in `eval_input'
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/ruby-lex.rb:244:in `each_top_level_statement'
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'
from /home/conrad/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'
(in /0/ruby/pry)
** Invoke pry (first_time)
** Execute pry
pry(main)> require 'ampex'
=> true
pry(main)> X
warning: .pretty_inspect returned Metavariable not String
=> #<Metavariable:0x13f621c>
(in /0/ruby/pry)
** Invoke pry (first_time)
** Execute pry
pry(main)> require 'ampex'
=> true
pry(main)> X
warning: .pretty_inspect returned Metavariable not String
=> #<Metavariable:0x13f621c>
pry(main)> Object.new
=> #<Object:0x26ff750>
Nesting status:
--
0. main (Pry top level)
1. 1
2. 2
3. 3
2. 2
Pry.config.commands.command "edit-line", "Edits the current line in your editor" do
require 'tempfile' unless defined? Tempfile
to_edit = (eval_string =~ /^\s*$/ ? Readline::HISTORY[-2] : eval_string)
temp_file = Tempfile.new('edit-line')
temp_file.puts to_edit
temp_file.close
# HACK 1. this is a helper in the default command set.
Pry::DefaultCommands::Documentation
show-doc
- should output a method's documentation/home/conrad/.rvm/gems/jruby-1.6.3/gems/method_source-0.6.0/lib/method_source/source_location.rb:23 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
[FAILED]
- should output a method's documentation if inside method without needing to use method name/home/conrad/.rvm/gems/jruby-1.6.3/gems/method_source-0.6.0/lib/method_source/source_location.rb:23 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
/home/conrad/.rvm/gems/jruby-1.6.3/gems/method_source-0.6.0/lib/method_source/source_location.rb:23 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
/home/conrad/.rvm/gems/jruby-1.6.3/gems/method_source-0.6.0/lib/method_source/source_location.rb:23 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
/home/conrad/.rvm/gems/jruby-1.6.3/gems/method_source-0.6.0/lib/method_source/source_