An Epicenter of Wordsmithing…for the Enterprise.
This file contains hidden or 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 | |
extension Array where Element == NSLayoutConstraint { | |
/// Activates each constraint in an array of `NSLayoutConstraint`. | |
/// | |
/// Example usage: `[view.heightAnchor.constraint(equalToConstant: 30), view.widthAnchor.constraint(equalToConstant: 30)].activate()` | |
func activate() { | |
NSLayoutConstraint.activate(self) | |
} |
This file contains hidden or 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
// Type-safe State Machine with Phantom Type May 2022 @AtarayoSD | |
import Foundation | |
protocol State {} | |
// Transitions | |
protocol TransferableToB {} | |
protocol TransferableToC {} | |
protocol TransferableToD {} |
This file contains hidden or 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
private let configKey = CodingUserInfoKey(rawValue: UUID().uuidString)! | |
private struct ConfigWrapper<Value> { | |
let value: Value | |
} | |
extension ConfigWrapper: Decodable where Value: DecodableWithConfiguration { | |
init(from decoder: Decoder) throws { | |
let config = decoder.userInfo[configKey]! as! Value.DecodingConfiguration | |
value = try Value(from: decoder, configuration: config) |
This file contains hidden or 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
extension Result { | |
public func `catch`(_ handler: () throws -> Success) -> Result<Success, Error> { | |
flatMapError { _ in | |
.init { try handler() } | |
} | |
} | |
public func `catch`(_ handler: (Failure) throws -> Success) -> Result<Success, Error> { | |
flatMapError { error in | |
.init { try handler(error) } |
This file contains hidden or 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
#!/usr/bin/env bash | |
source "./dock_functions.sh" | |
declare -a apps=( | |
'/System/Applications/Utilities/Terminal.app' | |
'/System/Applications/Music.app' | |
'/Applications/Google Chrome.app' | |
'/Applications/PhpStorm.app' | |
'/Applications/Visual Studio Code.app' |