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 void (^FilePresenterReacquirerBlock)(void); | |
typedef void (^FilePresenterReaderBlock)(FilePresenterReacquirerBlock reacquirer); | |
typedef void (^FilePresenterWriterBlock)(FilePresenterReacquirerBlock reacquirer); | |
typedef void (^FilePresenterCompletionHandler)(NSError *errorOrNil); | |
- (void)relinquishPresentedItemToReader:(FilePresenterReaderBlock)reader | |
{ | |
// Do stuff here ahead of reading | |
reader(^{ | |
// Do stuff here after reading is done |
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
#import <Foundation/Foundation.h> | |
@interface RSTLValue : NSValue | |
- (BOOL)getValue:(void *)value expectedSize:(size_t)expectedSize; | |
@end | |
struct Foo { | |
NSUInteger i; | |
char * bar; | |
}; |
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
// | |
// KATGShowControlsScrubber.m | |
// KATG | |
// | |
// Created by Doug Russell on 2/24/13. | |
// Copyright (c) 2013 Doug Russell. All rights reserved. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at |
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
// | |
// ARCLogic.h | |
// | |
#ifndef ARCLOGIC | |
#define ARCLOGIC | |
#ifdef HASARC | |
#undef HASARC | |
#endif |
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
NSString *someText = ...; | |
NSMutableString *someLines = [NSMutableString new]; | |
[someText enumerateLinesUsingBlock:^(NSString *line, BOOL *stop) { | |
// Make sure the line isn't just whitespace | |
NSMutableString *mutableLine = [line mutableCopy]; | |
CFStringTrimWhitespace((__bridge CFMutableStringRef)mutableLine); | |
if ([mutableLine length]) | |
{ | |
[someLines appendFormat:@" • %@\n", line]; | |
} |
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
// | |
// KATGDownloadOperation.h | |
// KATG | |
// | |
// Created by Doug Russell on 3/7/13. | |
// Copyright (c) 2013 Doug Russell. All rights reserved. | |
// | |
#import "ESHTTPOperation.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
// Works fine | |
accounts = [accounts filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(ACAccount *evaluatedObject, NSDictionary *bindings) { | |
return [[[evaluatedObject accountType] identifier] isEqualToString:[self.accountType identifier]]; | |
}]]; | |
// No dice | |
accounts = [accounts filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(ACAccount *evaluatedObject, NSDictionary *bindings) { | |
return [[evaluatedObject accountType] isEqual:self.accountType]; |
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
#pragma mark - Memory Cache Subscripting | |
// Allow self[key] for looking up and writing to memory cache | |
// This is mostly a novelty | |
- (id)objectForKeyedSubscript:(id)key | |
{ | |
return [self.memoryCache objectForKey:key]; | |
} |
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
#if !defined(NS_BLOCK_ASSERTIONS) | |
#define RSTLSetOfStringsAssert(set) [set enumerateObjectsUsingBlock:^(id obj, BOOL *stop) { NSParameterAssert([obj isKindOfClass:[NSString class]]); }]; | |
#else | |
#define RSTLSetOfStringsAssert(set) | |
#endif |
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
#import <Foundation/Foundation.h> | |
#include <objc/message.h> | |
typedef void (*DISPATCH_IMP_NOARGS_NORETURN)(id, SEL); | |
typedef id (*DISPATCH_IMP_NOARGS)(id, SEL); | |
@interface Foo : NSObject | |
@end |