Skip to content

Instantly share code, notes, and snippets.

@jaredatron
Created April 29, 2016 17:39
Show Gist options
  • Save jaredatron/935221f69dbd9ae439450a66b8b3b7d0 to your computer and use it in GitHub Desktop.
Save jaredatron/935221f69dbd9ae439450a66b8b3b7d0 to your computer and use it in GitHub Desktop.
copy and paste in ruby console
class String
def copy
IO.popen('pbcopy', 'r+'){|c| c.print(self) }
puts 'copied'
self
end
end
def self.copy(*args)
IO.popen('pbcopy', 'r+'){|c| c.print(*args) }
puts 'coppied'
end
def self.paste
`pbpaste`.chomp
end
def self.eval_clipboard
eval(paste)
end
# Clear the screen
def self.clear
system 'clear'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment