This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_branch { | |
[ -d .git ] || return 1 | |
git_status="$(git status 2> /dev/null)" | |
branch_pattern="^# On branch ([^${IFS}]*)" | |
remote_pattern="# Your branch is (.*) of" | |
diverge_pattern="# Your branch and (.*) have diverged" | |
if [[ ! ${git_status}} =~ "working directory clean" ]]; then | |
state="*" | |
fi | |
# add an else if or two here if you want to get more specific |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Singleton *singleton = nil; | |
+ (Singleton *) sharedService { | |
@synchronized(self) { | |
if (singleton == nil) { | |
[[self alloc] init]; // assignment not done here | |
} | |
} | |
return singleton; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These constants are used to choose the version of OpenGL ES that a rendering context provides. | |
typedef NSUInteger EAGLRenderingAPI; | |
enum | |
{ | |
kEAGLRenderingAPIOpenGLES1 = 1 | |
kEAGLRenderingAPIOpenGLES2 = 2 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$lipo libTapjoyConnectDeviceConnect.a libTapjoyConnectSimulatorConnect.a -create -output libTapjoyConnect.a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main() { | |
CGFloat version = [@"4.2.1" floatValue]; | |
NSLog(@"version: %f", version); | |
} | |
O2Machina:~ karl$ gcc main.m -o test -framework Foundation | |
O2Machina:~ karl$ ./test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGFloat CGContextShadowOrientationYMultiplier() { | |
static CGFloat sharedMultiplier__ = 0.0; | |
if (sharedMultiplier__ == 0.0) { | |
NSString *version = [UIDevice currentDevice].systemVersion; | |
sharedMultiplier__ = ([version compare:@"3.2"] == NSOrderedAscending) ? 1.0f : -1.0f; | |
} | |
return sharedMultiplier__; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -d "$BUILT_PRODUCTS_DIR/${PRODUCT_NAME}.app/foo.bundle" ]; then | |
rm -rf "$BUILT_PRODUCTS_DIR/${PRODUCT_NAME}.app/foo.bundle" | |
fi | |
if [ -d "$BUILT_PRODUCTS_DIR/foo.bundle" ]; then | |
cp -r "$BUILT_PRODUCTS_DIR/foo.bundle" "$BUILT_PRODUCTS_DIR/${PRODUCT_NAME}.app/" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2011-05-11 03:25:07.462 GlobalSingletonSupportTest[63618:1803] irSharedInstance instance NSObject 15f980, 181511 ns | |
2011-05-11 03:25:07.465 GlobalSingletonSupportTest[63618:5303] irSharedInstance instance NSObject 15f980, 614 ns | |
2011-05-11 03:25:07.465 GlobalSingletonSupportTest[63618:5403] irSharedInstance instance NSObject 15f980, 584 ns | |
2011-05-11 03:25:07.464 GlobalSingletonSupportTest[63618:a0f] irSharedInstance instance NSObject 15f980, 1546 ns | |
2011-05-11 03:25:07.466 GlobalSingletonSupportTest[63618:a0f] irSharedInstance instance NSObject 15f980, 1545 ns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSString *)reuseIdentifier { | |
static NSString *reuseIdentifier; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
reuseIdentifier = [NSStringFromClass(self) retain]; | |
}); | |
return reuseIdentifier; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CATransaction begin]; | |
[CATransaction setValue:(id)kCFBooleanTrue | |
forKey:kCATransactionDisableActions]; | |
[aLayer removeFromSuperlayer]; | |
[CATransaction commit]; |