Skip to content

Instantly share code, notes, and snippets.

View gist:74991bdb71233a261e5cc96db0935118
func testReservationListPositions() {
let moc = CoreDataStack.sharedStack().mainObjectContext
let reservationListVC = ReservationListViewController()
do {
let reservation1 = try ReservationFactory.generateWithTemplate(ReservationFactory.Template(), parentContext: moc)
} catch {
simX / export_notes
Created Mar 14, 2013
Quick AppleScript to export all your notes from Apple's built-in application
View export_notes
tell application "Notes"
set note_body_list to (get body of every note)
end tell
set note_count to (count of note_body_list)
set blah_folder to choose folder
set blah_path to POSIX path of blah_folder
repeat with i from 1 to note_count
set filename_string to ((blah_path & "note" & (i as string) & ".html") as text)
simX / hidpi.txt
Created Jul 28, 2012
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
View hidpi.txt
sudo defaults write /Library/Preferences/ DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/ DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.
simX / addcontact
Created Feb 10, 2012
Add contact command line program
View addcontact
osascript -e "tell application \"Address Book\"" \
-e " set firstParam to \"$1\"" \
-e " set secondParam to \"$2\"" \
-e " set thirdParam to \"$3\"" \
-e " set fourthParam to \"$4\"" \
-e " set contactEmailLabel to \"\"" \
-e " set spaceOffset to (offset of \" \" in firstParam)" \
-e " if (spaceOffset is not equal to 0) then" \
-e " set AppleScript's text item delimiters to \" \"" \