This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef git gitk | |
# zsh completion wrapper for git | |
# | |
# Copyright (c) 2012-2020 Felipe Contreras <[email protected]> | |
# | |
# The recommended way to install this script is to make a copy of it as a | |
# file named '_git' inside any directory in your fpath. | |
# | |
# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare namespace JSX { | |
type ElementTagNameMap = HTMLElementTagNameMap & | |
SVGElementTagNameMap & | |
MathMLElementTagNameMap; | |
type Element<K extends keyof ElementTagNameMap = 'div'> = { | |
[A in keyof ElementTagNameMap[K]]: ElementTagNameMap[K][A]; | |
}; | |
type IntrinsicElements = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Date difference in seconds | |
// Calculating the date difference in seconds is as simple as subtracting the two Date objects and dividing by the number of milliseconds in a second (1000). | |
const dateDifferenceInSeconds = (dateInitial: Date, dateFinal: Date) => | |
(dateFinal - dateInitial) / 1_000; | |
dateDifferenceInSeconds( | |
new Date('2020-12-24 00:00:15'), | |
new Date('2020-12-24 00:00:17') | |
); // 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Path<T extends unknown[]> = T extends [ | |
infer A, | |
infer B, | |
infer C, | |
infer D, | |
infer E, | |
infer F, | |
infer G, | |
infer H, | |
infer I |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function deepValue<T extends object, P1 extends keyof T>( | |
value: T, | |
...path: [P1] | |
): T[P1]; | |
export function deepValue< | |
T extends object, | |
P1 extends keyof T, | |
P2 extends keyof T[P1] | |
>(value: T, ...path: [P1, P2]): T[P1][P2]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const create = <K extends keyof HTMLElementTagNameMap>( | |
name: K, | |
attrs: Partial<HTMLElementTagNameMap[K]> = {}, | |
...children: Element[] | |
): HTMLElementTagNameMap[K] => { | |
const el = document.createElement(name); | |
el.append(...children); | |
return Object.assign(el, attrs); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {determineValue} from './utilities' | |
import type {Primitive} from './types' | |
export class Bit<T extends Primitive> extends Text { | |
constructor(public initialValue: T) { | |
super(initialValue.toLocaleString()) | |
} | |
set = (value: T) => { | |
this.textContent = value.toLocaleString() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ElementType, TagsByType} from '../types' | |
const ns = { | |
html: 'http://www.w3.org/1999/xhtml', | |
svg: 'http://www.w3.org/2000/svg', | |
mathMl: 'http://www.w3.org/1998/Math/MathML', | |
} | |
export function createElement< | |
Type extends ElementType, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type HTMLs = HTMLElementTagNameMap | |
export type SVGs = SVGElementTagNameMap | |
export type MathMLs = MathMLElementTagNameMap | |
export type Tags = keyof (HTMLs | SVGs | MathMLs) | |
export type HTMLByTag<K extends keyof HTMLs> = HTMLs[K] | |
export type SVGByTag<K extends keyof SVGs> = SVGs[K] | |
export type MathMLByTag<K extends keyof MathMLs> = MathMLs[K] |