Skip to content

Instantly share code, notes, and snippets.

export default function<T extends (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>>(fnAsync: T, { trailing }: { trailing?: boolean } = { trailing: false }) {
let promise: Promise<Awaited<ReturnType<T>>> | undefined
let calledAgain = false
let lastArgs: Parameters<T> | undefined
const deduped = async function (...args: Parameters<T>) {
if (promise) {
calledAgain = true
lastArgs = args
@wokalek
wokalek / .bash_aliases
Last active October 16, 2025 11:42
Best frontend bash aliases
# Bash
alias c="clear"
alias d="exit"
alias beep='powershell "[console]::beep(500,300)"'
# Git
alias gl="git log"
alias gg="git log --oneline --graph --all"
alias gs="git status"
alias gb="git branch --sort=-committerdate"
@wokalek
wokalek / script.sh
Created July 20, 2023 21:02
get docker through one line
curl -fsSL https://get.docker.com | sh
@wokalek
wokalek / getScrollWidth
Last active November 17, 2017 20:29
Возвращает количество пикселей ширины полосы прокрутки браузера
/**
* @returns {number} Возвращает количество пикселей ширины полосы прокрутки браузера.
*/
static getScrollWidth()
{
let div = document.createElement('div');
div.style.display = 'inline-block';
div.style.visability = 'hidden';
div.style.width = '50px';
div.style.height = '50px';