I've moved this gist to https://github.com/phynet/iOS-Schemes please check it there ;)
This file contains hidden or 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
| let rx_request = Observable<Value>.create { (observer) -> Disposable in | |
| let requestReference = Alamofire.request(.POST, url, parameters: payload) | |
| .responseJSON(completionHandler: { (response) in | |
| if let value = response.result.value { | |
| observer.onNext(value) | |
| observer.onCompleted() | |
| }else if let error = response.result.error { | |
| observer.onError(error) | |
| } | |
| }) |
This file contains hidden or 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
| protocol KeyValueStorable { | |
| subscript (key: String) -> AnyObject? { get set } | |
| mutating func removeAll() -> Void | |
| } | |
| extension NSUserDefaults: KeyValueStorable { | |
| subscript (key: String) -> AnyObject? { | |
| get { return self.objectForKey(key) } | |
| set { self.setObject(newValue, forKey: key) } |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'JSON' | |
| device_types = JSON.parse `xcrun simctl list -j devicetypes` | |
| runtimes = JSON.parse `xcrun simctl list -j runtimes` | |
| devices = JSON.parse `xcrun simctl list -j devices` | |
| devices['devices'].each do |runtime, runtime_devices| | |
| runtime_devices.each do |device| |
LLDB comes with a great set of commands for powerful debugging.
Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.
This file contains hidden or 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
| import Cocoa | |
| // for-in | |
| func checkForIn(array: [Int], dict: [Int: String]) { | |
| for num in array where dict[num] != nil { | |
| num | |
| } | |
| } | |
| checkForIn([1,2,3,4], dict: [1:"one", 2:"two"]) |
This file contains hidden or 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
| func fetchUserId() -> Observable<String> { | |
| return create{ (observer) -> Disposable in | |
| Client.fetchUserId() { [unowned self] | |
| (userId: String?, err: ErrorType?) -> Void in | |
| if let _ = err{ | |
| observer.on(Event.Error(err!)) | |
| } else { | |
| observer.on(Event.Next(userId)) | |
| observer.on(Event.Completed) | |
| } |
> Devices need sandboxes for agents. AI is coming into the real world. Humble devices gain superpowers when they host user code.
This file contains hidden or 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
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| import PlaygroundSupport | |
| typealias JSONDictionary = [String:Any] | |
| struct Resource<T> { | |
| let url :URL |
