Skip to content

Instantly share code, notes, and snippets.

@ll14m4n
Created October 16, 2017 14:52
Show Gist options
  • Save ll14m4n/8a480880e174fdd9b6c99b1f668aaf24 to your computer and use it in GitHub Desktop.
Save ll14m4n/8a480880e174fdd9b6c99b1f668aaf24 to your computer and use it in GitHub Desktop.
require 'json'
require 'nokogiri'
require 'curb'
Pry.config.editor = "vim"
if `uname` =~ /Darwin/
['pbcopy', 'pbpaste']
else
[ 'xclip -selection clipboard -in',
'xclip -selection clipboard -out' ]
end.tap do |copy,paste|
define_method(:_copy) do |arg|
IO.popen(copy, "w") { |pipe| pipe.write arg }
end
define_method(:_paste) do
IO.popen(paste, "r", &:read)
end
end
def __copy
_copy ObjectSpace.each_object(Pry::HistoryArray).to_a.last[-1].chomp;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment