Skip to content

Instantly share code, notes, and snippets.

View tkersey's full-sized avatar
👹

Tim Kersey tkersey

👹
View GitHub Profile
@tkersey
tkersey / algebraic-effects-series-4.md
Created June 30, 2023 22:33 — forked from yelouafi/algebraic-effects-series-4.md
Implementing Algebraic Effects and Handlers

Algebraic Effects in JavaScript part 4 - Implementing Algebraic Effects and Handlers

This is the final part of a series about Algebraic Effects and Handlers.

So we've come to the core topic. The reality is that we've already covered most of it in the previous parts. Especially, in the third part, where we saw delimited continuations at work.

@tkersey
tkersey / cli.txt
Created May 29, 2023 16:22
macOS format SD card for Miyoo Mini Plus
sudo diskutil eraseDisk FAT32 SDCARD MBRFormat /dev/disk2
@tkersey
tkersey / CoC.ml
Created February 25, 2023 22:50 — forked from Hirrolot/CoC.ml
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)
@tkersey
tkersey / youtube.md
Created January 28, 2023 19:15 — forked from bitsurgeon/youtube.md
Markdown cheatsheet for YouTube

Embed YouTube Video in Markdown File

  1. Markdown style
[![Watch the video](https://img.youtube.com/vi/nTQUwghvy5Q/default.jpg)](https://youtu.be/nTQUwghvy5Q)
  1. HTML style
<a href="http://www.youtube.com/watch?feature=player_embedded&v=nTQUwghvy5Q" target="_blank">
@tkersey
tkersey / HowTo use xcconfig or plist with SPM.md
Created November 30, 2022 15:39 — forked from 4np/HowTo use xcconfig or plist with SPM.md
How to use a .xcconfig file and a .plist with a Swift Package Manager based project.

How to use a .xcconfig file and a .plist file with SPM

Worth a read for some more context.

Create a Package.xcconfig file

Create the file in the root of the project (where your Package.swift file lives as well), and use the following contents:

/// Package.xcconfig
@tkersey
tkersey / Combinators.swift
Created November 28, 2022 15:41 — forked from danielt1263/Combinators.swift
A list of combinators
func apply<A, B>(fn: (A) -> B, a: A) -> B {
fn(a)
}
func bluebird<A, B, C>(fn1: (A) -> B, fn2: (C) -> A, c: C) -> B {
fn1(fn2(c))
}
func blackbird<A, B, C, D>(fn1: (C) -> D, fn2: (A, B) -> C, a: A, b: B) -> D {
@tkersey
tkersey / xcode-vim.markdown
Created November 16, 2022 16:40 — forked from gdavis/xcode-vim.markdown
Notes for working with Xcode VIM mode

Xcode VIM

This document is a scratchpad for helping me learn commonly used actions in Xcode's VIM mode.

Commands are case-sensitive. A command of N means pressing shift + n on the keyboard.

[Formatting is a WIP]


Normal Mode Commands

Basic Navigation

@tkersey
tkersey / equals.swift
Created October 26, 2022 17:00
Existential equality
public func equals(_ lhs: Any, _ rhs: Any) -> Bool {
func open<A: Equatable>(_ lhs: A, _ rhs: Any) -> Bool {
type(of: rhs) == A.self && lhs == (rhs as? A)
}
guard let lhs = lhs as? any Equatable else { return false }
return open(lhs, rhs)
}
@tkersey
tkersey / cli.md
Created July 14, 2022 15:24
Useful macOS command line commands

Download full installer

softwareupdate --fetch-full-installer --full-installer-version 13.0

Create USB installer

sudo /Applications/Install\ macOS\ Ventura\ beta.app/Contents/Resources/createinstallmedia --volume /Volumes/Installer --nointeraction

@tkersey
tkersey / CoW.swift
Created July 8, 2022 02:12
Reducing stack costs of structs by using Copy on Write (CoW)
@dynamicMemberLookup
struct CoW<T> {
init(_ value: T) {
_storage = Storage(value)
}
public subscript<V>(dynamicMember keyPath: WritableKeyPath<T, V>) -> V {
get { value[keyPath: keyPath] }
set { value[keyPath: keyPath] = newValue }
}
var value: T {