(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.
| { | |
| "always_run_in_app" : false, | |
| "icon" : { | |
| "color" : "deep-blue", | |
| "glyph" : "lightbulb" | |
| }, | |
| "name" : "Power outage 2.1", | |
| "script" : "\/\/ colors\nconst DEFAULT_TEXT_COLOR = Color.dynamic(Color.black(), Color.white());\nconst SECONDARY_TEXT_COLOR = new Color('#bababa');\nconst OUTAGE_COLOR = Color.red();\nconst NO_OUTAGE_COLOR = Color.green();\nconst MAYBE_OUTAGE_COLOR = Color.orange();\nconst WIDGET_COLOR = Color.dynamic(Color.white(), new Color('#1c1c1e'));\n\n\/\/ text\nconst DEFAULT_FONT = Font.mediumSystemFont(14);\nconst LARGE_FONT = Font.lightSystemFont(37);\nconst SECONDARY_FONT = Font.boldSystemFont(14);\nconst OUTAGE_MESSAGE = 'Outage';\nconst NO_OUTAGE_MESSAGE = 'Okay';\nconst MAYBE_OUTAGE_MESSAGE = 'Maybe';\n\n\/\/ other\nconst OUTAGE_CODE = '-';\nconst NO_OUTAGE_CODE = '+';\nconst MAYBE_OUTAGE_CODE = '0';\nconst SEEDS = new Map([\n [\n '1.1',\n '0-++++0-++++-0++++-0++++++++-0++++-0++-0++++-0++0-++++0-++++++++0-++++0-++0-++++0-++',\n ],\n [\n '1.2',\n '-0++++-0++++0-+ |
| extension NSTimer { | |
| /** | |
| Creates and schedules a one-time `NSTimer` instance. | |
| - Parameters: | |
| - delay: The delay before execution. | |
| - handler: A closure to execute after `delay`. | |
| - Returns: The newly-created `NSTimer` instance. | |
| */ |
| Best design pattern for starting only one async operation and share signal result | |
| https://github.com/ReactiveCocoa/ReactiveCocoa/issues/828 | |
| http://stackoverflow.com/questions/14066651/how-to-using-reactivecocoa-to-transparently-authenticate-before-making-api-calls/14072445#14072445 | |
| http://stackoverflow.com/questions/15075075/when-to-use-racreplaysubject-vs-racmulticastconnection | |
| http://spin.atomicobject.com/2014/06/29/replay-replaylast-replaylazily/ |
(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.
| /** | |
| Provides the ability to verify key paths at compile time. | |
| If "keyPath" does not exist, a compile-time error will be generated. | |
| Example: | |
| // Verifies "isFinished" exists on "operation". | |
| NSString *key = SQKeyPath(operation, isFinished); | |
| // Verifies "isFinished" exists on self. |
| // Taken from http://PSPDFKit.com. This snippet is under public domain. | |
| #define UIKitVersionNumber_iOS_7_0 0xB57 | |
| BOOL PSPDFIsUIKitFlatMode(void) { | |
| static BOOL isUIKitFlatMode = NO; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| // We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7. | |
| if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) { | |
| isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0; | |
| } |
| require 'httparty' | |
| require 'json' | |
| class Crashlytics | |
| include HTTParty | |
| base_uri 'https://api.crashlytics.com/api/v2' | |
| def session(email, password) | |
| self.class.post('/session.json', | |
| body: {email: email, password:password}.to_json, |
| #import <Foundation/Foundation.h> | |
| #import <libkern/OSAtomic.h> | |
| @interface NSArray (ConcurrentMap) | |
| - (NSArray*)semaphore_map:(id (^)(id))block; | |
| - (NSArray*)serial_map:(id (^)(id))block; | |
| - (NSArray*)spinlock_map:(id (^)(id))block; | |
| @end | |
| @implementation NSArray (ConcurrentMap) |
| --- | |
| language: objective-c | |
| before_script: | |
| - ./scripts/travis/add-key.sh | |
| after_script: | |
| - ./scripts/travis/remove-key.sh | |
| after_success: | |
| - ./scripts/travis/testflight.sh | |
| env: | |
| global: |