Skip to content

Instantly share code, notes, and snippets.

@drnic
Created November 10, 2008 11:54
Show Gist options
  • Save drnic/23477 to your computer and use it in GitHub Desktop.
Save drnic/23477 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../lib")
require "rubygems"
begin
require "gist"
rescue LoadError
puts "Please install rubygem 'gist' to use this command"
exit
end
selection = nil
if ENV['TM_SELECTED_TEXT']
selection = ENV['TM_SELECTED_TEXT']
else
selection = STDIN.read
end
if url = Gist.write(selection, ARGV[0] == "private" ? true : false)
puts "Created gist at #{url}. URL copied to clipboard."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment