Skip to content

Instantly share code, notes, and snippets.

View MihaelIsaev's full-sized avatar
⌨️
developing Swift for Web

Mikhail Isaev aka iMike MihaelIsaev

⌨️
developing Swift for Web
View GitHub Profile
@MihaelIsaev
MihaelIsaev / fluent4+automigration.swift
Last active January 16, 2020 01:11
Fluent4 model with automigration example (automigration like in Fluent3)
// configure.swift
func configure(_ app: Application) throws {
app.migrations.add(Todo(), to: .psql)
try app.migrator.setupIfNeeded().wait()
try app.migrator.prepareBatch().wait()
}
// Todo.swift
final class Todo: Model, Content {
import FluentKit
import Vapor
final class Todo: Model, Content {
static let schema = "todos"
@iID(key: "id", .uuid, .identifier(auto: false))
var id: UUID?
@iField(key: "title", .string, .required)
// Enum Protocol
public protocol PostgresEnum: RawRepresentable, Codable, CaseIterable, PostgresDataConvertible {
static var name: String { get }
}
extension PostgresEnum {
static var name: String { String(describing: self).lowercased() }
}
@MihaelIsaev
MihaelIsaev / Postgres+Transaction.swift
Last active January 16, 2020 01:34
Postgres transaction extension for Vapor4 and Fluent4
//
// Postgres+Transaction.swift
//
// Created by Mihael Isaev on 14.01.2020.
//
import Vapor
import FluentKit
import PostgresKit
@MihaelIsaev
MihaelIsaev / multiple_ssh_setting.md
Created January 21, 2020 21:14 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@MihaelIsaev
MihaelIsaev / gist:4015acb7d9e3a937f4ad4c420c50d24f
Created February 2, 2020 23:22 — forked from v-thomp4/gist:951b333a37ee2adb0d3ac557bd75aba4
nginx universal links apple-app-site-association
location = /apple-app-site-association {
proxy_pass http://static.example.com/apple-app-site-association;
proxy_hide_header Content-Type;
add_header Content-Type "application/json";
}
or
location = apple-app-site-association {
default_type application/json;
import Vapor
public protocol FutureParameter {
associatedtype ResolvedParameter
static var routingSlug: String { get }
static var parameter: PathComponent { get }
static func resolveParameter(_ parameter: String, on app: Application) -> EventLoopFuture<ResolvedParameter>
}
//
// Reflectable
//
// Copied from https://github.com/vapor/core
//
import Foundation
import NIO
struct CoreError: Error {
@MihaelIsaev
MihaelIsaev / UIKitPlus-TabBarImplementation.swift
Created June 26, 2020 11:13
Custom TabBar implementation for UIKitPlus. Not beautiful cause not wrapped, just sources. But it works well.
import UIKitPlus
class MainViewController: ViewController {
override var statusBarStyle: StatusBarStyle {
if let controller = controllers[current]?.protocolController {
if let controller = controller as? ViewController {
return controller.statusBarStyle
}
return .from(controller.preferredStatusBarStyle)
}
@MihaelIsaev
MihaelIsaev / ARMDebianUbuntu.md
Created September 5, 2020 01:32 — forked from Liryna/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux