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
| // | |
| // Tree.h | |
| // learnObjectiveC | |
| // | |
| // Created by kmd on 3/3/15. | |
| // Copyright (c) 2015 Happy Days. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.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
| // | |
| // RRQueue.h | |
| // learnObjectiveC | |
| // | |
| // Created by darshan on 3/19/15. | |
| // Copyright (c) 2015 Happy Days. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.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
| #import | |
| @interface Node : NSObject{ | |
| Node *left; | |
| Node *right; | |
| NSObject *data; | |
| } | |
| @property (nonatomic, strong) Node *left; | |
| @property (nonatomic, strong) Node *right; |
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
| In Mysql, if your using a subquery to update a table, it will give you an error. | |
| e.x. In the below query your basically trying to update and query the table at the same time. This would not be possible in Mysql. | |
| [code language="text"] | |
| UPDATE items ci SET ci.`c_id` = 27 | |
| WHERE ci.`ID` IN ( | |
| SELECT c.`ID` | |
| FROM orders f, items c | |
| WHERE c.`orderID` = f.`orderID` LIMIT 100; |
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
| @interface RRHomeViewController () | |
| { | |
| UIButton *logoutButton; | |
| UIView *testAnimateView; | |
| } | |
| @property (nonatomic, strong) UIDynamicAnimator *animator; | |
| @property (nonatomic, strong) UIDynamicItemBehavior *linearVelocity; | |
| @end | |
| @implementation RRHomeViewController |
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
| // without using auto release pools | |
| NSMutableArray *temporaryArrayForPairs = [NSMutableArray new]; | |
| for (int i=0; i<500000; i++) { | |
| Pair *pair = [Pair new]; | |
| pair.grandParent = @"darshan was here"; | |
| [temporaryArrayForPairs addObject:pair]; | |
| } |
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
| // Using auto release pools | |
| @autoreleasepool { | |
| NSMutableArray *temporaryArrayForPairs = [NSMutableArray new]; | |
| for (int i=0; i<500000; i++) { | |
| Pair *pair = [Pair new]; | |
| pair.grandParent = @"darshan was here"; | |
| [temporaryArrayForPairs addObject:pair]; | |
| } | |
| } |
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
| @interface Pair : NSObject | |
| @property (nonatomic, copy) void (^blockAsProperty)(int val); | |
| +(void) displayBlock:(void(^)(int param))blockAsMethodParameter; | |
| @end | |
| @implementation Pair | |
| +(void) displayBlock:(void(^)(int param)) blockAsMethodParameter{ | |
| blockAsMethodParameter(10); | |
| } | |
| @end |
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
| // feeder methods to test | |
| self.counter = 10; | |
| [self testThreads]; | |
| [self serialQs]; | |
| -(void) serialQs { | |
| dispatch_queue_t dispatchQueue = dispatch_queue_create("com.darshan.learn.dispatch", DISPATCH_QUEUE_SERIAL); | |
| __weak typeof (self) weakSelf = self; |
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
| The following script calculates how much time to load a page since the most recent navigation. | |
| <html> | |
| <head> | |
| <script type="text/javascript"> | |
| function onLoad() { | |
| var now = new Date().getTime(); | |
| var page_load_time = now - performance.timing.navigationStart; | |
| alert("User-perceived page loading time: " + page_load_time); | |
| } |