Skip to content

Instantly share code, notes, and snippets.

@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 / 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: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 / 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,
@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 / 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 / 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 }
@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"
}