Skip to content

Instantly share code, notes, and snippets.

View hcrub's full-sized avatar

Neil Burchfield hcrub

View GitHub Profile
@hcrub
hcrub / HCClassRuntime.m
Created November 7, 2013 17:06
Creating a NSClass during Objective C's Runtime
// Creating a class at runtime can be accomplished using the objc_allocateClassPair function in objc/runtime.h.
/**
* objc_allocateClassPair
*
* (Class superclass, const char *name, size_t extraBytes)
**/
Class runtimeClass = objc_allocateClassPair([NSObject class], "ThisRuntimeClass", 0);
@hcrub
hcrub / HCSwizzle.m
Created November 7, 2013 16:57
Example of Objective-C's Runtime method_exchangeImplementations for method swizzling
+ (void)load
{
Method original, swizzled;
original = class_getInstanceMethod(self, @selector(original_method));
swizzled = class_getInstanceMethod(self, @selector(swizzled_method));
method_exchangeImplementations(original, swizzled);
}
@hcrub
hcrub / appledoc_aggregate.sh
Created November 6, 2013 20:02
Aggregate Target for Xcode 5+ for creating clean AppleDoc documentation.
/usr/local/bin/appledoc \
--project-name "${PROJECT_NAME}" \
--project-company "HCRUB" \
--company-id "com.hcrub" \
--output "${PROJECT_DIR}/Documentation" \
--install-docset \
--logformat xcode \
--keep-undocumented-objects \
--keep-undocumented-members \
--keep-intermediate-files \
@hcrub
hcrub / ghub_issues.rb
Created November 6, 2013 19:56
Imports and Sorts Github issues into CSV File
###################################################
# Neil Burchfield
# Nov 6, 2013
# Imports and Sorts Github issues into CSV File
###################################################
require 'octokit'
require 'csv'
require 'date'