This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = { | |
"i": [ | |
"immunoelectrophoresis", | |
"indistinguishability", | |
"internationalisation", | |
"internationalization", | |
"incomprehensibility", | |
"incontrovertibility", | |
"interdenominational", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toDecimal(mantissa_str, exponent_str) { | |
const [sign_str, sig_str] = mantissa_str.split('.') | |
const sign = sign_str === "1" ? -1 : 0 | |
const [ex_sign_str, ...ex_sig_arr] = exponent_str.split("") | |
const ex_sign = ex_sign_str === '1' ? -1 * Math.pow(2, exponent_str.length - 1) : 0 | |
const ex_summed = ex_sign + ex_sig_arr.reverse().map( | |
(bit, i) => bit === '1' ? Math.pow(2, i) : 0 | |
).reduce((a, b) => a + b, 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
while : | |
do | |
echo "Attempting to connect to $1:$2 ..." | |
if exec 7<> /dev/tcp/$1/$2 ; then | |
echo "Connection Established to $1:$2" | |
while : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function unicodeCodePointsToString(codePoints) { | |
return codePoints | |
.replace(/[^0-9A-F]/gi, ' ') | |
.replace(/\s+/g, ' ') | |
.trim() | |
.split(' ') | |
.map((code) => parseInt(code, 16)) | |
.filter((code) => !isNaN(code)) | |
.map((code) => { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx jsonx */ | |
/** @jsxFrag null */ | |
const property = (key: string | number, ...children: any) => | |
jsonxobject({ | |
[key]: jsonx(null, undefined, ...children), | |
}); | |
class JSONXObject extends Object {} | |
const jsonxobject = (obj: any) => Object.assign(new JSONXObject(), obj); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function atom<T>(initialState: T) { | |
let state = initialState; | |
const pendingUpdates = new Map<Function, Function>(); | |
const blocked = new Map<Function, Function>(); | |
function update(predicate: (state: T) => boolean, nextState: T | ((state: T) => T)): Promise<T> { | |
function attemptToApplyPendingUpdates() { | |
for (const [predicate, update] of pendingUpdates) { | |
if (predicate(state)) { |