This has been implemented for real now. See:
This file contains 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
- (NSArray *)mapWithOptions:(NSEnumerationOptions)options usingBlock:(id (^)(id obj))block { | |
NSUInteger count = [self count]; | |
NSArray *result = nil; | |
if (options & NSEnumerationConcurrent) { | |
volatile id * restrict objects = malloc(sizeof(id) * count); | |
if (!objects) { | |
return nil; | |
} |
This file contains 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
typedef id (^Tuple)(size_t); | |
#define tuple(...) \ | |
tupleMake(__VA_ARGS__, nil) | |
#define emptyTuple \ | |
tupleMake(nil) | |
Tuple tupleMake (id firstObject, ...) NS_REQUIRES_NIL_TERMINATION | |
{ |
This file contains 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
local ship = { entropy.loadtexture("data/ships/fighter/base.png") } | |
local glow = { entropy.loadtexture("data/ships/fighter/glow.png") } | |
local lights = { entropy.loadtexture("data/ships/fighter/lights.png") } | |
function shutdown () | |
entropy.deletetexture(ship[1]) | |
entropy.deletetexture(glow[1]) | |
entropy.deletetexture(lights[1]) | |
end |
This file contains 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
// only works with object types, but such is Cocoa | |
typedef id (^generator)(void); | |
- (generator)methodReturningMultipleValues { | |
__block int value = 0; | |
return ^{ | |
switch (value++) { | |
case 0: | |
return [NSNumber numberWithInt:5]; |
This file contains 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
/* Logger.m */ | |
@aspect Logger | |
// called for any selector | |
- (void)before { | |
// '_cmd' is special -- the selector for the actual method with the advice | |
// applied to it | |
NSLog(@"starting -[%@ %@]", self, _cmd); | |
} | |
// only called for 'deposit:' |
This file contains 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
# In a class-dump of AppKit: | |
$ ack -l '\)(retain|release);' . | awk -F '.' '{ print $1 }' | |
__NSATSStringSegment | |
__NSFontTypefaceInfo | |
__NSSharedFontInstanceInfo | |
_NSCachedAttributedString | |
_NSStateMarker | |
NSATSGlyphStorage | |
NSATSTypesetter |
This file contains 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
; run this with one of the following: | |
; | |
; lli guessing-game.ll | |
; llc guessing-game.ll && clang -o guessing-game guessing-game.s && ./guessing-game | |
; | |
; note: you may need to 'brew install llvm' first | |
; type representing a FILE handle in C (like stdin) | |
%FILE = type opaque |
This file contains 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
// | |
// VELAnimatedBinding.h | |
// Velvet | |
// | |
// Created by Justin Spahr-Summers on 01.04.12. | |
// Copyright (c) 2012 Bitswift. All rights reserved. | |
// | |
#import <Proton/Proton.h> |
This file contains 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
#1 "Tests/EXTADTTest.m" | |
#1 "Tests/EXTADTTest.m" 1 | |
#1 "<built-in>" 1 | |
#1 "<built-in>" 3 | |
#152 "<built-in>" 3 | |
#1 "<command line>" 1 | |
#1 "<built-in>" 2 | |
#1 "Tests/EXTADTTest.m" 2 | |