Created
November 14, 2014 02:59
-
-
Save shouya/5c4a4bb0a6763474930c to your computer and use it in GitHub Desktop.
rails console endowed with the power of xclip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.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