Skip to content

Instantly share code, notes, and snippets.

View ashfurrow's full-sized avatar

Ash Furrow ashfurrow

View GitHub Profile
@ashfurrow
ashfurrow / Best way to notify View Controller of In-App Purchase
Created February 12, 2012 00:45
Best way to notify View Controller of In-App Purchase
So I have a View Controller that responds to user requests for a non-consumable in-app purchase. The VC invokes a method in the app delegate which serves as the SKProductQueueDelegate, so it'll receive confirmation that the IAP succeeded or not.
My question is: how would you notify the original VC that it should update the UI and unlock the purchased feature? I'm thinking NSNotification but I'm also considering retaining the VC in the app delegate.
@ashfurrow
ashfurrow / Dual Display Question
Created February 13, 2012 15:07
Problem with Monitors
So I've got a 15" MacBook Pro and a 27" Cinema Display at work. I take my laptop home on occasion and when I come back, ALL of my windows are on the external display (the primary one). I have to move Sparrow, iTunes, and a particular browser window back to the laptop. When I leave, all of my windows are too large for the 15" laptop display.
I'm tired of moving everything over to one display or another whenever I change where I move. I'm looking for an app that will remember my display setup and, when it changes (I plug in or unplug an external monitor), it "remembers" where my windows were the last time my display changed and moves/resizes them.
What app am I looking for?
@ashfurrow
ashfurrow / Plug-In Failed to Load
Created February 19, 2012 23:12
Aperture Failed to load Plugin
Dialogue box text: The plug-in named “500px” failed to load. Please contact the vendor for this plug-in, or try using a different plug-in.
Looking in Console, I see this error:
12-02-19 6:10:08.346 PM Aperture: Error loading /Users/ash/Library/Application Support/Aperture/Plug-Ins/Export/500px Aperture Uploader.ApertureExport/Contents/MacOS/500px Aperture Uploader: dlopen(/Users/ash/Library/Application Support/Aperture/Plug-Ins/Export/500px Aperture Uploader.ApertureExport/Contents/MacOS/500px Aperture Uploader, 265): Library not loaded: @rpath/PluginManager.framework/Versions/B/PluginManager
Referenced from: /Users/ash/Library/Application Support/Aperture/Plug-Ins/Export/500px Aperture Uploader.ApertureExport/Contents/MacOS/500px Aperture Uploader
Reason: image not found
@ashfurrow
ashfurrow / Growl Framework Linking Issues
Created February 20, 2012 00:37
Problem starting Aperture Plugin
12-02-19 7:25:36.776 PM Aperture: Error loading /Users/ash/Library/Application Support/Aperture/Plug-Ins/Export/500px Aperture Uploader.ApertureExport/Contents/MacOS/500px Aperture Uploader: dlopen(/Users/ash/Library/Application Support/Aperture/Plug-Ins/Export/500px Aperture Uploader.ApertureExport/Contents/MacOS/500px Aperture Uploader, 265): Library not loaded: @executable_path/../Frameworks/Growl.framework/Versions/A/Growl
Referenced from: /Users/ash/Library/Application Support/Aperture/Plug-Ins/Export/500px Aperture Uploader.ApertureExport/Contents/MacOS/500px Aperture Uploader
Reason: image not found
This *same* error message persists even if I switch the linker argument to use @loader_path instead of @executable_path (that is, the "Library Not Loaded:" result is the exact same.
The library it's looking for is, in fact, where it is looking for it. Very strange.
@ashfurrow
ashfurrow / gist:1867086
Created February 20, 2012 01:34
Getting Growl Framework to link properly against a Plugin Bundle in Xcode

Add the following as a Build Phase Run Script. Borrowed from GrowlMail, except quotes were added around the arguments to install_name_tool since our project has a space in the name.

install_name_tool -change "@executable_path/../Frameworks/Growl.framework/Versions/A/Growl" "@loader_path/../Frameworks/Growl.framework/Versions/A/Growl" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH"

install_name_tool -id "@loader_path/../Frameworks/Growl.framework/Versions/A/Growl" "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/Contents/Frameworks/Growl.framework/Growl"

Here's a (lengthy) explanation of why this is necessary.

@ashfurrow
ashfurrow / gist:1935760
Created February 28, 2012 22:37
Write both files to disk
NSRect offscreenRect = NSMakeRect(0.0, 0.0, 20.0, 12.0);
NSBitmapImageRep* bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
pixelsWide:offscreenRect.size.width
pixelsHigh:offscreenRect.size.height
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace
bitmapFormat:0
@ashfurrow
ashfurrow / gist:1935770
Created February 28, 2012 22:39
CIImage filter to invert image colours
CIImage* ciImage = [[CIImage alloc] initWithData:[drawnImage TIFFRepresentation]];
if ([drawnImage isFlipped])
{
CGRect cgRect = [ciImage extent];
CGAffineTransform transform;
transform = CGAffineTransformMakeTranslation(0.0,cgRect.size.height);
transform = CGAffineTransformScale(transform, 1.0, -1.0);
ciImage = [ciImage imageByApplyingTransform:transform];
}
CIFilter* filter = [CIFilter filterWithName:@"CIColorInvert"];
@ashfurrow
ashfurrow / gist:2140332
Created March 20, 2012 19:36
500px iOS Developer Job Description

iOS Developer

The 500px team is growing and we're looking for another iOS developer. You need to be able to work at 500px HQ at the corner of Peter and Adelaide in beautiful Toronto, Ontario.

Qualifications

  • Excellent communication skills
  • A history of shipping iOS software
  • Ability to write idiomatic Objective-C code
  • Deep understanding of Cocoa design patterns and API design
@ashfurrow
ashfurrow / gist:2431499
Created April 20, 2012 20:11
Photo Walk April 21st
  • Meet at 500px World HQ downstairs lobby at 4pm (317 Adelaide St. West)
  • Taxi up to DVP at http://g.co/maps/6hg84
  • Take amazing photos

Please tweet to @ashfurrow to confirm your attendance.

self.gitHubCommand = [RACCommand command];
self.gitHubSignal = [self.gitHubCommand addSignalBlock:^RACSignal *(id value) {
RACReplaySubject *subject = [RACReplaySubject subject];
[engine teamsInOrganization:@"TeehanLax" withSuccess:^(id result) {
for (NSDictionary *team in result)
{