Skip to content

Instantly share code, notes, and snippets.

@bwlt
bwlt / shell aliases
Last active February 2, 2023 15:32
shell alias, useful for cleanup local branches when the remote branch has been deleted (for example merged branch)
View shell aliases
# useful for cleanup local branches when the remote branch has been deleted (for example merged branch)
gdgone='git branch -v | grep " \[gone\] " | awk '\''{ print $1 }'\'' | xargs git branch -D'
# updates the local repository branches to the latest and performs cleanup.
# gf, gco and gl are alias for git fetch, git checkout and git pull
gstart='gf -p && gco master && gdgone && gl && gco develop && gl'
@bwlt
bwlt / debounce.ts
Last active March 17, 2020 13:40
A debounce function with type safety
View debounce.ts
export const MissingReturnValue = Symbol('MissingReturnValue')
export function debounce<Fn extends (...args: any[]) => any>(
fn: Fn,
ms: number
): (...args: Parameters<Fn>) => ReturnType<Fn> | typeof MissingReturnValue {
let debouncing = false
let lastReturnedValue:
| typeof MissingReturnValue
| ReturnType<Fn> = MissingReturnValue
@bwlt
bwlt / 2ad7gm.jpg
Last active May 23, 2018 08:00
milanojs - the good party 2018