This file contains 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
import { useEffect, useRef, useState } from "preact/hooks"; | |
const ENDPOINT = "https://whole-cat-70.deno.dev/"; | |
const COLLECTION = "dil"; | |
function getEndpoint() { | |
return `${ENDPOINT}${COLLECTION}`; | |
} | |
async function getFromServer(setItems: (items: string[]) => void) { |
This file contains 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 getFunctionParametersFromString(funcStr) { | |
const match = funcStr.match(/(?:function.*?\(|\()(.*?)(?:\)|=>)/); | |
if (match && match[1]) { | |
return match[1].split(',').map(p => p.trim()); | |
} | |
return []; | |
} | |
function getFunctionParameters(func) { |
This file contains 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 const getWasmCode = async (url) => { | |
switch (url.protocol) { | |
case "file:": | |
const assemblyUrl = url.pathname.substr(0, 1) === "/" | |
? url.pathname.substr(1) | |
: url.pathname; | |
if (globalThis.Deno !== undefined) { | |
return Deno.readFile(assemblyUrl); | |
} |
This file contains 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
Symbol.metadata ??= Symbol("metadata"); | |
// base | |
type ContainerItemKinds = "class" | "value"; | |
type ContainerKey = symbol | string | number; | |
type ContainerItem = { obj: unknown, kind: ContainerItemKinds }; | |
const container = new Map<ContainerKey, ContainerItem>(); | |
const inject = (key: ContainerKey, value: unknown, kind: ContainerItemKinds = "value") => { | |
container.set(key, { obj: value, kind: kind }); |
This file contains 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
a { | |
background: linear-gradient(to right, #ffcc66 50%, transparent 50%); | |
background-size: 200% 100%; | |
background-position: right; | |
transition: all .35s ease-out; | |
} | |
a:hover { | |
background-position: left; | |
} |
This file contains 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
validateModel(): void { | |
this.logger.debug(`validating model for ${this.name}`); | |
asserts.assertExists(this.name, "name is required"); | |
asserts.assert(this.name.length > 0, "name is required"); | |
asserts.assertExists(this.version, "version is required"); | |
asserts.assert(this.version.length > 0, "version is required"); | |
const integrationFeatures = [ |
This file contains 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
// taken from https://deno.land/[email protected]/node/internal/crypto/_randomBytes.ts?source | |
// licensed under MIT License | |
const MAX_RANDOM_VALUES = 65536; | |
const MAX_SIZE = 4294967295; | |
function generateRandomBytes(size: number) { | |
if (size > MAX_SIZE) { | |
throw new RangeError( | |
`The value of "size" is out of range. It must be >= 0 && <= ${MAX_SIZE}. Received ${size}`, | |
); |
This file contains 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 camelCaps = (str) => { | |
let nextShouldBeUpper = true; | |
let result = ""; | |
for (let i = 0; i < str.length; i++) { | |
result += nextShouldBeUpper ? str[i].toLocaleUpperCase() : str[i].toLocaleLowerCase(); | |
nextShouldBeUpper = (str[i] === " ") || !nextShouldBeUpper; | |
} | |
return result; |
This file contains 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 publicJwk = { | |
"kty": "RSA", | |
"kid": "", | |
"n": "", | |
"e": "AQAB" | |
}; | |
const privateJwk = { | |
"kty": "RSA", | |
"kid": "", |
This file contains 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
AGENT | |
AGILE | |
ALGOL | |
ALLOC | |
AMIGA | |
ARRAY | |
ASCII | |
ASIDE | |
ASSET | |
ASSOC |
NewerOlder