Skip to content

Instantly share code, notes, and snippets.

@poritsky
poritsky / gist:4221696
Created December 6, 2012 04:05
Sublime Text QuickRef User Preferences for MarkdownEditing
{
"settings":
{
"sort_alphabetically": false,
"show_user_commands": true,
"show_user_key_bindings": true,
"beautify_captions": false
},
"commands":
tell application "System Events"
tell process "Final Draft"
keystroke tab
end tell
end tell
@poritsky
poritsky / track-to-text.applescript
Created December 2, 2012 20:01
Current iTunes Track to Text Applescript
# Get current song, album and artist from iTunes.
#
# Intended for use with Smile Software's TextExpander:
# http://www.smilesoftware.com/TextExpander/index.html
#
# Set up as a snippet to turn current track into text. A nice way to spin your wheels while writing/coding/contemplating the shape of the universe.
tell application "iTunes"
set current_song to the name of current track
set current_artist to the artist of current track
@poritsky
poritsky / movie-list-maker.applescript
Created November 29, 2012 16:50
Download Mike D'Angelo's Master List of Films released in NYC for TaskPaper/OmniOutliner/Plain Text
-- Use this AppleScript to Download any of the master lists maintained my Mike D'Angelo:
-- http://www.panix.com/~dangelo/
--
-- Script will only work if you visit one of his list pages in Safari then run it from Script Editor.
-- Will still run on other sites but will output nonsense.
--
-- Saves a .txt that will open in any text editor or OmniOutliner, but won't open directly in TaskPaper.
-- Simply copy and paste the resulting text into a new TaskPaper document if you prefer.
tell application "Safari" to set listurl to URL of front document
@poritsky
poritsky / mail-to-day-one.applescript
Created November 28, 2012 22:00
Create Day One Entry From Selected Message in Apple Mail (Requires Day One CLI)
(*
Apple Mail to Markdown Formatted Day One Entry
!!! IMPORTANT !!!
Requires the Day One Command Line Interface. Download and install from here:
http://dayoneapp.com/tools/
Adapted from 'Apple Mail -- Text File Exporter w/ Basic Header Info' by Justin Lancy:
http://veritrope.com/code/apple-mail-export-to-text-file-w-basic-header-info
@poritsky
poritsky / mail-to-markdown-for-day-one.applescript
Created November 28, 2012 03:38
Pass Selected Mail Message to Markdown Formatted Text for Day One (Read Comment Below)
(*
Apple Mail to Markdown Formatted Text For Day One Importauto
Adapted from 'Apple Mail -- Text File Exporter w/ Basic Header Info' by Justin Lancy:
http://veritrope.com/code/apple-mail-export-to-text-file-w-basic-header-info
Adapted from the original script by Hans Erik Hazelhorst
http://veritrope.com/code/export-apple-mail-messages-and-notes-to-text-files
*)
@poritsky
poritsky / timeexpand.applescript
Created November 14, 2012 16:40
Expand TE Time Snippet in AppleScript
-- I can't take credit for this one. Justin Lancy (@Veritrope) tossed it my way in a tweet.
-- http://twitter.com/Veritrope/status/268746890177282049
tell application "TextExpander"
set my_Snip to snippet "ttime" in group "TextExpander Snippets"
expand snippet my_Snip
end tell
@poritsky
poritsky / gist:4067745
Created November 13, 2012 19:11
List of Ingredients to OmniFocus From Recipe Distiller
tell application "Safari" to set recipeurl to URL of front document
set ingredients to (do shell script "curl http://recipedistiller.com/recipe/classify/?recipeurl=" & recipeurl & " | textutil -convert txt -stdin -stdout | grep '.' | sed 's/ • DELETE //g'")
set my text item delimiters to "VIEW RECIPE"
set ingredients to text item 2 of ingredients
set my text item delimiters to "©"
set ingredients to text item 1 of ingredients
set l to paragraphs of ingredients
@poritsky
poritsky / se-list-to-of.applescript
Created November 13, 2012 01:53
Serious Eats Ingredient Lists to OmniFocus
tell application "Safari" to set ingredientlist to text of front document
set my text item delimiters to "
Ingredients"
set ingredientlist to text item 2 of ingredientlist
set my text item delimiters to "
Procedures"
set ingredientlist to text item 1 of ingredientlist
set l to paragraphs of ingredientlist
@poritsky
poritsky / ext-octopress-te-snippet.applescript
Created October 10, 2012 21:27
Link Post YAML and Quote for Octopress (Safari Only)
on replaceCommasInStringWithHTMLEntity(theTitle)
set rubyCommand to quote & "puts " & "'" & theTitle & "'" & ".gsub( /,/, ',' )" & quote
set strippedTitle to do shell script "ruby -e " & rubyCommand
return strippedTitle
end replaceCommasInStringWithHTMLEntity
on stripUTMFromURL(urlToStrip)
set rubyCommand to quote & "puts " & "'" & urlToStrip & "'" & ".gsub( /\\?utm.*$/, '' )" & quote
set strippedURL to do shell script "ruby -e " & rubyCommand
return strippedURL