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
# https://gist.github.com/codexico/2a34c0d599f3af93b46f | |
[color] | |
# Use colors in Git commands that are capable of colored output when | |
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.) | |
ui = auto | |
[color "branch"] |
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
/**! Currently these two cause this warning: | |
This NSLayoutConstraint is being configured with a constant that exceeds internal limits. | |
A smaller value will be substituted, but this problem should be fixed. | |
Break on BOOL _NSLayoutConstraintNumberExceedsLimit(void) to debug. This will be logged only once. | |
This may break in the future. | |
*/ | |
extension UIStackView { | |
/// A vertical spacer view that will expand to fill the available space | |
fileprivate func verticalSpacer() -> UIView { | |
let v = UIView() |
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 | |
public class ScrollableStackView: UIView { | |
// MARK: Properties | |
private var didSetupConstraints = false | |
private lazy var scrollView: UIScrollView = { | |
let scrollView = UIScrollView(frame: .zero) |
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
#!/bin/bash | |
# add this function to your .bashrc or .zshrc and then run "source ~/.zshrc" | |
# - subcheckout param1 param2 | |
# by default subcheckout will change to develop in every submodule | |
# if you pass a first parameter it will checkout to that branch if exist on submodule | |
# if you pass a second parameter as default branch if the first branch not exists | |
function subcheckout() { | |
branch=${1:-develop} |
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
# GIT heart FZF | |
# ------------- | |
is_in_git_repo() { | |
git rev-parse HEAD > /dev/null 2>&1 | |
} | |
fzf-down() { | |
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@" | |
} |
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
#!/bin/zsh | |
cd "$(dirname "$0")/.." | |
if [[ -n "$CI" ]] || [[ $1 == "--fail-on-errors" ]] ; then | |
FAIL_ON_ERRORS=true | |
echo "Running in --fail-on-errors mode" | |
ERROR_START="" | |
COLOR_END="" | |
INFO_START="" |
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
[alias] | |
# full status | |
rstatus = !sh -c 'git status -sb --ignore-submodules=dirty && git submodule foreach --recursive git status -sb --ignore-submodules=dirty' - | |
rstatus-no-subs = !sh -c 'git status -sb --ignore-submodules=all && git submodule foreach --recursive git status -sb --ignore-submodules=all' - | |
s = !sh -c 'git rstatus-no-subs' - | |
# fetches all modules | |
rfetch = !sh -c 'git fetch && git submodule foreach --recursive git fetch' - | |
# updates project and all submodules | |
r-fetch-pull-merge = !sh -c 'git rfetch && git submodule foreach --recursive git merge && git merge && git s' - | |
r-fetch-pull-rebase = !sh -c 'git rfetch && git submodule foreach --recursive git rebase && git rebase && git s' - |
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
// Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this. | |
// The goal is basically to try to guarantee that every throwing function in the app throws an | |
// ApplicationError instead of some unknown error type. We can't actually enforce this statically | |
// But by following this convention we can simplify error handling | |
enum ApplicationError: Error, CustomStringConvertible { | |
// These are application-specific errors that may need special treatment | |
case specificError1 | |
case specificError2(SomeType) |
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
#!/bin/bash | |
# Put this file at: .git/hooks/post-checkout | |
# and make it executable | |
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587 | |
PREV_COMMIT=$1 | |
POST_COMMIT=$2 | |
NOCOLOR='\e[0m' |
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 | |
enum BetterDecodingError: CustomStringConvertible { | |
case dataCorrupted(_ message: String) | |
case keyNotFound(_ message: String) | |
case typeMismatch(_ message: String) | |
case valueNotFound(_ message: String) | |
case any(_ error: Error) |
NewerOlder