I hereby claim:
- I am sebastiangrail on github.
- I am sebastiangrail (https://keybase.io/sebastiangrail) on keybase.
- I have a public key ASB09g2HFioYWPCK_gbnKOpv-zQ8mYNxdxk6uTB3Yx80_go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import Result | |
import ReactiveCocoa | |
import Foundation | |
import XCPlayground | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
let producer1 = SignalProducer<AnyObject, NSError> { observer, disposable in | |
let task1 = NSURLSession.sharedSession().dataTaskWithURL(NSURL(string:"http://jsonplaceholder.typicode.com/posts/1")!, completionHandler: { (data, response, error) in | |
if error != nil { |
@interface RACSignal (Animate) | |
@end | |
@implementation RACSignal (Animate) | |
- (RACSignal*)animateWithDuration:(NSTimeInterval)duration { | |
return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { | |
return [self subscribeNext:^(id x) { | |
[UIView animateWithDuration:duration animations:^{ | |
[subscriber sendNext:x]; |
protocol Monoid { | |
static func zero () -> Self | |
static func append (Self, Self) -> Self | |
} | |
protocol NumberType { | |
func add(other: Self) -> Self | |
func subtract(other: Self) -> Self | |
func multiplyWith(other: Self) -> Self | |
static func zero () -> Self |
// make strings appendable | |
extension String { | |
func append (other: String) -> String { | |
return self + " " + other | |
} | |
} | |
// Chainable with append method. Note that strings aren't mutated | |
"Hi," | |
.append("how") |