Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Quick Pastebin && QuickLook

  • Loading branch information...
commit 3fcbf162314215cc4a17eeba03d6fb4cc1fe16c4 1 parent 13ce432
@freewizard freewizard authored committed
Showing with 71 additions and 0 deletions.
  1. +16 −0 QuickLook.dropzone
  2. +55 −0 QuickPastebin.dropzone
View
16 QuickLook.dropzone
@@ -0,0 +1,16 @@
+#!/usr/bin/ruby
+
+# Dropzone Destination Info
+# Name: QuickLook
+# Description: Dropped files to preview it
+# Handles: NSFilenamesPboardType
+# Events: Dragged
+# Creator: Du Song
+# URL: http://rollingcode.org
+# IconURL: http://www.iconarchive.com/icons/deleket/scrap/256/Preview-Docment-icon.png
+
+def dragged
+ $items.each {|item| fork { `qlmanage -p \"#{item}\" >& /dev/null &` }}
+ $dz.finish("Generating preview...")
+ $dz.url(false)
+end
View
55 QuickPastebin.dropzone
@@ -0,0 +1,55 @@
+#!/usr/bin/ruby
+
+# Dropzone Destination Info
+# Name: QuickPastebin
+# Description: Copies text from clipboard to pastebin.com with out format. Replaces clipboard with pastebin url. Dragging text is possible as well.
+# Handles: NSStringPboardType
+# Events: Clicked, Dragged
+# Creator: CasperT
+# URL: portableinfo.com
+# IconURL: http://portableinfo.com/pastebin.png
+
+def dragged
+ $dz.begin("Sending text to pastebin...")
+ $dz.determinate(false)
+
+ data = $items[0]
+ #format = getFormat()
+ $dz.finish("Pastebin URL Copied!")
+ $dz.url(getPastebinUrl(data))
+end
+
+def clicked
+ $dz.begin("Sending text to pastebin...")
+ $dz.determinate(false)
+
+
+ data = readClipboard()
+ #format = getFormat()
+ $dz.finish("Pastebin URL Copied!")
+ $dz.url(getPastebinUrl(data))
+end
+
+def readClipboard
+ IO.popen('pbpaste') {|clipboard| clipboard.read}
+end
+
+def getPastebinUrl(data)
+ require 'net/http'
+ r = Net::HTTP.post_form(URI.parse("http://pastebin.com/api_public.php"),
+ {"paste_parent_key" => "",
+ "submit" => "submit",
+ "paste_subdomain" => "",
+ "paste_format" => "text",
+ "paste_code" => data,
+ "paste_name" => "",
+ "paste_private" => "0",
+ "paste_expire_date" => "N",
+ "paste_email" => ""})
+ r.body
+end
+
+def getFormat
+ result = `./CocoaDialog dropdown --text "Which Format?" --items "text" "bash" "c" "cpp" "html4strict" "java" "javascript" "lua" "perl" "php" "python" "ruby" "abap" "actionscript" "ada" "apache" "applescript" "asm" "asp" "autoit" "bash" "blitzbasic" "bnf" "c" "c_mac" "caddcl" "cadlisp" "cpp" "csharp" "cfm" "css" "d" "delphi" "diff" "dos" "eiffel" "erlang" "fortran" "freebasic" "genero" "gml" "groovy" "haskell" "html4strict" "idl" "ini" "inno" "java" "javascript" "latex" "lisp" "lua" "lsl2" "matlab" "m68k" "mpasm" "mirc" "mysql" "nsis" "objc" "ocaml" "oobas" "oracle8" "pascal" "perl" "php" "plswl" "python" "qbasic" "rails" "robots" "ruby" "scheme" "smalltalk" "smarty" "sql" "tcl" "unreal" "vb" "vbnet" "visualfoxpro" "xml" "z80" --button1 "Ok" ‑‑no‑cancel --float --string-output`
+ return result.split("\n")[1]
+end
Please sign in to comment.
Something went wrong with that request. Please try again.