Skip to content

Instantly share code, notes, and snippets.

@loganmoseley
loganmoseley / GenerateProcessTestCases.swift
Created January 29, 2022 13:39
Playground: Generating lots of test cases to look at Xcode test parallelization Raw
/*
Example without a Task
func testExample2() async throws {
env.testNumber = 12
if false {
try await Task.sleep(nanoseconds: NSEC_PER_MSEC * UInt64.random(in: 0...500))
}
XCTAssertEqual(env.caseNumber, 1)
XCTAssertEqual(env.testNumber, 12)
import SwiftUI
import UIKit
enum ScalableFont {
case system(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default)
case custom(_ name: String, size: CGFloat)
var size: CGFloat {
@loganmoseley
loganmoseley / transducer-type.swift
Last active October 18, 2020 16:57 — forked from mbrandonw/transducer-type.swift
How to get a transducer type without higher kinds
import Foundation
// A bunch of convenience things
func const <A, B> (_ b: B) -> (A) -> B {
return { _ in b }
}
func `repeat` <A> (_ n: Int) -> (A) -> [A] {
return { a in
Array(1...n).map(const(a))
}
@loganmoseley
loganmoseley / SketchSystems.spec
Last active October 25, 2018 22:06
Lifelinez iOS version 2-18
Lifelinez iOS version 2-18
Beginning
Lifeline menu -> Lifeline menu
Keyboard -> keyboard shortcut
Lifeline menu
Turn Autocheck ON-OFF -> toggleAutocheck
Check Square -> checkSelectedSquare
Check Word -> checkSelectedWord
Check Puzzle -> checkPuzzle
@loganmoseley
loganmoseley / SketchSystems.spec
Last active October 25, 2018 18:22
Lifelinez iOS version 2-17
Lifelinez iOS version 2-17
Beginning
Lifeline menu -> Lifeline menu
Keyboard -> Keyboard
Lifeline menu
Turn Autocheck ON-OFF -> toggleAutocheck
Check Square -> checkSelectedSquare
Check Word -> checkSelectedWord
Check Puzzle -> checkPuzzle
Puzzle
clear -> Clear?
Empty
guess -> Partial
reveal -> Reveal?
Partial
guess -> Partial
reveal -> Reveal?
solve -> Solved
Solved
@loganmoseley
loganmoseley / SketchSystems.spec
Last active June 6, 2018 18:20
Square State Flow
Square State Flow
type letter -> Bare Black
Bare
Bare Black
type letter -> Bare Black
check correct -> Bare Blue
check incorrect -> Slashed
reveal correct -> Bare Blue
reveal incorrect -> Red Flag Blue
Play Tab
person icon -> Account Settings
packs tab -> Packs Tab
SVM
puzzle -> Solving
pack -> Pack
Packs Tab
Root
pack -> Pack

Keybase proof

I hereby claim:

  • I am loganmoseley on github.
  • I am loganmoseley (https://keybase.io/loganmoseley) on keybase.
  • I have a public key ASAqZ07I9TVwSRKWycoYjTWsAYO2Yiuvl45MZivPkHkqJgo

To claim this, I am signing this object:

@loganmoseley
loganmoseley / ContainsSwitch.swift
Created January 26, 2018 00:27
Using `switch` to find a substring.
import Cocoa
struct Contains : ExpressibleByStringLiteral {
let s: String
static func ~= (l: Contains, r: Contains) -> Bool {
return r.s.contains(l.s)
}
init(_ c: String) {