Skip to content

Instantly share code, notes, and snippets.

View ashfurrow's full-sized avatar

Ash Furrow ashfurrow

View GitHub Profile
@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: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 / 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 / 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 / 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 / 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.