(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.
| // A thing I want to do | |
| // This flow only involves **one** promise, for example an ajax call | |
| // None of the subsequent `then` or `catch` calls, return new promises. | |
| var explode = false; | |
| var promise = new Promise(function(resolve, reject) { | |
| if (explode) { |
| -- script.lua | |
| -- Receives a table, returns the sum of its components. | |
| io.write("The table the script received has:\n"); | |
| x = 0 | |
| for i = 1, #foo do | |
| print(i, foo[i]) | |
| x = x + foo[i] | |
| end | |
| io.write("Returning data back to C\n"); | |
| return x |
(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.
| //@auto_closure hack to prevent `LLVM ERROR: unimplemented IRGen feature! non-fixed multi-payload enum layout` | |
| //as in https://github.com/maxpow4h/swiftz/blob/master/swiftz/Either.swift | |
| enum Either<L,R> { | |
| case Left(@auto_closure () -> L) | |
| case Right(@auto_closure () -> R) | |
| func flatMapLeft<L1>(f: (L) -> Either<L1, R>) -> Either<L1, R> { | |
| switch self { | |
| case let .Left(l): return f(l()) | |
| case let .Right(r): return .Right(r) |
| protocol Monad { | |
| typealias F | |
| typealias U | |
| class func bind<M : Monad where M.U == U>(Self, F -> M) -> M | |
| class func `return`(F) -> Self | |
| } | |
| extension Array : Monad { | |
| typealias F = T |
| #import <Foundation/Foundation.h> | |
| #import <ReactiveCocoa/ReactiveCocoa.h> | |
| @interface PASDataSource : NSObject | |
| @property (nonatomic, strong, readonly) NSArray *passes; | |
| + (PASDataSource *)sharedInstance; | |
| - (RACSignal *)refreshPassInfoSignal; |
| protocol ISubscriber { | |
| typealias Element | |
| func disposable() -> RACCompoundDisposable | |
| func sendNext(e: Element) | |
| func sendError(e: NSError) | |
| func sendCompleted() | |
| } |
| // | |
| // ViewController.swift | |
| // TestSwift | |
| // | |
| // Created by Jameson Quave on 6/2/14. | |
| // Copyright (c) 2014 JQ Software LLC. All rights reserved. | |
| // | |
| import UIKit | |
| app-admin/logrotate clang | |
| app-admin/sudo clang | |
| app-admin/syslog-ng clang | |
| app-arch/bzip2 clang | |
| app-arch/cpio clang | |
| app-arch/file-roller clang | |
| app-arch/gzip clang | |
| app-arch/lha clang | |
| app-arch/libarchive clang | |
| app-arch/lz4 clang |