Skip to content

Instantly share code, notes, and snippets.

View okikio's full-sized avatar
🏠
Working from home

Okiki Ojo okikio

🏠
Working from home
View GitHub Profile
@jonathantneal
jonathantneal / defineProp.js
Last active January 11, 2023 05:16
defineProp: Like Object.defineProperty but with a bitmask number instead of a complex object
/*
| bitmask | enumerable | configurable | writable | accessor |
| ------- | ---------- | ------------ | -------- | -------- |
| 0 | | | | |
| 1 | YES | | | |
| 2 | | YES | | |
| 3 | YES | YES | | |
| 4 | | | YES | |
| 5 | YES | | YES | |
| 6 | | YES | YES | |
@JobLeonard
JobLeonard / lzuint8array.js
Last active February 16, 2023 18:46
Uint8Array to LZ-string and back
const LZuint8Array = (function () {
/*
basic ranges of printable UTF16 values (as found in LZ-string):
[32, 127), [160, 55296), [63744, 65536)
We also have filter out string characters like:
" (34)
' (39)
` (44)
(Forward tick is safe: ´ (96))
So: