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 | |
# Xcode scripting does not invoke rvm. To get the correct ruby, | |
# we must invoke rvm manually. This requires loading the rvm | |
# *shell function*, which can manipulate the active shell-script | |
# environment. | |
# cf. http://rvm.io/workflow/scripting | |
# Load RVM into a shell session *as a function* | |
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then |
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) addTasksToSessionWithTaskObject:(Task*)taskObject withSessionInitialisationNeeded:(BOOL) needed{ | |
NSString *filePath = [[NSBundle mainBundle] pathForResource:pathForResourceFile ofType:resourceFileType]; | |
S3PutObjectRequest *putObjectRequest = [[S3PutObjectRequest alloc] initWithKey:targetFileKey | |
inBucket:_bucketname]; | |
putObjectRequest.cannedACL = [S3CannedACL publicReadWrite]; | |
putObjectRequest.filename = filePath; | |
putObjectRequest.contentType = [resourceFileType isEqualToString:@"MOV"] ? @"movie/mov" : @"image/jpg"; | |
putObjectRequest.endpoint = @"http://s3.amazonaws.com"; | |
putObjectRequest.contentLength=[[[NSFileManager defaultManager] |
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
LEFT PARENTHESIS (U+0028, Ps): ( | |
RIGHT PARENTHESIS (U+0029, Pe): ) | |
LEFT SQUARE BRACKET (U+005B, Ps): [ | |
RIGHT SQUARE BRACKET (U+005D, Pe): ] | |
LEFT CURLY BRACKET (U+007B, Ps): { | |
RIGHT CURLY BRACKET (U+007D, Pe): } | |
LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, Pi): « | |
RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, Pf): » | |
TIBETAN MARK GUG RTAGS GYON (U+0F3A, Ps): ༺ | |
TIBETAN MARK GUG RTAGS GYAS (U+0F3B, Pe): ༻ |
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 BarrierOperation : NSOperation | |
@end | |
@interface BarrierQueue : NSObject | |
- (void)addOperation:(NSOperation *)op; |
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
- (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]; | |
} |
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
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
// UIInterfaceOrientationMask vs. UIInterfaceOrientation | |
// As far as I know, a function like this isn't available in the API. I derived this from the enum def for | |
// UIInterfaceOrientationMask. | |
inline BOOL OrientationMaskSupportsOrientation(UIInterfaceOrientationMask mask, UIInterfaceOrientation orientation) { | |
return (mask & (1 << orientation)) != 0; | |
} |
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 |