A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
upstream icon { | |
server unix:/home/icon/web/site.ru/icon/shared/sockets/puma.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name site.ru www.site.ru; | |
rewrite ^(.+)$ https://site.ru$uri permanent; | |
} |
// collections | |
$CONTAINER-WIDTHS: ( | |
5, | |
10, | |
20, | |
30, | |
40, | |
50, | |
60, |
"""Demonstrates different LogRecord attributes (formatters). | |
https://docs.python.org/3/library/logging.html#logrecord-attributes | |
""" | |
import logging | |
# Notes | |
# ----- | |
# pathname: this is relative! | |
# created: time in seconds since the epoch as a float |
copytoclipboard
: Alternative to clipboard.js: Async implementation of "Copy to clipboard" in plain JS. Works in Safari, Chrome, Firefox, Opera and Edge Canary. Less than 1kb minified.
copyToClipBoard
accepts an html element and returns a Promise.
Copies the content of the html element with the format included and also as plain text (both options).
class asyncAwaiterQueue { | |
constructor(...values) { | |
this.promise = new Promise(resolve => { | |
this.resolve = resolve; | |
}); | |
values.forEach(v => this.put(v)); | |
} |
If you are listening to changes on an Event (DOM Events) to execute any side effects like performing network requests, you'd probably want to "debounce" your attached function executions.
This is an alternative to lodash.debounce
but "vanilla js" packed as
a Vue SFC to import
it as a
mixin.
Dynamic import, but where the module you import runs in a different thread.
Powered by Comlink and Module Workers.
Available via unpkg: https://unpkg.com/comlinkage
var s; | |
function supportsModuleWorkers() { | |
if (s==null) { | |
s = false; | |
try { | |
new Worker('data:,', Object.defineProperty({}, 'type', { | |
get() { s = true; } | |
})).terminate(); | |
} catch (e) {} | |
} |
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=> | |
// arrays | |
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
// components | |
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=> | |
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):( | |
// create notes | |
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
// diff props |