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
| // Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
| // Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
| // Licensed under MIT (http://opensource.org/licenses/MIT) | |
| // | |
| // You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
| #ifdef DEBUG //only use this in debug builds | |
| #import <objc/runtime.h> | |
| #import <objc/message.h> |
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 *currentSSID = @""; | |
| CFArrayRef myArray = CNCopySupportedInterfaces(); | |
| if (myArray != nil){ | |
| NSDictionary* myDict = (__bridge NSDictionary *) CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0)); | |
| if (myDict!=nil){ | |
| currentSSID=[myDict valueForKey:@"SSID"]; | |
| } else { | |
| currentSSID=@"<<NONE>>"; | |
| } | |
| } else { |
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
| dispatch_source_t cookitSourceWithFile(const char *cookieFileName) { | |
| int fd = open(cookieFileName, O_EVTONLY); | |
| if (fd == -1) { | |
| return NULL; | |
| } | |
| fcntl(fd, F_SETFL, O_NONBLOCK); | |
| dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE, fd,DISPATCH_VNODE_DELETE | DISPATCH_VNODE_WRITE | DISPATCH_VNODE_EXTEND | DISPATCH_VNODE_RENAME | DISPATCH_VNODE_REVOKE, DISPATCH_TARGET_QUEUE_DEFAULT); | |
| if (!source) { | |
| close(fd); | |
| return NULL; |
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
| AFHTTPRequestOperationManager->AFHTTPResponseSerializer->removesKeysWithNullValues = YES; |
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
| 针对Xcode能自动探知重名的category方法的问题,暂时找到了一个办法。 | |
| 在工程的环境变量中加上OBJC_PRINT_REPLACED_METHODS并且值为YES,那么Xcode会自动log出重名的category方法 |
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
| // | |
| // NSNull+LCFMessageForwarding.h | |
| // NSNull | |
| // | |
| // Created by leichunfeng on 15/12/22. | |
| // Copyright © 2015年 leichunfeng. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
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 | |
| # Create a RAM disk with same perms as mountpoint | |
| # Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions | |
| # Usage: sudo ./xcode_ramdisk.sh start | |
| USERNAME=$(logname) | |
| TMP_DIR="/private/tmp" | |
| RUN_DIR="/var/run" | |
| SYS_CACHES_DIR="/Library/Caches" |
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 | |
| #ID='A16FF353-8441-459E-A50C-B071F53F51B7' # Xcode 6.2 | |
| #ID='992275C1-432A-4CF7-B659-D84ED6D42D3F' # Xcode 6.3 | |
| #ID='E969541F-E6F9-4D25-8158-72DC3545A6C6' # Xcode 6.3.2 | |
| ID=`/usr/libexec/PlistBuddy -c 'Print DVTPlugInCompatibilityUUID' "$(xcode-select -p)/../Info.plist"` | |
| PLIST_BUDDY=/usr/libexec/PlistBuddy |
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 BNRTimeBlock (void (^block)(void)); |
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
| #define Mask8(__x__) ((__x__) & 0xFF) | |
| #define R(__x__) (Mask8(__x__)) | |
| #define G(__x__) (Mask8(__x__ >> 8)) | |
| #define B(__x__) (Mask8(__x__ >> 16)) | |
| #define A(__x__) (Mask8(__x__ >> 24)) | |
| #define __RGBA(r, g, b, a) (Mask8(r) | Mask8(g)<<8 | Mask8(b)<<16 | Mask8(a)<<24) | |
| - (UIImage *)maskImage:(UIImage *)maskImage { | |
| if (!maskImage) { | |
| return self; |