Created
April 30, 2011 14:30
-
-
Save ahoward/949714 to your computer and use it in GitHub Desktop.
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
# put this in your .irbrc and then you can do | |
# | |
# irb-prompt > data = api.call | |
# irb-prompt > c data.to_json | |
# | |
# which will copy the data to your clipboard. general usage is | |
# | |
# c(stuff, stuff, stuff) | |
# | |
# | |
module Kernel | |
private | |
def c(*args) | |
buf = args.join | |
fork{ fork{ IO.popen('pbcopy', 'w'){|fd| fd.write(buf)} }; exit!(0) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
moving all of this into a gem -> https://github.com/ahoward/irbcp