Skip to content

Instantly share code, notes, and snippets.

@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-rules-to-sieve.applescript
Last active December 8, 2023 22:04
Apple Mail Rules to FastMail Advanced Sieve Rules
(*
Apple Mail Rules to FastMail Advanced Sieve Rules
Jonathan Poritsky, candlerblog.com
November 8, 2013
---
For more information on FastMail server rules (and requisite warnings) read Gabe Weatherhead's piece on transitioning to server-side mail rules:
http://www.macdrifter.com/2013/11/server-side-mail-rules.html
*)
@poritsky
poritsky / paste-selected-file.applescript
Created March 14, 2013 16:24
For use with TextExpander. Get contents of selected file, copy and paste. I have it set with ",,pbpaste" in TextExpander.
tell application "Finder"
set sel to the selection as text
set fPath to quoted form of POSIX path of sel
do shell script ("cat " & fPath & " | pbcopy && pbpaste")
end tell
@poritsky
poritsky / ingredient-list-to-omnifocus.applescript
Last active April 30, 2022 11:09
Launch OmniFocus. Create a project called "Recipes". Go to any recipe site in Safari. Run the script.
tell application "Safari" to set recipetitle to name of front document
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' | sed '$d'")
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
@poritsky
poritsky / Delete Completed Reminders.applescript
Created April 27, 2015 18:47
Delete Completed Reminders in Reminders.app
tell application "Reminders"
delete (every reminder whose completed is true)
end tell
@poritsky
poritsky / automate-mt-tagging.applescript
Last active October 27, 2018 07:08
A work-in-progress script to add MailTags keywords to messages in Mail based on sender. Uses GUI scripting and you'll have to jump through some hoops to add this to a workflow, but it may be of use. Toughest part is adding new addresses to it. Also note: the tags in the script must "Preferred Keywords" to be in your menubar.
# Automate MailTags Tagging
# by Jonathan Poritsky
# http://candlerblog.com
#
# Instructions for editing inline.
tell application "Mail"
activate
set m to (selection)
set s to (extract address from sender of item 1 of m)
@poritsky
poritsky / gist:4660217
Created January 28, 2013 23:20
Copy contents of file. (For use with copying contents of text files)
tell application "Finder" to set filePath to quoted form of (POSIX path of (the selection as alias))
do shell script "cat " & filePath & " | pbcopy"
@poritsky
poritsky / Pinboard Mod 2015.css
Created January 26, 2015 19:56
Just a modification for Pinboard.in, inspired by Brett Terpstra. Works best on OS X.
@font-face{font-family:'FontAwesome';src:url('http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/fonts/fontawesome-webfont.eot?v=4.2.0');src:url('http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/fonts/fontawesome-webfont.eot?#iefix&v=4.2.0') format('embedded-opentype'),url('http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/fonts/fontawesome-webfont.woff?v=4.2.0') format('woff'),url('http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/fonts/fontawesome-webfont.ttf?v=4.2.0') format('truetype'),url('http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/fonts/fontawesome-webfont.svg?v=4.2.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}
#tag_cloud{display:none}
#timer{display:none;}
#logo{margin-left:120px;}
#pinboard{width:100%;padding:0 !important;margin:0 !important;background-color:#f9f9f9 !important;}
#banner{background:rgb(15,128,255) !important;width:100% !important;min-width:1100px;position:fixed;left:0;padding:15px 0 16px 0 !important;z-index:10;font-family:"Avenir Next Condensed";}
#
@poritsky
poritsky / Easy Planter.applescript
Created December 8, 2012 22:20
AppleScript to Run Brett Terpstra's Planter Without the Command Line
# Easy Planter
# by Jonathan Poritsky http://candlerblog.com
#
# Run script to walk you through creating new file trees with Brett terpstra's Planter.rb
# For more info on Planter see Brett's original post:
# http://brettterpstra.com/planter-tree-planting-for-your-filesystem/
#
# Note: Script does an mdfind to locate "planter.rb". If you've renamed planter then this will not work. Noted below how to change.
tell application "Finder"
@poritsky
poritsky / Day One.sublime-build.json
Created December 7, 2012 17:27
Sublime Text to Day One Build System (requires Day One CLI)
{
"cmd": ["dayone new < $file"],
"path": "/usr/local/bin/",
"shell": "true"
}