Created
January 1, 2011 01:33
Revisions
-
msabramo revised this gist
Jan 3, 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 @@ -11,7 +11,7 @@ on run {input} -- prep input for validation set inputResult to (input as string) -- Build the curl command to post to pastebin.com set curlCMD to "curl --stderr /dev/null -d\"paste_code=" & urlencode(inputResult) & "\" http://pastebin.com/api_public.php" -- Run the script and get the result: -
msabramo revised this gist
Jan 3, 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 @@ -1,4 +1,4 @@ -- pastebin.workflow.applescript -- -- An automator workflow to copy selected text to pastebin.com -- -
msabramo created this gist
Jan 1, 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,52 @@ -- pastebin.workflow -- -- An automator workflow to copy selected text to pastebin.com -- -- Created by Marc Abramowitz -- December 5, 2010 -- version 1.0 on run {input} -- prep input for validation set inputResult to (input as string) -- Build the command to use bitly's web service set curlCMD to "curl --stderr /dev/null -d\"paste_code=" & urlencode(inputResult) & "\" http://pastebin.com/api_public.php" -- Run the script and get the result: set pastebinUrl to (do shell script curlCMD) -- Open in default web browser open location pastebinUrl -- return result to be copied to the clipboard return pastebinUrl end run on urlencode(theText) set theTextEnc to "" repeat with eachChar in characters of theText set useChar to eachChar set eachCharNum to ASCII number of eachChar if eachCharNum = 32 then set useChar to "+" else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then set firstDig to round (eachCharNum / 16) rounding down set secondDig to eachCharNum mod 16 if firstDig > 9 then set aNum to firstDig + 55 set firstDig to ASCII character aNum end if if secondDig > 9 then set aNum to secondDig + 55 set secondDig to ASCII character aNum end if set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string set useChar to numHex end if set theTextEnc to theTextEnc & useChar as string end repeat return theTextEnc end urlencode