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 Cocoa | |
private struct Bin<V> { | |
var key: Int | |
var value: V? | |
} | |
public class Thing<V> { | |
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 XX { | |
func a(b: Int) -> Int { | |
return b | |
} | |
var functionA = a | |
func run() { | |
print("\(functionA(1))") // Needs (self) after functionA |
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
non-ARC recursive block | |
void __block (^batchReaderRecursive)(NSUInteger position, NSUInteger count); // Used for the recursive reference | |
void (^batchReader)(NSUInteger position, NSUInteger count); // Used to reference the block | |
batchReaderRecursive = batchReader = [^(NSUInteger position, NSUInteger count) { | |
dispatch_async(background queue, ^{ | |
// Do work, update position abd count |
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
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:@"en_US"]; | |
NSNumberFormatter *inputFormatter = [[NSNumberFormatter alloc] init]; | |
[inputFormatter setLocale:locale]; | |
[inputFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; | |
[inputFormatter setLenient:YES]; | |
[inputFormatter setGeneratesDecimalNumbers:YES]; | |
NSDecimalNumber *a = (NSDecimalNumber *)[inputFormatter numberFromString:@"87.85"]; | |
NSDecimalNumber *b = [NSDecimalNumber decimalNumberWithString:@"87.85"]; | |
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
Running Time Self Symbol Name | |
519.0ms 3.4% 1.0 -[NSURL(NSURLPathUtilities) URLByAppendingPathComponent:] | |
459.0ms 3.0% 0.0 -[NSURL getResourceValue:forKey:error:] | |
456.0ms 3.0% 0.0 CFURLCopyResourcePropertyForKey | |
454.0ms 2.9% 0.0 _FSURLCopyResourcePropertyForKey | |
2.0ms 0.0% 2.0 OSSpinLockUnlock$shim | |
2.0ms 0.0% 2.0 _FSURLEndResourcePropertyCacheAccess | |
1.0ms 0.0% 1.0 CFRunLoopGetCurrent | |
55.0ms 0.3% 0.0 -[NSURL(NSURLPathUtilities) URLByAppendingPathComponent:isDirectory:] | |
2.0ms 0.0% 1.0 -[__NSCFString hasSuffix:] |
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
Thread 1, Queue : (null) | |
#0 0x354b42fc in CFRelease () | |
#1 0x323b090c in CA::release_objects(X::List<void const*>*) () | |
#2 0x323968ec in CA::Transaction::unlock() () | |
#3 0x323c8a34 in CA::Layer::~Layer() () | |
#4 0x323c8928 in -[CALayer dealloc] () | |
#5 0x04572d2a in -[CALayerAccessibility(SafeCategory) dealloc] () | |
#6 0x323996b2 in CALayerRelease () | |
#7 0x323a66c0 in CA::Layer::free_transaction(CA::Transaction*) () |