Created
December 23, 2010 14:07
-
-
Save anonymous/753018 to your computer and use it in GitHub Desktop.
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 characters
-- -------------------------------------- -- Gist Script for Linkinus -- by Jacob Chapel -- Version 0.5 -- -------------------------------------- on linkinuscmd(paste_type) set useGrowl to do shell script "defaults read com.conceitedsoftware.Linkinus alertGrowl" set theURL to "" set file_type to ".txt" set file_types to {{"ActionScript", ".as"}, {"C", ".c"}, {"Csharp", ".cs"}, {"Common_Lisp", ".cl"}, {"emacs_lisp", ".sls"}, {"erlang", ".hrl"}, {"haskell", ".hs"}, {"html", ".html"}, {"java", ".java"}, {"lua", ".lua"}, {"objective_c", ".m"}, {"perl", ".pl"}, {"Scala", ".scala"}, {"scheme", ".sls"}, {"TeX", ".tex"}, {"XML", ".xml"}, {"Ada", ".adb"}, {"AppleScript", ".scpt"}, {"Arc", ".arc"}, {"ASP", ".ascx"}, {"Assembly", ".asm"}, {"Batchfile", ".bat"}, {"Befunge", ".befunge"}, {"Boo", ".boo"}, {"Brainfuck", ".b"}, {"C_ObjDump", ".c-objdump"}, {"ChucK", ".java"}, {"Clojure", ".clj"}, {"CoffeeScript", ".coffee"}, {"ColdFusion", ".cfm"}, {"Cpp_ObjDump", ".cppobjdump"}, {"Cucumber", ".feature"}, {"D", ".d"}, {"D_ObjDump", ".d -objdump"}, {"Darcs_Patch", ".darcspatch"}, {"Delphi", ".pas"}, {"Duby", ".rb"}, {"Dylan", ".dylan"}, {"Eiffel", ".e"}, {"Fsharp", ".fs"}, {"Factor", ".factor"}, {"FORTRAN", ".f"}, {"GAS", ".s"}, {"Genshi", ".kid"}, {"Gentoo_Ebuild", ".sh"}, {"Gentoo_Eclass", ".sh"}, {"Gettext_Catalog", ".po"}, {"Go", ".go"}, {"Groff", ".man"}, {"Groovy", ".groovy"}, {"Haml", ".haml"}, {"HaXe", ".hx"}, {"HTML_Django", ".mustache"}, {"HTML_ERB", ".erb"}, {"HTML_PHP", ".phtml"}, {"INI", ".ini"}, {"Io", ".io"}, {"IRC_log", ".weechatlog"}, {"Java_Server_Pages", ".jsp"}, {"JSON", ".js"}, {"Literate_Haskell", ".lhs"}, {"LLVM", ".ll"}, {"Makefile", ".mak"}, {"Mako", ".mao"}, {"Markdown", ".mkd"}, {"Matlab", ".matlab"}, {"Max_MSP", ".mxt"}, {"MiniD", ".md"}, {"Mirah", ".rb"}, {"Moocode", ".moo"}, {"mupad", ".mu"}, {"Myghty", ".myt"}, {"Nu", ".sls"}, {"NumPy", ".numpy"}, {"ObjDump", ".objdump"}, {"Objective_J", ".j"}, {"OCaml", ".fs"}, {"ooc", ".ooc"}, {"Parrot_Internal_Representation", ".pir"}, {"Pure_Data", ".pd"}, {"Python_traceback", ".pytb"}, {"R", ".r"}, {"Racket", ".rkt"}, {"Raw_token_data", ".raw"}, {"Rebol", ".rebol"}, {"Redcode", ".cw"}, {"reStructuredText", ".rst"}, {"RHTML", ".rhtml"}, {"Sass", ".sass"}, {"Self", ".self"}, {"Shell", ".sh"}, {"Smalltalk", ".st"}, {"Smarty", ".tpl"}, {"Supercollider", ".sc"}, {"Tcl", ".tcl"}, {"Tcsh", ".tcsh"}, {"Textile", ".textile"}, {"Vala", ".vala"}, {"Verilog", ".v"}, {"VHDL", ".vhdl"}, {"VimL", ".vim"}, {"Visual_Basic", ".bas"}, {"XQuery", ".xqy"}, {"YAML", ".yml"}, {"cplusplus", ".cpp"}, {"CSS", ".css"}, {"diff", ".diff"}, {"Javascript", ".js"}, {"PHP", ".php"}, {"Python", ".py"}, {"Ruby", ".rb"}, {"SQL", ".sql"}} repeat with i from 1 to count of file_types if item 1 of item i of file_types contains paste_type then copy i to file_type end repeat set file_type to item 2 of item file_type of file_types do shell script "pbpaste | curl https://gist.github.com/gists -F \"file_ext[gistfile1]=" & file_type & "\" -F \"file_name[gistfile1]=\" -F \"file_contents[gistfile1]=<-\" -s -L -o /dev/null -w \"%{url_effective}\"" set theURL to result if useGrowl is "1" then tell application "GrowlHelperApp" set the allNotificationsList to {"Gist Notification"} set the enabledNotificationsList to {"Gist Notification"} register as application  "Linkinus Gist Script" all notifications allNotificationsList  default notifications enabledNotificationsList  icon of application "Grab" notify with name  "Gist Notification" title  "Clipboard Pasted" description  "" & theURL application name "Linkinus Gist Script" end tell end if return theURL end linkinuscmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment