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
function prompt_metal_ctx() { | |
p10k segment -f white -t "$(metal ctx show-current)" | |
} | |
function prompt_metalctl_ctx() { | |
p10k segment -f white -t "$(metalctl ctx short)" | |
} | |
function prompt_cloudctl_ctx() { | |
p10k segment -f white -t "$(cloudctl ctx short)" | |
} |
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
function psqlhere() { | |
local CURRENT_BASENAME=$(basename "$PWD") | |
echo -e "\e[1;32mDATABASE_URL postgres://$CURRENT_BASENAME:$CURRENT_BASENAME@localhost/$CURRENT_BASENAME\e[0m"; | |
docker run --rm \ | |
--env POSTGRES_USER=$CURRENT_BASENAME \ | |
--env POSTGRES_DB=$CURRENT_BASENAME \ | |
--env POSTGRES_PASSWORD=$CURRENT_BASENAME \ | |
--publish 5432:5432 \ | |
--name "psql-$CURRENT_BASENAME" \ | |
--tty --interactive \ |
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://github.com/JohnSundell/Files.git |
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 RxBlocking | |
import RxSwift | |
import Result | |
/// `BlockingResultObservables` provide convenience methods for gaining a `Result` out of `Observables`. | |
/// | |
/// It may be useful for testing purposes | |
/// or for preventing CLIs to be terminated too early, | |
/// but usually you should not use it in production code. | |
/// |
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 | |
export ROCK_PATH="$HOME/.rock" # default | |
export PATH="$PATH:./.rock/bin:$ROCK_PATH/bin" | |
if [ -f "$ROCK_PATH/sources/rock" ]; then | |
cd $ROCK_PATH/sources/rock | |
git pull | |
else | |
git clone --depth 1 https://github.com/vknabel/rock $ROCK_PATH/sources/rock |
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
public extension AnyHashable { | |
public init(value: V, compare: @escaping (V, V) -> Bool, hash: @escaping (V) -> Int) { | |
self.init(CustomHashable(value: value, compare: compare, hash: hash)) | |
} | |
} |
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 extension UIImage { | |
public func imageWithColor(color: UIColor) -> UIImage { | |
UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) | |
let context: CGContextRef = UIGraphicsGetCurrentContext() | |
CGContextTranslateCTM(context, 0, self.size.height) | |
CGContextScaleCTM(context, 1.0, -1.0) |
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 CoreData | |
/** | |
* This is a generic source for all CoreData based sources. Subclass to focus on essentials. | |
*/ | |
public class CoreDataSource { | |
let modelURL: NSURL | |
let storeURL: NSURL | |
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 | |
import AVFoundation | |
public extension AVCaptureVideoOrientation { | |
public init(interfaceOrientation: UIInterfaceOrientation) { | |
switch interfaceOrientation { | |
case .Unknown: | |
self = .LandscapeLeft | |
case .Portrait: |
NewerOlder