Scoped mutex with timeouts and transaction convenience wrapper
It uses vercel/ms package to parse timeout
npm i ms @types/ms
Use it anywhere you want to serialize your code:
| bench / bench: jsdom (tests/bench/jsdom_vs_cheerio.spec.ts) | |
| jsdom: parse only wall avg=112.8ms min=85.4ms max=150.9ms cpu avg=138.1ms | |
| ✔ parse only (1s) | |
| jsdom: parse + querySelectorAll wall avg=131.7ms min=91.9ms max=300.8ms cpu avg=158.3ms | |
| ✔ parse + querySelectorAll (1s) | |
| jsdom: parse + text node walk wall avg=145.5ms min=111.9ms max=183.4ms cpu avg=163.2ms | |
| ✔ parse + text node walk (2s) | |
| jsdom: parse + setAttribute wall avg=113.2ms min=92.0ms max=129.1ms cpu avg=125.6ms | |
| ✔ parse + setAttribute (1s) | |
| jsdom: parse + serialize wall avg=117.6ms min=96.9ms max=144.6ms cpu avg=129.9ms |
Scoped mutex with timeouts and transaction convenience wrapper
It uses vercel/ms package to parse timeout
npm i ms @types/ms
Use it anywhere you want to serialize your code:
| // Функция форматирования поля для ввода валюты | |
| const setupCurrencyInput = (inputElement, options = {}) => { | |
| // Определение конфигурации с валютой, разделителями и прочими параметрами | |
| const config = { | |
| currency: '₽', // Символ валюты | |
| thousandsSeparator: ' ', // Разделитель тысяч | |
| decimalSeparator: ',', // Разделитель десятичных | |
| decimalPlaces: 0, // Количество десятичных знаков | |
| hideZero: true, // Скрывать ноль, если значение 0 | |
| maxDigits: 9, // Максимальное количество цифр |
Relevant PR: grammyjs/menu#4
generator gets triggered at least two times per menu render (could be potentially fixed with caching by update_id)generator has to load all of the items each time.
Should instead pass range information to the builder and fetch only required items.
This would also require a different method to fetch total count.| #!/bin/bash | |
| input="" | |
| prefix="" | |
| bucket="" | |
| while [[ "$#" -gt 0 ]]; do | |
| case $1 in | |
| -p | --prefix) | |
| shift |
| #!/bin/zsh | |
| # | |
| # Purpose: run speficied command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output. | |
| # Also cache exit status and stderr. | |
| # Copyright (c) 2019-2020 András Korn; License: GPLv3 | |
| # Use silly long variable names to avoid clashing with whatever the invoked program might use | |
| RUNCACHED_MAX_AGE=${RUNCACHED_MAX_AGE:-300} | |
| RUNCACHED_IGNORE_ENV=${RUNCACHED_IGNORE_ENV:-0} | |
| RUNCACHED_IGNORE_PWD=${RUNCACHED_IGNORE_PWD:-0} |
| #!/bin/bash | |
| # REQUIREMENTS TO RUN THIS SCRIPT: | |
| # - ffmpeg | |
| # - python | |
| # HOW TO RUN: | |
| # - `cd` into the directory with `source.mp4` | |
| # - Run this script |
| .asciinema-player-wrapper { | |
| position: relative; | |
| text-align: center; | |
| outline: none; | |
| } | |
| .asciinema-player-wrapper .title-bar { | |
| display: none; | |
| top: -78px; | |
| transition: top 0.15s linear; | |
| position: absolute; |