Run an image in a new container daemonized
$ sudo docker run -d <image_name>
Run an image in interactive mode with the command /bin/bash
$ sudo docker run -i -t <image_name> /bin/bash
#!/usr/bin/swift sh | |
import Foundation | |
import XcodeProj // @tuist | |
import PathKit | |
/// INSTRUCTIONS | |
/// install swift-sh on your mac, more info here 👉 https://github.com/mxcl/swift-sh | |
/// make this file executable $ chmod u+x AddBuildPhase.swift | |
/// then just run the file $ ./AddBuildPhase.swift |
@propertyWrapper | |
public struct Field<Value: DatabaseValue> { | |
public let name: String | |
private var record: DatabaseRecord? | |
private var cachedValue: Value? | |
public init(name: String) { | |
self.name = name | |
} |
struct FailableDecodable<Base: Decodable>: Decodable { | |
var base: Base? | |
init(from decoder: Decoder) throws { | |
let container = try decoder.singleValueContainer() | |
do { | |
base = try container.decode(Base.self) | |
} catch let error { | |
print(error) | |
} |
var array: [EventLoopFuture<T?>] = [] | |
// do whatever to add futures to this array | |
EventLoopFuture<[T]>.reduce(into: [], array, on: eventLoop) { | |
if let value = $1 { | |
$0.append(value) | |
} | |
} |
import NStack | |
import Vapor | |
import Sugar | |
protocol Translatable { | |
var translationKey: String { get } | |
} | |
extension AuthenticationError: Translatable { | |
var translationKey: String { |
Run an image in a new container daemonized
$ sudo docker run -d <image_name>
Run an image in interactive mode with the command /bin/bash
$ sudo docker run -i -t <image_name> /bin/bash
// The Model | |
final class User<D>: Model where D: Database & QuerySupporting { | |
typealias Database = D | |
typealias ID = Int | |
static var idKey: IDKey { return \.id } | |
var id: Int? | |
var name: String | |
var email: String |
// The Model | |
final class User: Model { | |
typealias Database = MySQLDatabase /// the problem is this line | |
typealias ID = Int | |
static var idKey: IDKey { return \.id } | |
var id: Int? | |
var name: String | |
var email: String |
let begin = clock() | |
// DO SOMETHING | |
let diff = Double(clock() - begin) / Double(CLOCKS_PER_SEC) | |
print("Execution time: \(diff)") |
root@743f9944e259:/VaporTest# /usr/bin/swift-build-tool -f /VaporTest/.build/debug.yaml -v | |
/usr/bin/swiftc -target armv7-unknown-linux-gnueabihf -sdk / -g -L /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug -o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/Run -module-name Run -emit-executable -Xlinker '-rpath=$ORIGIN' /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/app.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/boot.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/configure.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/Controllers/TodoController.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/Models/Todo.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/App.build/Routes.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/Async.build/Async+NIO.swift.o /VaporTest/.build/armv7-unknown-linux-gnueabihf/debug/Async.build/AsyncError.swift.o /VaporTest/.build/armv7-u |