Skip to content

Instantly share code, notes, and snippets.

@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 / name-to-comments.applescript
Created September 2, 2015 16:46
Copy selected file name without extension to comments.
tell application "Finder"
set theFile to selection as alias
tell application "System Events" to tell disk item (theFile as text) to set {theName, theExtension} to {name, name extension}
if theExtension is not "" then set theName to text 1 thru -((count theExtension) + 2) of theName -- the name part
set comment of theFile to theName
end tell
@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 / 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 / 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. `jerks@address.com` instead of `"Some Jerks" <jerks@address.com>`
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 / Markdown.sublime-settings.json
Last active December 10, 2015 20:48 — forked from anonymous/MarkdownEditorMoleskine.tmTheme
Modified version of Brett Terpstra's MarkdownEditing editor theme, with what I call a "Moleskine" feel. Find out more about MarkdownEditing: http://ttscoff.github.com/MarkdownEditing/
{
"extensions":
[
"md",
"mdown",
"mmd"
],
"trim_trailing_white_space_on_save": false,
"font_face": "Pitch Medium",
"font_size": 15,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>font-name-aliases</key>
<dict>
<!-- N.B. 'system-font' is also available as an alias; it will be mapped to the actual system font at runtime. -->
<key>light</key>
<string>.SFNSText-Light</string>
<key>light-italic</key>
@poritsky
poritsky / gist:4287232
Created December 14, 2012 17:42
Modification of Moritz Zimmer's [iAWriterCSS](https://github.com/moritzz/iAWriterCSS) for [Marked](http://markedapp.com). Uses Kris Sowersby's font [Pitch](http://klim.co.nz/retail-fonts/pitch/).
html {
background-color: #f2f2f2;
color: #333;
}
body {
margin: 10%;
padding: 0;
border: 0;
font-size: 16px;
line-height: 1.6;
@poritsky
poritsky / gist:4265063
Created December 12, 2012 05:22 — forked from anonymous/gist:4265059
Key commands to quickly create Markdown headers in Brett Terpstra's MarkdownEditing plugin for Sublime Text 2. ⌘^1 for #, ⌘^2 for ## and so on. Works on selected text too. Just add the following anywhere in your Default (OSX).sublime-keymap file for MarkdownEditing (or any relevant package for ST2)
{ "keys": ["super+ctrl+1"], "command": "insert_snippet", "args": {"contents": "# $0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown", "match_all": true }
]
},
@poritsky
poritsky / gist:4246924
Created December 9, 2012 20:51
Press ~ to strikethrough (surround with <del> tags) selected text in MarkdownEditing
Add this to ~/Library/Application Support/Sublime Text 2/Packages/MarkdownEditing/Default (OSX).sublime-keymap
Will surround selected text with <del> tags when you type a tilde (~). Only works when text is selected.
Get Brett Terpstra's MarkdownEditing here: http://ttscoff.github.com/MarkdownEditing/
{ "keys": ["~"], "command": "insert_snippet", "args": {"contents": "<del>${0:$SELECTION}</del>"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown", "match_all": true }