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
__weak typeof(self) weakSelf = self; | |
AFJSONRequestOperation *operation = | |
[AFJSONRequestOperation JSONRequestOperationWithRequest:request | |
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { | |
NSDictionary *jsonDict = (NSDictionary *) JSON; | |
// this is the array that stores the JSON response | |
NSArray *csvFiles = [jsonDict objectForKey:@"csv_files"]; | |
[weakSelf doSomethingWithTheArray:csvFiles]; | |
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) { |
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
#!/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
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
#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
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 |