Skip to content

Instantly share code, notes, and snippets.

func testReservationListPositions() {
let moc = CoreDataStack.sharedStack().mainObjectContext
let reservationListVC = ReservationListViewController()
do {
let reservation1 = try ReservationFactory.generateWithTemplate(ReservationFactory.Template(), parentContext: moc)
} catch {
print(error)
}
@simX
simX / export_notes
Created March 14, 2013 23:19
Quick AppleScript to export all your notes from Apple's built-in Notes.app application
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
simX / hidpi.txt
Created July 28, 2012 04:58
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver 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
simX / addcontact
Created February 10, 2012 23:21
Add contact command line program
#!/bin/bash
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 \" \"" \