By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
| import time | |
| def RateLimited(maxPerSecond): | |
| minInterval = 1.0 / float(maxPerSecond) | |
| def decorate(func): | |
| lastTimeCalled = [0.0] | |
| def rateLimitedFunction(*args,**kargs): | |
| elapsed = time.clock() - lastTimeCalled[0] | |
| leftToWait = minInterval - elapsed | |
| if leftToWait>0: |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| git stash && git fetch origin && git reset --hard origin/master |
| @import WatchKit; | |
| #import <ReactiveCocoa/ReactiveCocoa.h> | |
| @interface WKInterfaceController (Reactive) | |
| @property (nonatomic, readonly) RACSignal *activatedSignal; | |
| @property (nonatomic, readonly) RACSignal *deactivatedSignal; | |
| @property (nonatomic, readonly) RACSignal *didPresentControllerSignal; | |
| @property (nonatomic, readonly) RACSignal *didPushControllerSignal; |
| exists(A, list(A, _, _, _, _)). | |
| exists(A, list(_, A, _, _, _)). | |
| exists(A, list(_, _, A, _, _)). | |
| exists(A, list(_, _, _, A, _)). | |
| exists(A, list(_, _, _, _, A)). | |
| rightOf(R, L, list(L, R, _, _, _)). | |
| rightOf(R, L, list(_, L, R, _, _)). | |
| rightOf(R, L, list(_, _, L, R, _)). | |
| rightOf(R, L, list(_, _, _, L, R)). |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents