Skip to content

Instantly share code, notes, and snippets.

Avatar
🏕️
I’m trying to do my job, please respect my time and attention.

Brandon Pittman brandonpittman

🏕️
I’m trying to do my job, please respect my time and attention.
View GitHub Profile
@brandonpittman
brandonpittman / StickyBox.applescript
Last active Dec 17, 2015
This is an AppleScript to check OmniFocus' Inbox and notifies you if the "taskCount" has been exceeded using Sticky Notifications.app.
View StickyBox.applescript
(*
Please change your folder and project names to whatever you use in OmniFocus. I have the acceptable task count at 1 but change this to whatever you feel comfortable with.
Author: Brandon Pittman
URL: http://brandonpittman.net
*)
set taskCount to 1
tell application "OmniFocus"
@brandonpittman
brandonpittman / CD2DIR.applescript
Last active Jul 6, 2019
AppleScript to switch to the current Finder directory while navigating the command line. Run as a TextExpander snippet (set to "AppleScript") for maximum utility.
View CD2DIR.applescript
tell application "System Events"
tell process "Finder"
if window 1 exists then
tell application "Finder"
set thePath to get quoted form of POSIX path of (target of front Finder window as text)
return "cd " & thePath & return
end tell
else
display alert "Finder doesn't have a window open." as warning giving up after 2
end if
@brandonpittman
brandonpittman / EvernoteTitlePrepend.applescript
Last active Dec 17, 2015
This script will let you append text to the selected notes in Evernote.
View EvernoteTitlePrepend.applescript
tell application "System Events"
set the_dialog to display dialog "What would you like to prepend to the selected notes?" default answer ""
set prepend_text to text returned of the_dialog
end tell
tell application "Evernote"
@brandonpittman
brandonpittman / EvernoteTitleAppend.applescript
Last active Aug 8, 2016
This AppleScript will append text to the title of the selected notes in Evernote.
View EvernoteTitleAppend.applescript
tell application "System Events"
set the_dialog to display dialog "What would you like to append to the selected notes?" default answer ""
set append_text to text returned of the_dialog
end tell
tell application "Evernote"
@brandonpittman
brandonpittman / UpdateBrew.sh
Last active Dec 18, 2015
Update Homebrew formulae, software and Ruby gems.
View UpdateBrew.sh
#!/bin/bash
/usr/local/bin/brew upgrade
/usr/local/bin/brew update
~/.rvm/rubies/ruby-head/bin/gem update
~/.rvm/rubies/ruby-head/bin/gem update --system
/usr/local/bin/npm update
View Rename_BBEdit_Document.applescript
tell application "System Events"
set new_name to text returned of (display dialog "Rename this file to..." default answer "" with title "Rename File" with icon POSIX file "/Applications/BBEdit.app/Contents/Resources/BBEditApplication.icns")
end tell
tell application "BBEdit"
set theFile to file of front document
end tell
tell application "Finder"
set ext to "." & name extension of file theFile
View EvernoteBatchRename.applescript
tell application "Evernote"
set the_notes to selection
set the_dialog to display dialog "What would you like to title these notes?" default answer ""
set the_title to text returned of the_dialog
set the_count to 1
@brandonpittman
brandonpittman / FindUntitledEvergrams.applescript
Last active Dec 20, 2015
Search Evernote for photos tagged "instagram" and are titled Untitled. Useful for forcing you to title photos automatically imported from Instagram to Evernote using IFTTT.
View FindUntitledEvergrams.applescript
tell application "Evernote"
set instagram_photos to find notes "tag:instagram intitle:Untitled"
repeat with photo_title in instagram_photos
open note window with photo_title
end repeat
end tell
@brandonpittman
brandonpittman / Dayfile2DayOne.sh
Last active Dec 20, 2015
Sends dayfiles, weekfiles, and monthfiles to DayOne for logging.
View Dayfile2DayOne.sh
#!/bin/bash
# I use an elaborate system of "dayfile-#{date}" along with monthfile and
# weekfile to track my goals. I then log them in Day One.
# Sets the time you want to do the logging at. The "10#" prevents the shell from lopping off leading 0s."
let cutoff="10#$(date +"%H%M")"
if (($cutoff > 2349))
then
@brandonpittman
brandonpittman / Coin_Find_Watched_Regex
Created Aug 15, 2013
This is a regular expression to find "Watched" movies in Coin.rb's JSON database.
View Coin_Find_Watched_Regex
"\d{1,9}":\{"title":"[A-Za-z \d:\.\&]+","rating":\d\.\d,"tmdb_id":\d{1,9},"released":"\d{4}-\d{2}-\d{2}","watched":"\d{4}-\d{2}-\d{2} \d{2}:\d{2}"\}