Created
September 11, 2011 08:11
-
Star
(112)
You must be signed in to star a gist -
Fork
(32)
You must be signed in to fork a gist
Revisions
-
defunkt renamed this gist
Sep 17, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
defunkt revised this gist
Sep 17, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ url = ARGV[0] code = ARGV[1] if url !~ /^(https?:\/\/)?(gist\.)?github.com/ abort "* github.com URLs only" end -
defunkt created this gist
Sep 11, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ #!/usr/bin/env ruby # Usage: gitio URL [CODE] # # Turns a github.com URL # into a git.io URL # # Copies the git.io URL to your clipboard. url = ARGV[0] code = ARGV[1] if url !~ /^(https?:\/\/)?github.com/ abort "* github.com URLs only" end if url !~ /^http/ url = "https://#{url}" end if code code = "-F code=#{code}" end output = `curl -i http://git.io -F 'url=#{url}' #{code} 2> /dev/null` if output =~ /Location: (.+)\n?/ puts $1 `echo #$1 | pbcopy` else puts output end