This gist is to remind developers that resizable or growable buffers don't play nice with TextEncoder or TextDecoder instances.
// setup
const ref = new TextEncoder().encode("hello");| let p = 0; | |
| const fetchp = (url, ..._) => { | |
| const { promise, resolve, reject } = Promise.withResolvers(); | |
| const src = new URL(url); | |
| const callback = `__json${p++}`; | |
| src.searchParams.set('callback', callback); | |
| document.head.appendChild(Object.assign( | |
| document.createElement('script'), | |
| { async: true, onerror: reject, src } | |
| )); |
This is a simple demo of how latest Bun could've implemented .as(Class) instead of using the quite jurassic Object.create which is slow, bloated due descriptors logic, if used at all, and incapable to play nicely with features introduced after Object.create was even specified.
// what `as(Class)` should return
const { assign } = Object;
const asClass = new WeakMap;
const setAsClass = Class => {
class As extends Class {
constructor(fields) {
assign(super(), fields);There are various shenanigans around the Proxy API, including issues with Array.isArray and Object.ownKeys so that this gits purpose is to describe all the undocummented caveats to help anyone dealing with all possibilities this half-doomed API offers.
apply and construct traps won't work with it. If the object somehow wants to represent an array without being one, it's impossible to survive Array.isArray brand check (it will be false) and with ownKeys the target needs to have a non configurable length property or it will also fails once reachedI've saved this file as /usr/local/bin/new-tab but I think there is a way to configure it as Ctrl+Shift+T shortcut somehow,
yet I really wanted to write this down as I've lost 20 minutes of my life to have WSL behaving just like any regular Linux distro in a console/terminal.
#!/usr/bin/env sh
cmd.exe /c wt.exe wt -w 0 nt -d "$(pwd)" -p "$WSL_DISTRO_NAME"If you have better tips, hints, or follow ups, you're more than welcome to share, thank you!
This gist is a simple no-brainer description of the 3 ways (actually 2.5) the Web handle events.
The declarative inline HTML event listener is mostly an indirection of DOM Level 0 events, meaning this simply uses the equivalent of tag.onclick = listener behind the scene.
click meThis gist simply lists all elements that can't be extended on "the platform" if not through the Custom Elements builtin extends feature.
This list does not focus on the "why would you?" rather on the "why can't you?" (on Safari) question out there, using the Permitted Parent section out of MDN Element Reference.
If you are using this already, consider changes soon due the discussion around current ESX proposal.
Feel free to keep an eye on udomsay as that will be the implementation reference for consumers.
The new proposal and hopefully the new transformer will be out soon.
This gist tries to narrow down all features and complexity hidden behind a smarter JSX, something landed already as @ungap/babel-plugin-transform-hinted-jsx module but not yet concretely, or efficiently, implemented.
Apparently there's no share button after wordling in my browsers, so I created this copy/paste JS to put in console, which will produce an output like:
Wordle 212 4/6
⬛⬛🟨⬛🟨
🟨🟨🟨🟨⬛
🟩🟨⬛🟨🟨
🟩🟩🟩🟩🟩