Instantly share code, notes, and snippets.

View DictEnumTests.m
//
// DictEnumTests.m
//
#import <Cocoa/Cocoa.h>
#import <XCTest/XCTest.h>
@interface DictEnumTests : XCTestCase
@end
View gist:950fb8172b8cd7f857b7
- (ListNode *)next {
if (_next) {
ListNode *nextCopy = [[ListNode alloc] init];
nextCopy.name = _next.name;
nextCopy.next = _next.next;
return nextCopy;
} else {
return nil;
}
}
View tail-recursion.m
//
// Created by Jonathon Mah on 2014-05-24.
// Released into the public domain.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface ListNode : NSObject
View keybase.md

Keybase proof

I hereby claim:

  • I am jmah on github.
  • I am jmah (https://keybase.io/jmah) on keybase.
  • I have a public key whose fingerprint is CDE3 A069 8566 DC89 85B1 FE93 2CB3 42F6 6E8A 5FB9

To claim this, I am signing this object:

View loan.applescript
tell front document of application "Delicious Library 2"
set f to first friend
set m to first item of (get selected media)
set due to (current date) + 2 * weeks
make new loan with properties {due date:due, borrower:f, medium:m}
end tell
View View Book on Open Library.scpt
-- Menu Path: "Item"
tell front document of application "Delicious Library 2"
repeat with theItem in (get selected media)
if class of theItem is book and isbn of theItem is not missing value then
set theISBN to isbn of theItem
tell application "Safari"
activate
open location ("http://openlibrary.org/search?q=" & theISBN)
end tell
View Ratings.scpt
tell front document of application "Delicious Library 2"
set howMany to count of (every medium whose rating 4)
end tell
tell application "TextEdit"
make new document with properties ¬
{text:"There are " & howMany & " items in Delicious Library rated at least 4 stars."}
end tell
View Random Unwatched Movie.applescript
tell front document of application "Delicious Library 2"
-- Choose a random unwatched movie
set unwatchedItems to every movie whose experienced is false
if (count of unwatchedItems) is 0 then
display dialog "You don't have any unwatched movies." buttons {"OK"} default button "OK"
return
end if
set randomIndex to random number from 1 to (count of unwatchedItems)
set candidateItem to item randomIndex of unwatchedItems