I hereby claim:
- I am willfrew on github.
- I am willfrew (https://keybase.io/willfrew) on keybase.
- I have a public key ASA4IO6Vi08zXIQLyvZsh820Df09RbzO7jfpx3-UWMhYego
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Ever since the get
and set
keywords came to Javascript / Typescript, I've felt uneasy about them. Something about their nature of hiding computation in what appears to be data never really sat well with me. In some projects, I knee-jerk banned them with lint rules but unfortunately I never really thought deeply about why.
Let's start with some assertions:
describe('convert number to arbitrary base-system coefficients', () => { | |
const truncateToFixed = (num: number, maxFractionalDigits: number): number => { | |
const multiplier = Math.pow(10, maxFractionalDigits); | |
return Math.floor(num * multiplier) / multiplier; | |
} | |
const toBaseCoefficients = (num: number, base: number): (number | '.')[] => { | |
const maxFractionalDigits = 10; | |
let coefficients = []; |
I hereby claim:
To claim this, I am signing this object:
type Head<T extends unknown[]> = T[0]; | |
type FnWithArgs<T extends unknown[]> = (...args: T) => void; | |
type TailArgs<T> = T extends (x: unknown, ...args: infer T) => unknown ? T : never; | |
type Tail<T extends unknown[]> = TailArgs<FnWithArgs<T>>; | |
// Lol | |
type Decr<T extends number> = | |
T extends 10 ? 9 : | |
T extends 9 ? 8 : |
<!DOCTYPE html> | |
<html> | |
<head></head> | |
<body> | |
<script> | |
(function() { | |
// 1 or 2 | |
let i = Math.round(Math.random()) + 1 | |
export interface Foo<T> { | |
(bar: Bar<T>): void; | |
} | |
export interface Bar<T> { | |
(foo: Foo<T>): Foo<T>; | |
} | |
function createBar<T>(): Bar<T> { | |
return (f) => f; |
(Forked from: https://gist.github.com/cahna/45bb9eee92c5f1fce66f)
When using ArchLinux, I typically prefer to use an AUR helper like pacaur or yaourt to automate away the process of installing a community package.
Ansible's pacman module is
great, but it doesn't support AUR packages or pacman's -U
flag.