Skip to content

Instantly share code, notes, and snippets.

@fjolnir
fjolnir / gist:726961
Created December 3, 2010 13:40
properties~
@interface OSCObserver : NSObject
@property(nonatomic, copy) NSString *path;
@property(nonatomic, assign) id object;
@property(nonatomic) SEL selector;
@end
@implementation OSCObserver
@synthesize path, object, selector;
+ (OSCObserver *)observerWithPath:(NSString *)path object:(id)object selector:(SEL)selector {
OSCObserver *ret = [[self alloc] init];
ret.path = path;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateFormat = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'sssZ':00'";
df.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
df.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
NSDate *d = [df dateFromString:@"2011-08-15T20:13:00.003+02:00"];
NSLog(@"%@ - %@", d, df.timeZone);
- (void)setPubDate:(NSString *)dateAsString {
if(dateAsString == pubdate)
return;
[pubdate release];
pubdate = [dateAsString copy];
static NSDateFormatter *df = nil;
if(!df) {
df = [[NSDateFormatter alloc] init];
df.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
#define StartRecordTime( start ) \
__asm mov saved_ebx, ebx \
__asm xor eax, eax \
__asm cpuid \
__asm rdtsc \
__asm mov start, eax \
__asm xor eax, eax \
__asm cpuid
#define StopRecordTime( end ) \
static vec2_t bezier_firstDerivative(bezier_t curve, float t)
{
vec2_t out;
vec3_t derivControlPoints[3];
derivControlPoints[0] = vec3_sub(curve.controlPoints[1], curve.controlPoints[0]);
derivControlPoints[1] = vec3_sub(curve.controlPoints[2], curve.controlPoints[1]);
derivControlPoints[2] = vec3_sub(curve.controlPoints[3], curve.controlPoints[2]);
float mt = 1.0f - t;
float coef0 = powf(mt, 2.0f);
static vec3_t *bezier_getPoints(bezier_t curve, float dirChangeThreshold, int *outCount)
{
dirChangeThreshold /= 100.0f;
int capacity = 32;
int count = 0;
float t = 0.0f;
float interval = 0.05;
vec3_t *out = malloc(sizeof(vec3_t)*capacity);
out[count++] = bezier_getPoint(curve, t);
static void bezier_getLineSegments(bezier_t curve, int count, vec3_t *outPoints, float *outLengths, float *outDeltas, float *outTotalLength)
{
vec3_t points[count];
float lengths[count];
lengths[count-1] = 0.0f;
float deltas[count];
float totalLength;
float t = 0.0f;
float interval = 1.0f/(float)(count-1);
@fjolnir
fjolnir / gist:1660529
Created January 23, 2012 04:09
Xcode 4 applescript woes
tell application "Xcode"
set proj to last project
set conf to build configuration "Debug" of proj
build proj using conf with transcript
-- Just returns a 'missing value'
end tell
let mapleader = ","
set nocompatible
set backspace=indent,eol,start
set number
set ruler
syntax on
set encoding=utf-8
let mapleader = ","
set nocompatible
set backspace=indent,eol,start
set number
set ruler
syntax on
set encoding=utf-8