Skip to content

Instantly share code, notes, and snippets.

View peterhudec's full-sized avatar

Peter Hudec peterhudec

View GitHub Profile
@peterhudec
peterhudec / index.ts
Created October 10, 2023 11:36
TypeScript Generics Proposal
type Func = (...args: any) => any
type FP = <T>(...params: [T, T]) => void
type FPA = <T>(a: [T, T]) => void
type FPO = <T>(o: {x: T, y: T}) => void
type FPF = <T extends Func>(f: T, p: Parameters<T>) => void
type FNested = <T>(x: T, y: T) =>
<TT>(x: TT, y: TT, z: [T, TT]) => void
type FRA = <T>() => [T, T]
@peterhudec
peterhudec / fx-asset-classes.ts
Created December 14, 2021 13:43
FX Asset Classes Typing
type Currency = 'USD' | 'EUR' | 'CZK'
type PreciousMetal = `X${ 'AG' | 'AU' | 'PD' | 'PT' }`
type Treasury = `T${`0${ 2 | 3 | 5 | 7 }` | `${ 1 | 2 | 3 }0`}`
type CurrencyCurrency = `${Currency}${Currency}`
type PreciousMetalCurrency = `${PreciousMetal}${Currency}`
type TreasuryCurrency = `${Treasury}${Currency}`
type InstrumentNames = CurrencyCurrency | PreciousMetalCurrency | TreasuryCurrency
@peterhudec
peterhudec / .gitconfig
Created December 10, 2021 14:37
.gitconfig
[user]
name = Peter Hudec
email = [email protected]
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:'%h %C(yellow)%ad%Creset [%C(blue)%an%Creset] %C(red)%d%Creset %C(green)%s%Creset' --graph --date=short --color