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 *className = NSStringFromClass([UIView class]); | |
const char *cClassName = [className UTF8String]; | |
id theClass = objc_getClass(cClassName); | |
unsigned int outCount; | |
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
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy]; | |
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping; | |
paragraphStyle.alignment = NSTextAlignmentCenter; | |
[str drawInRect:rect withAttributes: @{NSFontAttributeName: f1, | |
NSParagraphStyleAttributeName: paragraphStyle }]; |
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
#import "NSAttributedString+DXYTrim.h" | |
@implementation NSAttributedString (DXYTrim) | |
- (NSAttributedString *)attrStringByTrimmingCharacterInSet:(NSCharacterSet *)set { | |
__block __weak NSAttributedString*(^weak_leadingTrim)(NSAttributedString*); | |
NSAttributedString*(^leadingTrim)(NSAttributedString*); | |
weak_leadingTrim = leadingTrim = ^NSAttributedString*(NSAttributedString *attrString) { | |
NSRange range = [attrString.string rangeOfCharacterFromSet:set]; | |
if (range.location == 0) { |
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
//based on control | |
//=============================================================================================================== | |
- (void)iPhoneHandleOpenURL:(NSURL *)url { | |
NSString *keyword = url.host; | |
if ([keyword isEqualToString:@"feed"]) { | |
// | |
} else if ([keyword isEqualToString:@"board"]) { | |
// | |
} else if ([keyword isEqualToString:@"threads"]) { | |
// |
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
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info.plist DVTPlugInCompatibilityUUID` |
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 | |
var title = "fibonacci sequence" | |
func fib1(n: Int) -> Int { | |
switch n { | |
case 0: return 0 | |
case 1: return 1 | |
default: return fib1(n-1) + fib1(n-2) | |
} |
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 "AppDelegate.h" | |
#import "fishhook.h" | |
#import <dlfcn.h> | |
static NSUncaughtExceptionHandler *g_vaildUncaughtExceptionHandler; | |
static void (*ori_NSSetUncaughtExceptionHandler)( NSUncaughtExceptionHandler * ); | |
void my_NSSetUncaughtExceptionHandler( NSUncaughtExceptionHandler * handler) | |
{ | |
g_vaildUncaughtExceptionHandler = NSGetUncaughtExceptionHandler(); |
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 *)ppi | |
{ | |
NSString *ppi = @""; | |
if ([self.deviceName isEqualToString:@"iPod1,1"] || | |
[self.deviceName isEqualToString:@"iPod2,1"] || | |
[self.deviceName isEqualToString:@"iPod3,1"] || | |
[self.deviceName isEqualToString:@"iPhone1,1"] || | |
[self.deviceName isEqualToString:@"iPhone1,2"] || | |
[self.deviceName isEqualToString:@"iPhone2,1"]) { |