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
// | |
// Postgres+Transaction.swift | |
// | |
// Created by Mihael Isaev on 14.01.2020. | |
// | |
import Vapor | |
import FluentKit | |
import PostgresKit |
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 | |
import SwiftUI | |
let isUITesting = /* your UI test detection here */ | |
@main | |
struct EntryPoint { | |
static func main() { | |
if isUITesting { | |
UITestApp.main() |
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
public typealias LosslessStringCodable = LosslessStringConvertible & Codable | |
@propertyWrapper | |
public struct LosslessCodable<Value: LosslessStringCodable>: Codable { | |
private let type: LosslessStringCodable.Type | |
public var wrappedValue: Value | |
public init(wrappedValue: Value) { | |
self.wrappedValue = wrappedValue |
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 | |
public extension Dictionary where Key == String, Value == Any { | |
fileprivate func _get<T>(path: [String]) -> T? { | |
var root = self | |
for idx in 0 ..< path.count - 1 { | |
guard let _root = root[path[idx]] as? [String: Any] else { | |
return nil | |
} |
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
/// A rotating 3-D cube in terminal | |
/// Only works on macOS | |
/// Run `swift cube.swift` in a terminal application to run it. | |
/// For controlling the cube, see comments for `Key` in code. | |
import Darwin | |
enum RawModeError: Error { | |
case notATerminal | |
case failedToGetTerminalSetting |
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
// THIS IS A UNIVERSAL SWIFT FUNCTION BIULDER | |
// FOR ARRAYS OF ANY TYPE | |
// tested on Swift 5.3.1 | |
@_functionBuilder | |
public enum ArrayBuilder<Element> { | |
public typealias Expression = Element | |
public typealias Component = [Element] |
OlderNewer