(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #include "AnimatedImage.h" | |
| void UAnimatedImage::SetCurrentFrame(int32 Frame) | |
| { | |
| CurrentFrame = Frame; | |
| if (CurrentFrame < 0) CurrentFrame = 0; | |
| if (CurrentFrame > TotalFrames - 1) CurrentFrame = TotalFrames - 1; | |
| SynchronizeProperties(); | |
| } |
| #pragma once | |
| /** | |
| * FAsyncQueue can be used to run asynchronous delegates in sequence, parallel and combinations of the above | |
| * | |
| * Use Add() to enqueue delegates matching FAsyncDelegate signature: | |
| * a void function that accepts a single argument of another void function with no arguments. | |
| * | |
| * Static factories MakeSync, MakeSequence and MakeParallel can be used to wrap different type of delegates and | |
| * delegate collections into a single FAsyncDelegate which can be enqueued with Add(). |
| var getPushIdTimestamp = (function getPushIdTimestamp() { | |
| var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; | |
| return function getTimestampFromId(id) { | |
| var time = 0; | |
| var data = id.substr(0, 8); | |
| for (var i = 0; i < 8; i++) { | |
| time = time * 64 + PUSH_CHARS.indexOf(data[i]); | |
| } |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // By Clément Wehrung | |
| function Iterator(queueRef, processingCallback) { | |
| this.queueRef = queueRef; | |
| this.processingCallback = processingCallback; | |
| this.processed = {}; | |
| this.processNext(); | |
| } | |
| Iterator.prototype.processNext = function() { |
| //viewDidload | |
| if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { | |
| // iOS 7 | |
| [self prefersStatusBarHidden]; | |
| [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; | |
| } else { | |
| // iOS 6 | |
| [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; | |
| } |
| [self.navigationController.navigationBar.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
| if ([obj isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]){ | |
| UIView* v = obj; | |
| [[v.subviews objectAtIndex:1] removeFromSuperview]; | |
| *stop=YES; | |
| } | |
| }]; |
| @implementation AVAssetExportSession (Testing) | |
| - (void) exportSynchronously | |
| { | |
| dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); | |
| [self exportAsynchronouslyWithCompletionHandler:^{ | |
| dispatch_semaphore_signal(semaphore); | |
| }]; | |
| dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); | |
| dispatch_release(semaphore); |