Skip to content

Instantly share code, notes, and snippets.

View ddunbar's full-sized avatar

Daniel Dunbar ddunbar

View GitHub Profile
@ddunbar
ddunbar / extensible-raw-values.swift
Created August 12, 2016 18:11
Extensible enum raw values
import Foundation
struct X: Equatable, ExpressibleByStringLiteral {
let strings: Set<String>
init?(_ characters: String.CharacterView) {
let strings = Set<String>(String(characters).components(separatedBy: ",").map{ String($0) })
if strings.isEmpty {
return nil
}
$ cat ~/bin/status
#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: $(basename $0) <exit-code> <name ...>"
echo
echo "This script is intended to be used along with a shell alias"
echo "such as:"
echo " alias status='status $?'"
echo "which will automatically add the last exit code."