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
| // countries, states and subdivisions were generated relying on next documents: | |
| // http://www.iso.org/iso/country_names_and_code_elements | |
| // http://www.unece.org/cefact/locode/welcome.html | |
| var countriesAndStates = [ | |
| {"Country":"AD","State":"Canillo"}, | |
| {"Country":"AD","State":"Encamp"}, | |
| {"Country":"AD","State":"La Massana"}, | |
| {"Country":"AD","State":"Ordino"}, | |
| {"Country":"AD","State":"Sant Julià de Lòria"}, |
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
| enum Generic<T> { | |
| case Some(T) | |
| init(_ x: T) { | |
| self = .Some(x) | |
| } | |
| func flatMap<U>(@noescape f: (T) throws -> Generic<U>) rethrows -> Generic<U> { | |
| switch self { | |
| case .Some(let x): |
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
| { | |
| "name": "NSLogger", | |
| "version": "1.7.1", | |
| "license": "BSD", | |
| "summary": "A modern, flexible logging tool.", | |
| "homepage": "https://github.com/fpillet/NSLogger", | |
| "authors": { | |
| "Florent Pillet": "fpillet@gmail.com" | |
| }, | |
| "source": { |
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 Foundation | |
| // MARK: - Commons Level | |
| protocol Cancellable { | |
| func cancel() | |
| } | |
| enum Result<T, E: Error> { | |
| case success(T) |
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 swap = Tape Nil EnterLoop ( Cons MoveRight -- → | |
| $ Cons EnterLoop -- [ | |
| $ Cons Decrement -- - | |
| $ Cons MoveRight -- → | |
| $ Cons Increment -- + | |
| $ Cons MoveLeft -- ← | |
| $ Cons ExitLoop -- ] | |
| $ Cons MoveLeft -- ← | |
| $ Cons EnterLoop -- [ | |
| $ Cons Decrement -- - |
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
| extensions UIViewController | |
| func removeChildViewController(childViewController: UIViewController) { | |
| childViewController.willMoveToParentViewController(nil) | |
| childViewController.view.removeFromSuperview() | |
| childViewController.removeFromParentViewController() | |
| } | |
| } |
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 s<A, B, C>(_ f: @escaping (A) -> (B) -> C) -> (@escaping (A) -> B) -> (A) -> C { | |
| return { g in { x in f(x)(g(x)) } } | |
| } | |
| func k<A, B>(_ x: A) -> (B) -> A { | |
| return { _ in x } | |
| } | |
| func i<A>(_ x: A) -> A { | |
| return x |
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
| enum S { | |
| case a, b | |
| } | |
| struct MapOfS<T> { | |
| private var a: T, b: T | |
| subscript(_ s: S) -> T { | |
| get { | |
| switch s { |
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
| class ReadWriteQueue { | |
| private let specificKey = DispatchSpecificKey<String>() | |
| private let queue: DispatchQueue | |
| private var isAlreadyInQueue: Bool { | |
| return DispatchQueue.getSpecific(key: specificKey) == queue.label | |
| } | |
| init(label: String = "read-write.queue") { | |
| queue = DispatchQueue(label: label, attributes: .concurrent) |
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
| // MARK: - Read-Write Queue | |
| class ReadWriteQueue { | |
| private let specificKey = DispatchSpecificKey<String>() | |
| private let queue: DispatchQueue | |
| private var isAlreadyInQueue: Bool { | |
| return DispatchQueue.getSpecific(key: specificKey) == queue.label | |
| } |
OlderNewer