Skip to content

Instantly share code, notes, and snippets.

View brandonpittman's full-sized avatar

Brandon Pittman brandonpittman

View GitHub Profile
@brandonpittman
brandonpittman / SmartPerspective.applescript
Last active December 21, 2015 02:59
Smartly open perspectives in OmniFocus.
--The most current version of SmartPerspective is now in a GitHub repo. (https://github.com/brandonpittman/OmniFocus/blob/master/SmartPerspective.applescript)
on run
open_perspective()
end run
on open_perspective()
tell application "OmniFocus"
tell default document
@brandonpittman
brandonpittman / open_here.applescript
Created August 17, 2013 00:49 — forked from rwilcox/open_here.applescript
Fixed script to work even when a terminal window isn't already open.
tell application "BBEdit" to set theFile to file of document 1
tell application "Finder" to set theFolder to (container of file theFile) as alias
set theUnixPath to POSIX path of theFolder
tell application "iTerm"
make new terminal
tell the first terminal
-- launch a default shell in a new tab in the same terminal
launch session "Default Session"
tell the last session
@brandonpittman
brandonpittman / Insert_Markdown_Link_of_Evernote_Note_into_BBEdit.applescript
Last active December 21, 2015 12:58 — forked from fractaledmind/Insert Markdown Link of Evernote Note into TextEdit
Paste a Markdown link to either the selected note in Evernote or any other note into BBEdit.
@brandonpittman
brandonpittman / term_notify.applescript
Last active December 22, 2015 08:59
TextExpander Snippet to create terminal-notifier notification in an AppleScript. Save this as a plain text snippet and expand in AppleScript Editor. I've assigned mine to `,astn`.
try
set appName to "%filltext:name=appName%"
set appID to id of application appName
do shell script "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title " & appName & " -sender " & appID & " -message '%filltext:name=theMessage%'"
end try
@brandonpittman
brandonpittman / Finder_Deselect.applescript
Created September 6, 2013 16:52
An AppleScript to deselect the selection in Finder.app. Run it with ⌘⇧A with Keyboard Maestro or FastScripts.
tell application "Finder"
try
if get selection is not {} then set selection to {}
end try
end tell
@brandonpittman
brandonpittman / Import2Coin.rb
Last active December 22, 2015 12:59
Here's a script I wrote to import a long list of movies into the great movie database "Coin". https://github.com/hkaju/coin-rb
#!/usr/bin/env ruby
# Change "f" to a list of movies you want to watch.
f = "/Users/brandonpittman/Dropbox/Documents/Markdown/- Movies.md"
# Change "coin_db" to your coin(.rb) script.
coin = "/Users/brandonpittman/Dropbox/Documents/Code/Shell Scripts/coin"
# Import to coin.
coin_output = File.readlines(f).each { |line| `"#{coin}" a "#{line}"` }
@brandonpittman
brandonpittman / FileEraser.applescript
Last active December 22, 2015 17:18
Will zero out all selected files in Finder.app. Use with caution.
set iconFile to POSIX file "/System/Library/CoreServices/Finder.app/Contents/Resources/Finder.icns/"
tell application "Finder"
set theFiles to get selection
set theCount to count every item of theFiles
if theCount is 0 then
display alert "No files are currently selected." as warning
return
end if
@brandonpittman
brandonpittman / FinderSelection2OmniFocus.applescript
Created September 11, 2013 08:26
Create tasks in OmniFocus for each selected task.
global theFilePath, fileName, notifyMSG
on run
tell application "Finder"
if selection is not {} then
set sel to get selection
if (count sel) is 1 then
set notifyMSG to "1 file was "
else
set notifyMSG to (count sel) & " files were "
@brandonpittman
brandonpittman / Set2Ruby.applescript
Created September 12, 2013 06:54
Create a Ruby script or set source language to Ruby in BBEdit.
tell application "BBEdit"
if not (front text document exists) then make new text document
if contents of front text document is "" then set contents of front text document to "#!/usr/bin/env ruby\n\n"
set source language of text document 1 to "Ruby"
end tell
@brandonpittman
brandonpittman / Set2Bash.applescript
Created September 12, 2013 06:54
Create a Bash script or set source language to UNIX Shell Script in BBEdit.
tell application "BBEdit"
if not (front text document exists) then make new text document
if contents of front text document is "" then set contents of front text document to "#!/bin/bash\n\n"
set source language of text document 1 to "Unix Shell Script"
end tell