Skip to content

Instantly share code, notes, and snippets.


Jason Milkins jasonm23

View GitHub Profile
View FakeKey.swift
// FakeKeyEvents.swift
// CutBox
// Created by Jason Milkins on 26/3/18.
// Copyright © 2019-2020 ocodo. All rights reserved.
import Foundation
import Carbon
jasonm23 / Pad
Last active May 16, 2020
SysEx for Behringer Motör 49 - Drum Pads - Aligned to C1..D#2 (Pads 17-32 repeat C1..D#2)
View Pad

Pad Fixer.syx file can be sent to a Behringer Motör 49 (and perhaps to other size models too?)

It will set the 8 drum pads to be lined up with C1 .. D#2

Use a SysEx librarian e.g. on Mac.

jasonm23 /
Last active Feb 13, 2019
Baseline of software engineering 101.

Programming is the art of telling another human what one wants the computer to do. — Donald Knuth

As Robert C. Martin stated in his book Clean Code: A Handbook of Agile Software Craftsmanship,

“Clean code is code that has been taken care of. Someone has taken the time to keep it simple and orderly. They have paid appropriate attention to details. They have cared.”

Why should you care? What’s wrong with code that just works?

Because software is never written once and finished. It needs to be enhanced, fixed, maintained, usually by more than one person.

jasonm23 /
Last active May 30, 2018
User interface tesing in macOS

UI Testing in Cocoa on macOS

Many times we are encouraged to write unit-tests, and decouple our UI from logic.

Do this, without a doubt, do it.

UI Testing should always be considered a second or third line of defence, to ensure that high level end-to-end integration is all a-ok.

jasonm23 / sample .json
Last active May 22, 2018 — forked from jonfuller/status.json
Transmission RPC
View sample .json
jasonm23 /
Last active May 20, 2018
Monitoring Progress of xcodebuild

Monitoring Progress of xcodebuild

While you can not update XCode's progress bar via an external process, you can generate a progress indicator of some sort in the MacOS menu bar using status items.

For example there's an OpenSource project called BitBar which can be used to create a status item menu using any scripting language (via #! / shebang.)

jasonm23 / JSContext+subscript.swift
Last active May 14, 2018
JSContext subscript access for Swift (works like Objective-C JSContext subscript)
View JSContext+subscript.swift
extension JSContext {
subscript(_ get: String) -> JSValue! {
get {
return self.objectForKeyedSubscript(get)
set { fatalError("get: cannot be used to set") }
subscript(_ set: String) -> Any! {
set {
jasonm23 / getRowViewGeneric.swift
Last active May 10, 2018
Generic function to get any class of NSView for a NSTableView
View getRowViewGeneric.swift
import Cocoa
// Use this as a helper function in your table view delegate.
func getRowView<T: NSView>(_ tableView: NSTableView) -> T {
let identifier = NSUserInterfaceItemIdentifier(
rawValue: "\(T.self)")
var dequeuedRowView: T? = tableView.makeView(
withIdentifier: identifier, owner: self