Skip to content

Instantly share code, notes, and snippets.

View OscarSwanros's full-sized avatar

Oscar Swanros OscarSwanros

View GitHub Profile
#import <Foundation/Foundation.h>
#import <assert.h>
//Compile with `clang -Os -framework Foundation -fno-objc-arc inlinestorage.m -o inline, run with `inline clever` or `inline naive`
/*
NaiveArray implements a simple immutable NSArray-like interface in probably the most obvious way: store a pointer to a C array of objects
*/
@interface NaiveArray : NSObject {
NSUInteger count;
@Wevah
Wevah / gist:10145527
Created April 8, 2014 15:44
Using kPasteboardTypeFileURLPromise/kPasteboardTypeFilePromiseContent
- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard {
// pasteboard must be stored away because there's no way to get it in -pasteboardPropertyListForType: :(
_currentPasteboard = pasteboard;
NSArray *types = @[(id)kPasteboardTypeFileURLPromise, (id)kPasteboardTypeFilePromiseContent];
return types;
}
// ...