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
@class TKState, TKStateMachine; | |
typedef void (^LongStateBlock)(TKState *state, TKStateMachine *stateMachine); | |
static inline LongStateBlock Adapter(void(^block)()) { | |
void(^heapBlock)() = [block copy]; // forces block to be on heap rather than stack, a one-time expense | |
LongStateBlock longBlock = ^(TKState *s __unused, TKStateMachine *sm __unused) { | |
heapBlock(); | |
}; |
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
FROM XCODE CONSOLE: | |
*** Unable to run app in Simulator If you believe this error represents a bug, please attach the log file at /var/folders/74/k54kppb928s963936by98fzm0000gn/T/com.apple.dt.XCTest-status/Session-2014-11-21_13:05:32-Rla0wx.log | |
FROM THAT LOG FILE: | |
2014-11-21 13:05:32.265 Beginning test session with Xcode 6A1052c | |
2014-11-21 13:05:32.265 Testing on device: <DVTiPhoneSimulator: 0x7fa48133f4b0> { | |
SimDevice: SimDevice : RedactedName.PhotoTest (3219C047-04CE-41BF-9BE4-F200B2BE25C1) : state={ Booted } deviceType={ SimDeviceType : com.apple.CoreSimulator.SimDeviceType.iPhone-6 } runtime={ SimRuntime : 8.1 (12B411) - com.apple.CoreSimulator.SimRuntime.iOS-8-1 } | |
} |
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
(defn center-y-for-note | |
; arity = 2 | |
([{:keys [origin size]} note] | |
(let [{:keys [height]} size] | |
(center-y-for-note (origin :y) (size :height) note))) | |
; arity = 3 | |
([origin-y height note] | |
(let [note-increment (/ height 8) | |
ymin (+ origin-y height)] |
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
#!/usr/bin/env bash | |
# | |
# Based on original solution by user lembacon, here: | |
# https://forums.developer.apple.com/thread/13170?start=105&tstart=0 | |
# Watch fix added by user Richie__. | |
# | |
# Created by Clay Bridges, 5 Aug 2015 | |
move_dyld_sim() | |
{ |
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
BOOL ProtocolContainsInstanceSelector(NSString *protocolName, SEL sel); | |
BOOL ProtocolContainsInstanceSelector(NSString *protocolName, SEL sel) | |
{ | |
Protocol *p = objc_getProtocol([protocolName cStringUsingEncoding:NSUTF8StringEncoding]); | |
// must check for both required = {YES, NO} | |
struct objc_method_description desc = protocol_getMethodDescription(p, sel, YES, YES); | |
BOOL contains = desc.name != NULL && desc.types != NULL; | |
if (!contains) { |
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 *HexNSStringFromBytes(uint8_t *bytes, NSUInteger count) { | |
char *hexCString = calloc(count * 2 + 1, sizeof(char *)); | |
static char hexLookup[] = "0123456789abcdef"; | |
NSMutableString* testString = [NSMutableString string]; | |
for (int i = 0; i < count; ++i) { | |
uint8_t fullByte = bytes[i]; | |
// each byte converts to two hex characters |
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 <CommonCrypto/CommonDigest.h> | |
NSString *MD5StringFromBytes(uint8_t *bytes, NSUInteger count) | |
{ | |
uint8_t md5Bytes[CC_MD5_DIGEST_LENGTH]; | |
CC_MD5(bytes, count, md5Bytes); | |
// convert to hex string | |
static char hexLookup[] = "0123456789abcdef"; | |
char hexCString[CC_MD5_DIGEST_LENGTH * 2 + 1]; // each byte converts to two hex characters, plus null terminator |
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
Pod::Spec.new do |s| | |
s.name = "ReactiveCocoa" | |
s.version = "2.0.0dev" | |
s.summary = "A framework for composing and transforming sequences of values." | |
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source" | |
s.author = { "Josh Abernathy" => "josh@github.com" } | |
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git", :branch => '2.0-development' } | |
s.license = 'Simplified BSD License' | |
s.description = "ReactiveCocoa offers:\n" \ | |
"1. The ability to compose operations on future data.\n" \ |
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 struct { | |
Class class; | |
SEL sel; | |
} SelStruct; // not sure about the name SelStruct, but works for now | |
NSString *NSStringFromSelStruct(SelStruct s) { | |
return [NSString stringWithFormat:@"-[%@ %@]", s.class, NSStringFromSelector(s.sel)]; | |
} | |
- (void)testCache { |
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
- (void)testInitWithDecimal { | |
Method m = class_getInstanceMethod([NSDecimalNumber class], @selector(initWithDecimal:)); | |
const char *types = method_getTypeEncoding(m); | |
// this will yield: | |
// +[NSMethodSignature signatureWithObjCTypes:]: unsupported type encoding spec '{?}' | |
NSMethodSignature *ms = [NSMethodSignature signatureWithObjCTypes:types]; | |
} |
OlderNewer