Skip to content

Instantly share code, notes, and snippets.

@drnic
Created November 10, 2008 11:54

Revisions

  1. drnic created this gist Nov 10, 2008.
    20 changes: 20 additions & 0 deletions gistfile1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/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