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
# inhibit_all_warnings! | |
# If you enable inhibit_all_warnings, we will not see warnings from our developer Pods. | |
# inhibit_all_warnings Оключает отображение warning во всех подключенных Pods. И мы не видим предупреждение в наших developer Pods | |
# Solution: Disable warning only for third party Pods | |
# Решение: Отключить показ warning только для сторонних подов | |
# Solution: for custom pods https://stackoverflow.com/a/44530816 | |
# Решение: для выборочного отключения https://stackoverflow.com/a/44530816 |
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
@implementation UIImage (Draw) | |
//画一个直角矩形图片 | |
+ (UIImage *)drawRectImageWithColor:(UIColor *)color size:(CGSize)size { | |
CGRect rect = CGRectMake(0, 0, size.width, size.height); | |
UIGraphicsBeginImageContext(rect.size); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextSetFillColorWithColor(context, [color CGColor]); |
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
+(NSData*) dataWithInputStream:(NSInputStream*) stream { | |
NSMutableData * data = [NSMutableData data]; | |
[stream open]; | |
NSInteger result; | |
uint8_t buffer[1024]; // BUFFER_LEN can be any positive integer | |
while((result = [stream read:buffer maxLength:1024]) != 0) { | |
if(result > 0) { | |
// buffer contains result bytes of data to be handled |
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 <sys/sysctl.h> | |
static CFTimeInterval processStartTime() { | |
size_t len = 4; | |
int mib[len]; | |
struct kinfo_proc kp; | |
sysctlnametomib("kern.proc.pid", mib, &len); | |
mib[3] = getpid(); | |
len = sizeof(kp); |
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
- (UIImage*)screenshot | |
{ | |
// Create a graphics context with the target size | |
// On iOS 4 and later, use UIGraphicsBeginImageContextWithOptions to take the scale into consideration | |
// On iOS prior to 4, fall back to use UIGraphicsBeginImageContext | |
CGSize imageSize = [[UIScreen mainScreen] bounds].size; | |
if (NULL != UIGraphicsBeginImageContextWithOptions) | |
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0); | |
else | |
UIGraphicsBeginImageContext(imageSize); |
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
# Under the projects folder -> Build Phases -> click on add new build phase on top left corner -> select New Run Script Phase | |
# Select the Run Script from the dropdown of Build Phase | |
# let the Shell be the default (/bin/sh) | |
# Paste below code in the place provided | |
# This code run every time the project is build | |
# To create warning (TODO, FIXME) & error msgs (ERROR) comment tags | |
TAGS="TODO|FIXME" | |
ERRORTAG="ERROR" | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | \ |
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
BOOL PSPDFSystemFunctionOverriddenInCategory(Class theClass, SEL selector, NSString *__autoreleasing* categoryName) { | |
NSCParameterAssert(theClass); | |
NSCParameterAssert(selector); | |
Dl_info info; | |
if (dladdr(class_getMethodImplementation(theClass, selector), &info)) { | |
// /System/Library/Frameworks is a common denominator, some methods are in /usr/lib/libobjc.A.dylib | |
// Custom app is in /private/var/mobile/Containers/Bundle/Application/<UID>/PSPDFCatalog.app/PSPDFCatalog | |
if (!strstr(info.dli_fname, "/System/Library") && !strstr(info.dli_fname, "/usr/lib")) { | |
if (categoryName) *categoryName = @(info.dli_sname); |
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 PSPDF_KEYPATH(object, property) (^{ \ | |
_Pragma("clang diagnostic push") \ | |
_Pragma("clang diagnostic ignored \"-Wunreachable-code\"") \ | |
_Pragma("clang diagnostic ignored \"-Wimplicit-retain-self\"") \ | |
return ((void)(NO && ((void)object.property, NO)), @#property); \ | |
_Pragma("clang diagnostic pop") \ | |
}()) |
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 *const PSPDFApplicationDidReceiveMemoryWarningNotification = @"PSPDFApplicationDidReceiveMemoryWarningNotification"; | |
// Test with sudo memory_pressure -l critical. Don't forget to re-set afterwards! | |
__attribute__((constructor)) static void PSPDFInstallLowMemoryNotificationWarningMac(void) { | |
static dispatch_source_t source; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_WARN|DISPATCH_MEMORYPRESSURE_CRITICAL, dispatch_get_main_queue()); | |
dispatch_source_set_event_handler(source, ^{ | |
dispatch_source_memorypressure_flags_t pressureLevel = dispatch_source_get_data(source); |
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
var readline = require('readline'), | |
fs = require('fs'); | |
var LinkMap = function(filePath) { | |
this.files = [] | |
this.filePath = filePath | |
} | |
LinkMap.prototype = { | |
start: function(cb) { |
NewerOlder