Skip to content

Instantly share code, notes, and snippets.

--- Din sync 24 ppqn
-- input[1]: clock
-- input[2]: reset
-- output[1]: beats
-- output[2]: 16-th notes
-- output[3]: 4/3 kind of stuff for and|or|xor with output[2]
-- output[4]: five step sequence which advances on beat
function init()
local count = 0
local sequence = { 0.0, 3.7, 2.2, 0.8, 1.3 }
@P0ed
P0ed / Colors.swift
Last active August 23, 2019 11:03
Advanced color literals
import Fx
import UIKit
public struct RGBA {
var r: UInt8
var g: UInt8
var b: UInt8
var a: UInt8
}
infix operator ?= : AssignmentPrecedence
func ?= <A>(lhs: inout A, rhs: A?) {
if let value = rhs {
lhs = value
}
}
func ?= <A>(lhs: inout A?, rhs: A?) {
if let value = rhs {
import Foundation
public protocol JSONDecodable {
init(json: JSON) throws
}
public protocol JSONContainer {
func get() throws -> JSON
}