This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang -framework Foundation -fobjc-arc test.m | |
#import <objc/runtime.h> | |
#import <stdio.h> | |
#import <stdlib.h> | |
int main(int argc, char **argv) | |
{ | |
@autoreleasepool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
objc[3120]: Do not call -_isDeallocating. | |
(gdb) bt | |
#0 0x31e57048 in _objc_trap () | |
#1 0x31e570ac in _objc_fatal () | |
#2 0x31e570ac in _objc_fatal () | |
#3 0x31e608a2 in _objc_rootIsDeallocating () | |
#4 0x33608754 in -[NSProxy _isDeallocating] () | |
#5 0x3360878c in -[NSProxy allowsWeakReference] () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void *_MAZeroingWeakRefClassPresentToken = &_MAZeroingWeakRefClassPresentToken; | |
void *_MAZeroingWeakRefClassNativeWeakReferenceNotAllowedTable[256] = { | |
[0x3] = (void *[256]) { // 1 | |
[0x5b] = (void *[256]) { // 2 | |
[0x81] = (void *[256]) { // 3 | |
[0x42] = (void *[256]) { // 4 | |
[0xa2] = (void *[256]) { // 5 | |
[0xe] = (void *[256]) { // 6 | |
[0x20] = (void *[256]) { // 7 | |
[0xd7] = (void *[256]) { // 8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <dlfcn.h> | |
#import <Foundation/Foundation.h> | |
struct BlockDescriptor | |
{ | |
unsigned long reserved; | |
unsigned long size; | |
void *rest[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang -W -Wall -Wno-unused-parameter -framework Foundation -fobjc-arc test.m | |
#import <Foundation/Foundation.h> | |
#define IDARRAY(...) ((id[]){ __VA_ARGS__ }) | |
#define IDCOUNT(...) (sizeof(IDARRAY(__VA_ARGS__)) / sizeof(id)) | |
typedef id (^Tuple)(int); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int inPins[2] = { 0, 1 }; | |
int lastValues[2] = { 0, 0 }; | |
float averages[2] = { 0, 0 }; | |
float delta = 0.0; | |
float decay = 0.02; | |
int outPin = 12; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generator returns values in range [0, 1) | |
typedef double (^CWRandomGenerator)(void); | |
CWRandomGenerator CWMakeRandomGenerator(void); | |
// generate a normally-distributed number with the given mean and standard deviation | |
// see http://en.wikipedia.org/wiki/Normal_distribution | |
double CWNormalDistribution(CWRandomGenerator rnd, double mean, double stddev); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CWUnits.h | |
// cow | |
// | |
// Created by Michael Ash on 4/19/11. | |
// Copyright 2011 Two Pastry Eaters. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mach/mach.h> | |
#include <mach/vm_map.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
void *allocate_pair(size_t howmuch) | |
{ | |
#define CHECK_ERR do { \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang -framework Foundation lisp.m | |
#import <Cocoa/Cocoa.h> | |
#import <objc/runtime.h> | |
@interface Node : NSObject | |
- (id)evaluate: (NSArray *)arguments; | |
- (id)eval; | |
@end |