Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created April 30, 2011 14:30
Show Gist options
  • Save ahoward/949714 to your computer and use it in GitHub Desktop.
Save ahoward/949714 to your computer and use it in GitHub Desktop.
# 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
@ahoward
Copy link
Author

ahoward commented May 3, 2011

moving all of this into a gem -> https://github.com/ahoward/irbcp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment