Skip to content

Instantly share code, notes, and snippets.

Avatar

Timothy J. Wood tjw

View GitHub Profile
View objc-assoc.m
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface ExtraData : NSObject
@end
@implementation ExtraData
- (void)dealloc;
{
fprintf(stderr, "ExtraData %p deallocated\n", self);
[super dealloc];
View objc-assoc.m
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/objc-auto.h>
/*
cc -Wall -fobjc-gc objc-assoc.m -o objc-assoc -framework Foundation
*/
@interface ExtraData : NSObject
@end
View max-concurrent.c
#import <stdio.h>
#import <dispatch/dispatch.h>
#import <libkern/OSAtomic.h>
#import <unistd.h>
/*
gcc-4.2 -arch x86_64 -std=gnu99 -O0 -mdynamic-no-pic -Wall -Werror -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -gdwarf-2 max-concurrent.c -o max-concurrent
*/
int main(int argc, char *argv[])
View gist:712841
[OUIAnimationSequence runWithDuration:0.3
actions:
^{
// step 1
},
^{
// step 2
},
^{
@tjw
tjw / PackageSystemHeaders
Created Feb 25, 2011
Go beyond the release notes!
View PackageSystemHeaders
#!/bin/zsh -f
set -e
PKG_DIR=/tmp/SystemHeaders-`uname -r`
echo "Packaging $PKG_DIR..."
mkdir -p $PKG_DIR
cd /
for d in System/Library/Frameworks usr/include Developer/Library/Frameworks usr/lib; do
View gist:910308
static id _commonInit(MyView *self)
{
// common init stuff like so...
self.opaque = YES;
self->_scale = 1.0;
return self;
}
- initWithFrame:(CGRect)frame;
View gist:979057
--------------- cats #42 (34 lines) ---------------
Date: Fri Apr 22 12:33:02 1994
From: I'm jealous of Le Qow. <camel>
Subject: cat humor
recent cat humor postings on the uwbb reminded me of Yak.
Just for some reminiscing, here's a yak post that I've saved for quite
some time now.
View gist:2516350
Marker - Apr 27, 2012 10:41:55 PM
Apr 27 22:41:58 vaya [0x0-0x61f61f].com.wb.Bastion[17401]: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
Apr 27 22:41:58 vaya [0x0-0x61f61f].com.wb.Bastion[17401]: at GSGE.AppDelegate.DidBecomeActive (MonoMac.Foundation.NSNotification) <0x00010>
Apr 27 22:41:58 vaya [0x0-0x61f61f].com.wb.Bastion[17401]: at (wrapper dynamic-method) object.[GSGE.AppDelegate.Void DidBecomeActive(MonoMac.Foundation.NSNotification)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSNotification) <0x00033>
Apr 27 22:41:58 vaya [0x0-0x61f61f].com.wb.Bastion[17401]: at (wrapper native-to-managed) object.[GSGE.AppDelegate.Void DidBecomeActive(MonoMac.Foundation.NSNotification)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSNotification) <0x000fb>
Apr 27 22:41:58 vaya [0x0-0x61f61f].com.wb.Bastion[17401]: at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain
View gist:4499886
#import <stdio.h>
#define UNIQUE_CONST_PTR2(X) ({ static unsigned X; &X; })
#define CAT(x,y) x##y
#define UNIQUE_CONST_PTR1(X, Y) UNIQUE_CONST_PTR2(CAT(X,Y))
#define UNIQUE_CONST_PTR(KEY) UNIQUE_CONST_PTR1(KEY, __COUNTER__)
int main(int argc, char *argv[])
{
const void *u1 = UNIQUE_CONST_PTR(A);
View gist:4506724
2013-01-10 15:34:16.892 otest[1587:7407] NSFileCoordinator: Sending of a willWrite message was interrupted. Details: Connection interrupted
2013-01-10 15:34:16.892 otest[1587:7407] A process invoked one of the -[NSFileCoordinator coordinate...] methods but filecoordinationd crashed. Returning an error.
(gdb) bt
#0 0x00007fff8d9cc250 in objc_msgSend ()
#1 0x0000000000000030 in ?? ()
#2 0x00007fff95bc50af in -[NSFileSubarbitrationClaim devalueSelf] ()
#3 0x00007fff95bc4eef in -[NSFileSubarbitrationClaim revoked] ()
#4 0x00007fff95bb07d9 in -[NSFileAccessArbiter _revokeAccessClaim:] ()
#5 0x00007fff95bb0896 in -[NSFileAccessArbiter _revokeAccessClaimForID:fromLocal:] ()