- You must have BuildKit enabled in Docker.
- You must have
~/.ssh/config
set up with a proper alias for the server you want to access via SSH. - When referencing external resources via SSH, always use a proper domain name, never an SSH alias. In other words, use something like
git@github.com:foo/bar
. - Use the latest
Dockerfile
syntax using# syntax=docker/dockerfile:1.x
at the top.
This file contains 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
-- Inspired by https://wiki.postgresql.org/wiki/Sprintf, | |
-- but really, pretty different. | |
CREATE FUNCTION sprintf(_format TEXT, VARIADIC _args ANYARRAY) RETURNS TEXT | |
LANGUAGE PLPGSQL | |
STRICT IMMUTABLE | |
AS $$ | |
DECLARE _f INT DEFAULT 0; -- Index of current character in format string | |
DECLARE _c TEXT; -- Current character | |
DECLARE _match TEXT; | |
DECLARE _matches TEXT[]; |
This file contains 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 RxCocoa | |
import RxSwift | |
import UIKit | |
extension Reactive where Base: UIView { | |
var isFirstResponder: Observable<Bool> { | |
return Observable | |
.merge( | |
methodInvoked(#selector(UIView.becomeFirstResponder)), | |
methodInvoked(#selector(UIView.resignFirstResponder)) |
This file contains 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
typealias Deserializer<I, O> = (I) -> O? | |
typealias JsonDeserializer<I, O> = (Json) -> Deserializer<I, O> | |
typealias JsonElementDeserializer = JsonDeserializer<JsonElement, JsonElement> | |
private fun <I, O> const(deserializer: Deserializer<I, O>): JsonDeserializer<I, O> = { | |
deserializer | |
} | |
infix fun <A, B, C> JsonDeserializer<A, B>.j( | |
next: JsonDeserializer<B, C> |
This file contains 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 UIKit | |
open class KeyboardAvoidingViewController: UIViewController { | |
private var observers: [NSObjectProtocol] = [] | |
open override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
let nc = NotificationCenter.default |
This file contains 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
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TupleSections #-} |
This file contains 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
enum CreationPolicy { | |
case Single | |
case Shared | |
} | |
class Resolver { | |
private struct Instance { | |
private let policy: CreationPolicy | |
private let create: () -> Any | |
private var instance: Any? |
This file contains 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
// | |
// DependencyResolver.swift | |
// | |
// Created by Gregory Higley on 2/15/16. | |
// Copyright © 2016 Revolucent LLC. | |
// | |
// This file is released under the MIT license. | |
// https://gist.github.com/Revolucent/25daa75bda879dd20bb2 | |
// |
This file contains 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 ReSwift | |
import RxSwift | |
private class StoreObserver<SelectedState>: StoreSubscriber { | |
private let onNext: (SelectedState) -> Void | |
init(onNext: @escaping (SelectedState) -> Void) { | |
self.onNext = onNext | |
} | |
func newState(state: SelectedState) { |
This file contains 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 parse from 'obj-parse' | |
/* | |
In its simplest usage, mapStateToProps('foo', 'bar') | |
maps the state keys 'foo' and 'bar' to keys of the same | |
name in the props. | |
To alias, use an object literal: mapStateToProps('foo', {baz: 'bar.buzz'}). | |
In this case, we're mapping state that's more deeply nested to the 'baz' prop. | |
The parse method of obj-parse takes care of this for us. |
NewerOlder