Skip to content

Instantly share code, notes, and snippets.

Jonathon Mah jmah

Block or report user

Report or block jmah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jmah
jmah / Random Unwatched Movie.applescript
Created May 16, 2012
Suggest an unwatched movie from Delicious Library
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
@jmah
jmah / Ratings.scpt
Created May 17, 2012
Basic example AppleScript for Delicious Library
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 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
@jmah
jmah / loan.applescript
Created Oct 10, 2012
Creating Loans with Delicious Library 2
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
@jmah
jmah / keybase.md
Created Mar 28, 2014
Rebase Keybase
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:

@jmah
jmah / tail-recursion.m
Last active Aug 29, 2015
Tail Recursion Experiments in Objective-C
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 gist:950fb8172b8cd7f857b7
- (ListNode *)next {
if (_next) {
ListNode *nextCopy = [[ListNode alloc] init];
nextCopy.name = _next.name;
nextCopy.next = _next.next;
return nextCopy;
} else {
return nil;
}
}
@jmah
jmah / DictEnumTests.m
Created Apr 19, 2015
NSDictionary Enumeration Benchmark
View DictEnumTests.m
//
// DictEnumTests.m
//
#import <Cocoa/Cocoa.h>
#import <XCTest/XCTest.h>
@interface DictEnumTests : XCTestCase
@end
You can’t perform that action at this time.