Skip to content

Instantly share code, notes, and snippets.

@shouya
Created November 14, 2014 02:59
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 shouya/5c4a4bb0a6763474930c to your computer and use it in GitHub Desktop.
Save shouya/5c4a4bb0a6763474930c to your computer and use it in GitHub Desktop.
rails console endowed with the power of xclip
# ~/.irbrc
class Object
def xclip
IO.popen('xclip -i -selection clipboard', 'w') do |clipboard|
clipboard.print(self.to_s)
end
end
end
class String
def from_xclip
IO.popen('xclip -o -selection clipboard', 'r') do |clipboard|
self[0..-1] = clipboard.read
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment