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
| extension Date { | |
| func usingFormat(_ format: String) -> String { | |
| let dateFormatter = DateFormatter() | |
| dateFormatter.dateFormat = format | |
| return dateFormatter.string(from: self) | |
| } | |
| } | |
| // Example | |
| // Date().usingFormat("yyyy-MM-dd'T'HHmmss") | |
| // "2018-02-19T16105" |
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
| Inside | Roof | Basement | |
|---|---|---|---|
| 02661 | 02554 | 01313 | |
| 02671 | 02565 | 01334 | |
| 02673 | 02566 | 01313 | |
| 02669 | 02567 | 01317 | |
| 02673 | 02565 | 01335 | |
| 02671 | 02568 | 01364 | |
| 02673 | 02565 | 01375 | |
| 02673 | 02565 | 01389 | |
| 02674 | 02567 | 01384 |
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
| extension AVCaptureVideoDataOutput { | |
| var availableVideoCVPixelFormatTypedEnums: [OSTypedEnum] { | |
| let availablePixelFormatDescriptions: Array<OSType> = self.availableVideoCVPixelFormatTypes as! Array<OSType> | |
| let availablePixelFormats: Array<OSTypedEnum> = availablePixelFormatDescriptions.map { OSTypedEnum(rawValue: $0)! } | |
| return availablePixelFormats | |
| } | |
| } | |
| enum OSTypedEnum: OSType { | |
| case monochrome1 = 1 |
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 | |
| public protocol Unit: CustomStringConvertible { | |
| var value: Double { get set } | |
| var baseSymbol: String { get } | |
| init(value: Double) | |
| } | |
| public extension Unit { |
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
| //: # Matrify | |
| //: | |
| //: Turn a list into a matrix | |
| import Cocoa | |
| let a = [1,2,3,4,5,6,7,8,9] | |
| func matrify(list: [Int], rowLength: Int) -> [[Int]] { | |
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 MathematicsProtocol: Equatable, Comparable, IntegerLiteralConvertible { | |
| init(_ value: Int) | |
| init(_ value: Float) | |
| init(_ value: Double) | |
| func +(lhs: Self, rhs: Self) -> Self | |
| func -(lhs: Self, rhs: Self) -> Self | |
| func * (lhs: Self, rhs: Self) -> Self | |
| func / (lhs: Self, rhs: Self) -> Self | |
| } |