Skip to content

Instantly share code, notes, and snippets.

View JaredCrawford's full-sized avatar

Jared Crawford JaredCrawford

View GitHub Profile
@JaredCrawford
JaredCrawford / gist:362073
Created April 10, 2010 15:32
Determine private methods on a given class.
#include <objc/objc.h>
#include <objc/message.h>
#include <objc/runtime.h>
+(void)getMethodsForClass:(id)class{
unsigned int count = 0;
Method *methods = class_copyMethodList(object_getClass(class), &count);
for (int i=0; i < count; i++) {
Method method = methods[i];
SEL selector = method_getName(method);
@JaredCrawford
JaredCrawford / gist:946890
Created April 28, 2011 18:04
Singleton Template
+(id)singleton{
static dispatch_once_t once;
static id singleton;
dispatch_once(&once, ^ { singleton = [[self alloc] init]; });
return singleton;
}