This file contains 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
######################### | |
# .gitignore file for Xcode4 and Xcode5 Source projects | |
# | |
# Apple bugs, waiting for Apple to fix/respond: | |
# | |
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation? | |
# | |
# Version 2.3 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# |
This file contains 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
@interface NSDictionary (SafeObjectForKey) | |
- (id) safeObjectForKey:(id)aKey; | |
@end | |
@implementation NSDictionary (SafeObjectForKey) | |
- (id) safeObjectForKey:(id)aKey | |
{ | |
id obj = [self objectForKey: aKey]; |
This file contains 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 *)md5:(NSString *)str | |
{ | |
const char *cStr = [str UTF8String]; | |
unsigned char result[16]; | |
CC_MD5(cStr, strlen(cStr), result); // This is the md5 call | |
return [NSString stringWithFormat: | |
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", | |
result[0], result[1], result[2], result[3], | |
result[4], result[5], result[6], result[7], | |
result[8], result[9], result[10], result[11], |
This file contains 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
1.把TODO,FIXME等注释转化为编译结果中的警告 | |
#!/bin/sh | |
# 把TODO,FIXME等注释转化为编译结果中的警告 | |
# by Kellen Styler | |
# via: http://d3signerd.com/turn-fixme-todo-and-comments-into-compiler-warnings/ | |
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:" | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/" | |
2.编译时自增构建数 | |
#!/bin/sh |
This file contains 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 *)GUID | |
{ | |
CFUUIDRef theUUID = CFUUIDCreate(NULL); | |
CFStringRef theString = CFUUIDCreateString(NULL, theUUID); | |
NSString *unique = [NSString stringWithString:(__bridge id)theString]; | |
CFRelease(theString); CFRelease(theUUID); // Cleanup CF objects |
This file contains 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> | |
@interface MyCalendar : NSObject | |
+ (void)requestAccess:(void (^)(BOOL granted, NSError *error))success; | |
+ (BOOL)addEventAt:(NSDate*)eventDate withTitle:(NSString*)title inLocation:(NSString*)location; | |
@end |
This file contains 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> | |
@interface NSDate (Between) | |
- (BOOL)isBetweenDate:(NSDate*)beginDate andDate:(NSDate*)endDate; | |
- (BOOL)isEarlyThanDate:(NSDate*)date; | |
- (BOOL)isLaterThanDate:(NSDate*)date; | |
@end |
This file contains 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
//去掉group cell的边框 | |
UIView *tempView = [[[UIView alloc] init] autorelease]; | |
[self.photoCell setBackgroundView:tempView]; | |
[self.photoCell setBackgroundColor:[UIColor clearColor]]; |
This file contains 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
//将版本字符串转换为数字 | |
+(int)getVersionNumber:(NSString*)version | |
{ | |
int versionNo = 0; | |
NSArray *arr = [version componetsSeparateByString:@"."]; | |
int count = arr.count; | |
for(NSString *no in arr) | |
{ |
This file contains 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
#if NS_BLOCKS_AVAILABLE | |
typedef void (^CompletionBlock)(NSString* result); | |
typedef void (^FailedBlock)(NSError* error); | |
#endif | |
@interface ImageUploader : NSObject { | |
NSData *theImage; | |
CompletionBlock completeblock; | |
FailedBlock failedblock; | |
} |
NewerOlder