Skip to content

Instantly share code, notes, and snippets.

View d-ronnqvist's full-sized avatar

David Rönnqvist d-ronnqvist

View GitHub Profile
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);
@iamleeg
iamleeg / sillyloop.m
Last active December 23, 2015 23:59
You probably don't need to tell me that this is a bad idea.
#import <Foundation/Foundation.h>
typedef NS_ENUM(int, GJLRangeDirection) {
GJLRangeDirectionPositive,
GJLRangeDirectionNegative,
};
@interface GJLRange : NSEnumerator
+ (instancetype)rangeWithStart: (NSNumber *)start end: (NSNumber *)end step: (NSNumber *)step;