Skip to content

Instantly share code, notes, and snippets.

@amrox
amrox / gist:1218473
Created September 15, 2011 03:43
It's shit like this, Python package management
$ sudo pip install jsonpretty
Downloading/unpacking jsonpretty
Downloading JSONPretty-1.0.0.tar.gz
Running setup.py egg_info for package jsonpretty
Requirement already satisfied (use --upgrade to upgrade): simplejson in /Library/Python/2.7/site-packages (from jsonpretty)
Installing collected packages: jsonpretty
Running setup.py install for jsonpretty
Installing jsonpretty script to /usr/local/bin
__block BOOL done = NO;
[userService updateUser:user
completionHandler:^(NSError* error) {
STAssertNil( error, @"error: %@", error );
done = YES;
}];
TEST_WAIT_UNTIL_TRUE(done);
[exportSession exportAsynchronouslyWithCompletionHandler:^{
NSLog( @"exported to %@", [exportSession.outputURL path] );
}];
TEST_WAIT_UNTIL_TRUE( (exportSession.status == AVAssetExportSessionStatusCancelled ||
exportSession.status == AVAssetExportSessionStatusFailed ||
exportSession.status == AVAssetExportSessionStatusCompleted) );
STAssertTrue( exportSession.status == AVAssetExportSessionStatusCompleted, @"export failed" );
dispatch_async(_renderQueue, ^{
[exportSession exportAsynchronouslyWithCompletionHandler:^{
LOG_DEBUG( @"exported to %@", [exportSession.outputURL path] );
}];
});
TEST_WAIT_UNTIL_TRUE( (exportSession.status == AVAssetExportSessionStatusCancelled ||
exportSession.status == AVAssetExportSessionStatusFailed ||
exportSession.status == AVAssetExportSessionStatusCompleted) );
@amrox
amrox / gist:1124312
Created August 4, 2011 01:32
TEST_WAIT_UNTIL_TRUE
#define TEST_WAIT_UNTIL_TRUE_SLEEP_SECONDS (0.25)
#define TEST_WAIT_UNTIL_TRUE(expr) \
while( (expr) == NO ) [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:TEST_WAIT_UNTIL_TRUE_SLEEP_SECONDS]];
// don't do this
deviceToken = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
// do this
NSString* deviceTokenStr = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
@amrox
amrox / SynthesizingDummyClass.h
Created June 4, 2011 18:06
SynthesizingDummyClass
#define SYNTHESIZE_DUMMY_CLASS(C) \
@interface Dummy_##C : NSObject \
@end \
@implementation Dummy_##C : NSObject \
@end
@amrox
amrox / PortableStaticLibrary.xcconfig
Created May 14, 2011 21:02
PortableStaticLibrary.xcconfig
PUBLIC_HEADERS_FOLDER_PATH = include/$(PROJECT_NAME)
INSTALL_PATH = /../BuildProductsPath/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/
OTHER_LDFLAGS = -ObjC
scheduledTimerWithTimeInterval
rights