View UIColor+ColorDef.swift
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 UIKit | |
typealias ColorDef = UInt32 | |
extension UIColor { | |
convenience init(_ colorDef: ColorDef) { | |
self.init(colorDef: colorDef) | |
} | |
convenience init(colorDef: ColorDef) { | |
self.init(colorDef: colorDef, alpha: 1.0) |
View gist:26ca27371f4523339dc3
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 --version | |
0.33.1 | |
➜ ~ pod spec lint https://raw.githubusercontent.com/iAsync/iAsyncLite/master/podspecs/iAsyncLiteScheduler.podspec --verbose | |
> iAsyncLiteScheduler | |
iAsyncLiteScheduler (0.3.1) - Analyzing on iOS 6.0 platform. | |
Analyzing dependencies |
View gist:833919
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
+ (NSManagedObject *)managedObjectFromStructure:(NSDictionary *)structureDictionary | |
entityName:(NSString *)entityName | |
withManagedObjectContext:(NSManagedObjectContext *)context { | |
NSMutableDictionary *mutableStructureDictionary = [structureDictionary mutableCopy]; | |
NSManagedObject *managedObject = [NSEntityDescription insertNewObjectForEntityForName:entityName | |
inManagedObjectContext:context]; | |
NSDictionary *relationshipsByName = [[managedObject entity] relationshipsByName]; |
View gist:835215
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
+ (NSManagedObject *)managedObjectFromStructure:(NSDictionary *)structureDictionary | |
entityName:(NSString *)entityName | |
withManagedObjectContext:(NSManagedObjectContext *)context { | |
NSMutableDictionary *mutableStructureDictionary = [structureDictionary mutableCopy]; | |
NSManagedObject *managedObject = nil; | |
NSManagedObjectModel *model = [context.persistentStoreCoordinator managedObjectModel]; | |
for (NSString *property in [mutableStructureDictionary allKeys]) { |
View gist:872834
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
+ (NSInvocation *)invocationWithTarget:(id)target action:(SEL)selector arguments:(NSArray *)arguments retainArguments:(BOOL)retainArguments { | |
NSMethodSignature *signature = nil; | |
if (isClass(target)) { | |
signature = [target methodSignatureForSelector:selector]; | |
} else { | |
signature = [[target class] instanceMethodSignatureForSelector:selector]; | |
} | |
NSInvocation *invocation = [self invocationWithMethodSignature:signature]; |
View gist:1144925
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
//UIColor+Defined.h | |
typedef uint32_t DColor; | |
+ (UIColor *)colorWithDefinedColor:(DColor)dColor; | |
+ (UIColor *)colorWithDefinedColor:(DColor)dColor alpha:(CGFloat)alpha; | |
//UIColor+Defined.m | |
+ (UIColor *)colorWithDefinedColor:(DColor)dColor { | |
return [self colorWithDefinedColor:dColor alpha:1.0f]; | |
} |
View EXC_BAD_INSTRUCTION.m
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_semaphore_t semaphore = dispatch_semaphore_create(1); | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
sleep(1); | |
dispatch_semaphore_signal(semaphore); | |
sleep(1); | |
dispatch_semaphore_signal(semaphore); | |
sleep(1); | |
dispatch_semaphore_signal(semaphore); | |
}); |
View main.m
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> | |
int main(int argc, char *argv[]) { | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
dispatch_semaphore_t semaphore = dispatch_semaphore_create(1); | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^(void) { | |
sleep(1); | |
dispatch_semaphore_signal(semaphore); | |
}); |
View readability.js
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
/*jslint undef: true, nomen: true, eqeqeq: true, plusplus: true, newcap: true, immed: true, browser: true, devel: true, passfail: false */ | |
/*global window: false, readConvertLinksToFootnotes: false, readStyle: false, readSize: false, readMargin: false, Typekit: false, ActiveXObject: false */ | |
var dbg = (typeof console !== 'undefined') ? function(s) { | |
console.log("Readability: " + s); | |
} : function() {}; | |
/* | |
* Readability. An Arc90 Lab Experiment. | |
* Website: http://lab.arc90.com/experiments/readability |
View gist:1779129
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
#include <objc/runtime.h> | |
#include <objc/message.h> | |
+ (void)printClassMethods:(Class)class { | |
NSLog(@"Methods in %@", NSStringFromClass(class)); | |
unsigned int out_count = 0; | |
Method *class_methods = class_copyMethodList(class, &out_count); | |
for (int i = 0; i < out_count; i++) { | |
Method m = class_methods[i]; | |
NSLog(@"\t%@", NSStringFromSelector(method_getDescription(m)->name)); |
OlderNewer