Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ChrisLTD
Last active December 15, 2015 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisLTD/5332850 to your computer and use it in GitHub Desktop.
Save ChrisLTD/5332850 to your computer and use it in GitHub Desktop.
Lessn TextExpander Snippet
set api_key to "xxxxxxxxx"
set domain to "yourdomain.net"
set the longURL to (the clipboard as string)
if ((characters 1 through 4 of longURL as string) is not "http") then
return "Not a valid URL"
else
set shellScript to ("curl --url \"http://" & domain & "/-/?api=" & api_key & "&url=" & longURL & "\"")
set shortURL to (do shell script shellScript)
return shortURL
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment