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
@implementation LHLPrettyView | |
// Only override drawRect: if you perform custom drawing. | |
// An empty implementation adversely affects performance during animation. | |
- (void)drawRect:(CGRect)rect { | |
CGSize totalSize = self.bounds.size; | |
CGFloat fraction = 0.8; | |
CGFloat radius = rintf(MIN(totalSize.height * fraction / 2, totalSize.width * fraction / 2)); // Why did we use rintf? | |
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
@interface LHLAppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@property (strong, nonatomic) NSNumber* counter; // will making this 'atomic' solve our problem? | |
@property (strong, nonatomic) dispatch_queue_t isolationQueue; | |
@property (strong, nonatomic) NSRecursiveLock* lock; | |
@end |
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
// | |
// main.m | |
// WordCounter | |
// | |
// Created by Hirad Motamed on 2014-08-22. | |
// Copyright (c) 2014 Pendar Labs. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#include <pthread.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
let numbers = [9,29, 83, 19, 48, 65, 25, 30, 18, 1, 15, 84, 72, 63, 71] | |
func splitToSublists(list: Int[]) -> (Int[], Int[]) { | |
assert(list.count > 1, "List size must be greater than 1 before split") | |
let midIndex = (list.count / 2) as Int | |
var leftSublist: Int[] = Array(list[0..midIndex]) | |
var rightSublist: Int[] = Array(list[midIndex..(list.count)]) | |
return (leftSublist, rightSublist) | |
} |
NewerOlder