Skip to content

Instantly share code, notes, and snippets.

@jashmenn
Created August 25, 2008 16:52
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 jashmenn/7109 to your computer and use it in GitHub Desktop.
Save jashmenn/7109 to your computer and use it in GitHub Desktop.
# paste whatever is in the clipboard to gist using gisit from http://gist.github.com/5774
# and MacClipboard code from http://project.ioni.st/post/1334#snippet_1334
# this goes in your ~/.irbrc
# * todo, change code to update an existing gist
def gistit
require 'mechanize'
require 'gistit'
gist = Gistit.new
number = gist.paste(MacClipboard.read) # => 12345
gist_url = Gistit::LOGIN_SUCCESS_URL + number.to_s
puts "Pastie is now at: #{gist_url}"
MacClipboard.write(gist_url)
puts "Saved to clipboard"
gist_url
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment