Skip to content

Instantly share code, notes, and snippets.

View donarb's full-sized avatar

Don Arbow donarb

View GitHub Profile
@donarb
donarb / GitCloneHere.sh
Last active January 31, 2024 00:41
Automator service to clone Git repos in Mac Finder
# Use this to quickly create a git repo in a Mac Finder folder
#
# You need to create an Automator service:
# - Open Automator, choose to create a new Service
# - At the top, select Service receives selected "Folders" in "Finder"
# - From the list at the left, choose Library/Utilities, then drag the
# Run Shell Script action to the workarea
# - Paste the script below into the script area
# - Make sure you set the 'Pass input:' selection to "as arguments"
# - Save the service with an easy to find name, I used "Git Clone Here"
@donarb
donarb / verhoeff_alpha.py
Last active February 16, 2016 05:29
Python version of Verhoeff alphanumeric check digit algorithm
#!/usr/bin/env python
"""
Python port of alphanumeric derivative of Verhoeff check digit algorithm.
Ported from: https://gist.github.com/mwgamera/1088656
"""
N = 18
N2 = N * 2
//
// Note: This is coded for an XCode Swift playground
//
import Foundation
//
// Using the last 15 characters of a FedEx ground "96" barcode, determine the check digit.
//
// From page 38 of
@donarb
donarb / ProtocolAssociatedType.swift
Created February 2, 2017 06:05 — forked from troystribling/ProtocolAssociatedType.swift
A swift protocol with associated type used as type parameter in generic function
protocol Thing {
typealias argType
func doit(val:argType) -> argType
}
class IntThing : Thing {
func doit(val: Int) -> Int {
return val + 1
}
}
@donarb
donarb / Hexagon Ripple.swift
Last active February 16, 2017 02:38 — forked from d-ronnqvist/Hexagon Ripple.swift
Hexagon Ripple in a Swift Playground
//: Modified for Swift 3
import Cocoa
import AppKit
import QuartzCore
import PlaygroundSupport
// Parameters that define the style
let hexSideLength: CGFloat = 15.0
@donarb
donarb / cave.playground
Created March 5, 2019 21:54
Swift playground implementation of random dungeon generator
// ported from https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604
//
// can be run in a Swift playground
import Cocoa
let HEIGHT = 40
let WIDTH = 80
var FIELD: [[Character]] = Array(repeating: Array(repeating: " ", count: WIDTH), count: HEIGHT)