Skip to content

Instantly share code, notes, and snippets.

View iki's full-sized avatar

Jan Killian iki

View GitHub Profile
@iki
iki / curry.ts
Last active August 24, 2022 12:39
Dynamic function arguments currying in TypeScript
// Dynamic function arguments currying in TypeScript
// - For functions with any fixed arguments it keeps currying the function
// until all fixed arguments are provided, then returns the result
// - For functions with dynamic arguments only it keeps currying the function
// as long as the call provides any spices, otherwise returns the result
// - Source: https://gist.github.com/iki/6472c0775cc0847fc667c01524cafa6b
type Args = readonly unknown[]
type Func<A extends Args = any[], R = any> = (...args: A) => R
type Slices<A extends Args, I extends Args = []> = A extends readonly [infer F, ...infer R]
@iki
iki / README.md
Last active April 26, 2023 10:08
Select list items in React
@iki
iki / README.md
Last active November 7, 2023 08:50
Simple DevOps shell library for Linux/Mac/Windows

Simple DevOps shell library for Linux/Mac/Windows

Usage: devops [options] <command> [args]

Sourcing:
  Sourcing script defines functions and passes entrypoint function to init.

  Samples when devops is located in the same/relative/absolute path:
    . "`dirname "${BASH_SOURCE[0]}"`/devops" && init <entrypoint> "$@"