Skip to content

Instantly share code, notes, and snippets.

View rumandcode's full-sized avatar

rumandcode

  • Manchester, England
View GitHub Profile
@rumandcode
rumandcode / gist:7397133
Created November 10, 2013 11:35
Example of a recursive block in Objective-C
__unsafe_unretained __block void (__weak ^recursiveBlock)(int, int) = ^ void (int a, int b) {
NSLog(@"%d", a);
int n = a + b;
recursiveBlock(b, n);
};
recursiveBlock(0, 1);
@rumandcode
rumandcode / ObjCIntrospect.h
Created November 10, 2013 12:00
Objective-C introspection methods
#import <Foundation/Foundation.h>
/** ClassGetSubclasses
Returns all subclasses for a given class by interrogating every class in the
runtime. Results are cached to save time on repeat calls for the same class.
*/
extern NSArray *ClassGetSubclasses(Class parentClass);
@rumandcode
rumandcode / asciiheight.py
Created November 10, 2013 12:01
Python script for rendering ASCII Grid format terrain data to a height map.
import argparse
parser = argparse.ArgumentParser(description='Python script for rendering ASCII Grid format terrain data to a height map.')
parser.add_argument('path-to-ascii-file', metavar='<path-to-ascii-file>', type=str,
help='path to the ASCII Grid format file')
parser.add_argument('output-path', metavar='<output-path>', type=str,
help='file path to write the output PNG to')
args = vars(parser.parse_args())