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
// | |
// GIFDownloader.h | |
// TheJoysOfCode | |
// | |
// Created by Bob on 29/10/12. | |
// Copyright (c) 2012 Tall Developments. All rights reserved. | |
// | |
#import <Foundation/Foundation.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
clang -dynamiclib -framework AppKit patch.m -o patch.dylib | |
env DYLD_INSERT_LIBRARIES=patch.dylib "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" |
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*) describe:(id) object { | |
NSMutableString *string = [NSMutableString stringWithString:@""]; | |
unsigned int propertyCount; | |
objc_property_t *properties = class_copyPropertyList([object class], &propertyCount); | |
for (unsigned int i = 0; i < propertyCount; i++) | |
{ | |
NSString *selector = [NSString stringWithCString:property_getName(properties[i]) | |
encoding:NSUTF8StringEncoding] ; |
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
/** | |
* Register keyboard notifications. | |
*/ | |
-(void) registerKeyboardNotifications { | |
trace(@"register keyboard notifications"); | |
NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; | |
[center addObserver:self | |
selector:@selector(keyboardDidShow:) | |
name:UIKeyboardWillShowNotification object:nil]; | |
[center addObserver:self |
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
Needs["PlotLegends`"] | |
Plot[{1, Log[n], n, n*Log[n], n^2, n!, 2^n}, {n, 0, 40}, | |
PlotRange -> {0, 200}, PlotLabel -> "O(n) Performance types", | |
PlotLegend -> {"1", "Log[n]", "n", "n*Log[n]", "n^2", "n!", "2^n"}, | |
LegendShadow -> None, LegendBorder -> None, | |
LegendPosition -> {0.9, -0.4}] |
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
// TEST ASYNCHRONOUS CODE | |
// Runs in Code Runner | |
#import <Foundation/Foundation.h> | |
@interface Test : NSObject | |
-(void)test1BooleanFlag; | |
-(void)test2BooleanFlagAndTimeLimit; | |
-(void)test3Semaphore; |
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 (^loop_work_t)(void); | |
@interface TaxiLoop : NSObject | |
@property (nonatomic,assign) loop_work_t block; | |
@property (nonatomic,assign) NSTimeInterval interval; | |
@property (nonatomic,assign) dispatch_source_t timerSource; |
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
- (dispatch_queue_t)internalQueue | |
{ | |
static dispatch_once_t onceToken; | |
static dispatch_queue_t *internalQueue; | |
dispatch_once(&onceToken, ^{ | |
internalQueue = dispatch_queue_create... | |
}); | |
return internalQueue; | |
} |
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 Array : NSObject <NSFastEnumeration> { | |
id __strong *_objs; | |
NSUInteger _count; | |
} | |
@end | |
@implementation Array |
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
// queue name | |
static const char* s_myqueue = "myqueue"; | |
// return the specific queue | |
dispatch_queue_t my_queue() { | |
static dispatch_queue_t _q; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_q = dispatch_queue_create(s_myqueue, 0); | |
// sets the key/value data for the specified dispatch queue |
OlderNewer