Skip to content

Instantly share code, notes, and snippets.

View miZyind's full-sized avatar

miZyind miZyind

View GitHub Profile
@miZyind
miZyind / get-valuable.ts
Last active April 12, 2024 14:56
A helper function to remove blank attributes from an object in TypeScript with type-safe
type Valuable<T> = { [K in keyof T as T[K] extends null | undefined ? never : K]: T[K] };
function getValuable<
// eslint-disable-next-line @typescript-eslint/ban-types
T extends {},
V = Valuable<T>,
>(obj: T): V {
return Object.fromEntries(
Object.entries(obj).filter(
([, v]) =>
@miZyind
miZyind / .gitignore
Last active March 24, 2022 08:44
Singularity Branding
.DS_Store
@miZyind
miZyind / calc.sh
Last active October 16, 2020 07:37
Calculate the disk usage of node_modules folder of each project and sort the big ones at the top
find . -name node_modules -exec du -sh {} \; -prune | sort -rh