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 HTTP | |
| import Vapor | |
| public protocol SideEffect { | |
| func perform() throws | |
| } | |
| public protocol Command: ResponseRepresentable { | |
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 FluentProvider | |
| extension Config { | |
| public func setup() throws { | |
| // ... | |
| addConfigurable(command: DailyCommand.init, name: "daily") | |
| } | |
| // ... | |
| } |
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
| <? | |
| // | |
| // [ BUY BTC & ETH DAILY ON BITSTAMP ] | |
| // by @levelsio | |
| // | |
| // 2017-08-23 | |
| // | |
| // 1) buy $40/day BTC | |
| // 2) buy $10/day ETH | |
| // |
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
| #ifdef GL_ES | |
| precision mediump float; | |
| precision mediump int; | |
| #endif | |
| varying vec4 vertColor; | |
| varying vec3 vertNormal; | |
| varying vec3 vertLightDir; | |
| varying vec4 vertTexCoord; |
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 Fluent | |
| func fetchChildren<Parent, ParentID, Child: Model, Result>( | |
| of parents: [Parent], | |
| idKey: KeyPath<Parent, ParentID?>, | |
| via reference: KeyPath<Child, ParentID>, | |
| on conn: DatabaseConnectable, | |
| combining: @escaping (Parent, [Child]) -> Result) -> Future<[Result]> where ParentID: Hashable & Encodable { | |
| let parentIDs = parents.compactMap { $0[keyPath: idKey] } | |
| let children = Child.query(on: conn) |
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
| // Douglas Hill, December 2018 | |
| // Made for https://douglashill.co/reading-app/ | |
| // Find the latest version of this file at https://github.com/douglashill/KeyboardKit | |
| import UIKit | |
| /// A table view that allows navigation and selection using a hardware keyboard. | |
| /// Only supports a single section. | |
| class KeyboardTableView: UITableView { | |
| // These properties may be set or overridden to provide discoverability titles for key commands. |
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 UIKit | |
| struct ViewStyle<T> { | |
| let style: (T) -> Void | |
| } | |
| let filled = ViewStyle<UIButton> { | |
| $0.setTitleColor(.white, for: .normal) | |
| $0.backgroundColor = .red |
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 Combine | |
| import ReactiveSwift | |
| import SwiftUI | |
| class AnySubscription: Subscription { | |
| private let cancelable: Cancellable | |
| init(cancelable: Cancellable) { | |
| self.cancelable = cancelable |
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 UIKit | |
| import SwiftUI | |
| import Combine | |
| class NutrientModel: Progressable { | |
| var willChange = PassthroughSubject<BaseNutrient, Never>() | |
| var id = UUID.init() | |
| var name: String |
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 SwiftUI | |
| import Combine | |
| struct AdaptsToSoftwareKeyboard: ViewModifier { | |
| @State var currentHeight: CGFloat = 0 | |
| func body(content: Content) -> some View { | |
| content | |
| .padding(.bottom, currentHeight) | |
| .edgesIgnoringSafeArea(.bottom) |