This file contains hidden or 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> | |
// Adapted from http://stackoverflow.com/a/11068850 | |
/** | |
* @brief convert a hexidecimal string to a signed long | |
* will not produce or process negative numbers except | |
* to signal error. | |
* | |
* @param hex without decoration, case insensative. | |
* |
This file contains hidden or 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
self.startButton.rac_command = [RACCommand command]; | |
self.stopButton.rac_command = [RACCommand command]; | |
__unsafe_unretained id weakSelf = self; | |
id<RACSignal> tick = [[[[self.startButton.rac_command | |
map:^(id _) { | |
RTAFirstView *strongSelf = weakSelf; | |
// Map each start button click to a new signal that fires every second | |
// and stops when the stop button is clicked. | |
return [[RACSignal interval:1] takeUntil:strongSelf.stopButton.rac_command]; |
This file contains hidden or 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
// Creating a lambda in C++ with variable type inferred automatically | |
auto someLambda = [](float w, int x, int y) { return(x); }; | |
// Creating a block in C/ObjC without the use of a typedef -- UGLY | |
int (^someBlock)(float, int, int) = ^(float w, int x, int y) { return(x); }; | |
// Creating a block in CPP/ObjCPP with variable type inferred automatically -- NOT TOO BAD | |
auto someBlock = ^(float w, int x, int y) { return(x); }; |
This file contains hidden or 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
//NSError **error... | |
if(CWErrorSet(true, ^NSError *{ | |
return CWCreateError(@"domain", 404, @"error message"); }, error)) { | |
return nil; | |
} | |
// alternate formatting | |
if (CWErrorSet(YES, ^NSError *{ |
This file contains hidden or 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/python | |
import zipfile | |
import glob | |
import fnmatch | |
import sys | |
import json | |
import os | |
import Foundation |
This file contains hidden or 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
Show hidden characters
{ | |
"cmd": ["/usr/local/go/bin/go","build","$file"], | |
"selector" : "source.go", | |
"variants": [ | |
{ "cmd": ["/usr/local/go/bin/go", "run", "$file"], | |
"name": "Run" | |
} | |
] | |
} |
This file contains hidden or 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
// ObjectError.h -- Subclass of Object which handles errors. | |
// Copyright (c) 1992 by Proponent, Inc. All rights reserved. | |
// To make this work, the application must send a "setup" message | |
// to the class. This will poseAs: object and intercept a number of things. | |
#import <objc/Object.h> | |
@interface ObjectError : Object |
This file contains hidden or 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> | |
#import <objc/runtime.h> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
printf("dispatch_queue_t size: %lu bytes\n",sizeof(dispatch_queue_t)); | |
printf("NSOperationQueue size: %lu bytes\n", class_getInstanceSize([NSOperationQueue class])); | |
} | |
return 0; |
This file contains hidden or 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 <sys/sysctl.h> | |
#include <unistd.h> | |
#include <err.h> | |
#include <errno.h> | |
#include <stdio.h> | |
#import <stdarg.h> | |
#import <mach/mach.h> | |
#import <mach/mach_time.h> | |
#import <unistd.h> |
This file contains hidden or 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
tail end of the results | |
2012-03-30 11:36:39.865 Untitled[78506:707] IsEqual: 1438 | isEqualToString 589 | |
2012-03-30 11:36:39.875 Untitled[78506:707] IsEqual: 1377 | isEqualToString 590 | |
2012-03-30 11:36:39.876 Untitled[78506:707] IsEqual: 956 | isEqualToString 560 | |
2012-03-30 11:36:39.877 Untitled[78506:707] IsEqual: 860 | isEqualToString 451 | |
2012-03-30 11:36:39.877 Untitled[78506:707] IsEqual: 824 | isEqualToString 433 | |
2012-03-30 11:36:39.878 Untitled[78506:707] IsEqual Average 1212 - IsEqualToString Average 619 |