Skip to content

Instantly share code, notes, and snippets.

@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 / gist:5200080
Last active December 15, 2015 04:18
Add to Mail Rule by Sender (courtesy of Veritrope) Updated to only get address of sender, not name. (e.g. `[email protected]` instead of `"Some Jerks" <[email protected]>`
tell application "Mail"
set m to (selection)
set s to (extract address from sender of item 1 of m)
set r to rule "Archive"
tell r to make new rule condition at end of rule conditions with properties {rule type:from header, qualifier:does contain value, expression:s}
end tell
@poritsky
poritsky / gist:5210778
Created March 21, 2013 04:53
Open Mail Preferences and select the "Rules" pane. Because using a mouse is so 2012.
tell application "System Events"
tell process "Mail"
tell menu bar 1
tell menu "Mail"
click menu item "Preferences…"
end tell
end tell
end tell
end tell
tell application "System Events"
@poritsky
poritsky / list-of-addresses-in-rule.applescript
Last active December 15, 2015 09:19
Gathers list of expressions in Apple Mail rules, which in my use simply gathers a list of email addresses, then formats them into a procmail rule.
set l to {}
set r to "Archive" --Apple Mail Rule from which to pull addresses
set f to "Archive" --Name of folder to move messages from sender to
tell application "Mail"
set m to properties of rule conditions of rule r
repeat with v in m
set p to the expression of v
set l to l & ".*" & p & "|" as list
end repeat
@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 / mail-rules-to-sieve.applescript
Last active February 20, 2025 22:34
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 / 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 / Templates.scpt
Created March 6, 2015 16:43
Small modification to an old version of Chris Suave's Templates.scpt http://cmsauve.com/projects/templates/
(*
Modified by Jonathan Poritsky in the smallest way:
March 6, 2015: Switched from Growl to OS X Notifications
Created and since updated by Chris Suave. Full Details at:
http://cmsauve.com/projects/templates/
For whatever reason the lasest version isn't working as well as this two year old version (save for the growl to notifications change I made).
@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 / reader.css
Last active August 29, 2015 14:21
Modifications to Marius Hauken’s Fever Theme. Uses San Francisco font for everything but article body text. For more info on installation, see original project: https://github.com/mhauken/fever
html{min-height:100%;margin-bottom:1px}body{background:#fff;padding:0;color:#333;font-family:Helvetica, Arial, sans-serif;min-height:100%;margin:0}a{text-decoration:none;color:#c1382b;cursor:pointer}a:hover{color:#6e2018;text-decoration:underline}code,pre{background-color:#E8E8E8;opacity:0.75;font:10px/14px Monaco, monospace}pre{padding:8px;overflow:auto}img,object{max-width:100%;height:auto}form{padding:0 0 3px}form table{width:100%}th.proto{white-space:nowrap}td.proto{width:100%}form tr>*{padding:8px 10px 5px 0;background:url(images/bg-form-divider.png) 50% 0 no-repeat}fieldset table:first-child tr:first-child>*{background-image:none}form tr>*:first-child{padding-left:15px;background-position:0 0}form tr>*:last-child{padding-right:15px;background-position:100% 0}.dialog form tr>*:first-child{padding-left:5px}.dialog form tr>*:last-child{padding-right:5px}#service-template{display:none}table.embedded th{padding:4px 0 0}table.embedded th strong{display:block;position:relative;top:2px;left:0;background:url(ima