flinders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public extension Int { | |
public var seconds: DispatchTimeInterval { | |
return DispatchTimeInterval.seconds(self) | |
} | |
public var second: DispatchTimeInterval { | |
return seconds | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSURLSession { | |
func fetch(url: String) -> Async<Result<(NSData, NSURLResponse), Error>> { | |
return Async { completion in | |
let task = self.dataTaskWithURL(NSURL(string: url)!, completionHandler: { (data, response, error) -> Void in | |
if let data = data, response = response { | |
completion(Result(value: (data, response))) | |
} else { | |
completion(Result(error: .LegacyError(error))) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.connectionProxyDictionary = [ | |
kCFNetworkProxiesHTTPProxy: "localhost", | |
kCFNetworkProxiesHTTPPort: 8888 | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum NoError {} | |
extension NoError: Equatable { } | |
public func ==(lhs: NoError, rhs: NoError) -> Bool { | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Box<T> { | |
let value: T | |
func map<U>(transform: T -> U) -> Self<U> { | |
return Self<U>(value: transform(value)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef NS_ENUM(NSInteger, HSArrayDiffActionType) { | |
HSArrayDiffActionTypeAppend, | |
HSArrayDiffActionTypeReplace, | |
HSArrayDiffActionTypeDelete | |
}; | |
@interface HSArrayDiffAction : NSObject | |
@property (nonatomic) HSArrayDiffActionType type; | |
@property (nonatomic) id sourceObject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var promise: Promise<Int, NSError>! | |
var testSubject: SomeObject! | |
beforeEach { | |
promise = Promise<Int, NSError>() | |
testSubject = SomeObject(future: promise.future) | |
} | |
describe("when the request succeeds") { | |
beforeEach { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface HSIntrinsicView : UIView | |
@property (nonatomic) CGSize intrinsicContentSize; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)methodWithBlock:(nonnull id __nullable (^)(NSString * __nonnull title))block; |