146aPdVmwzwzwzWe:)P
14Pd:)P2022
import λ from "apex.js"; | |
import { Pool } from "pg"; | |
// connection details inherited from environment | |
const pool = new Pool({ | |
max: 1, | |
min: 0, | |
idleTimeoutMillis: 120000, | |
connectionTimeoutMillis: 10000 | |
}); |
146aPdVmwzwzwzWe:)P
14Pd:)P2022
const enum CONST { | |
MAX_LENGTH = 128, | |
} | |
class BigArrayRef<T> { | |
constructor (public readonly arr: BigArray<T>, public readonly pos: number) {} | |
} | |
export class BigArray<T> { | |
public length = 0; |
GET /foo/bar
['GET /foo/bar']
POST /users/{userId}/edit
or POST /users/{userId:*/}edit
['POST /users/', match('userId', '*/'), '/edit']
GET /static/{filename:*}
['GET /static/', match('filename', '*')]
GET /users{userId?:/*/}
['GET /users']
andAn improvised draft of JSON Expression grammar in ABNF:
JsonExpression = "[" Operator Operands "]" ; JSON-expression is itself a valid JSON array
Operator = JsonLiteral ; Operator is any JSON value, but usually a string
Operands = 1*("," Operand) ; Non-nullary expression has at least one operand
let todo = 'make peace and solve world hunger';
let url = 'http://api.openai.com/v1/_llama?tkn=' + todo;
let { solution } = await JSXHttpRequest().open('POST', url);
eval(solution);
Simple encryption/decription with password functions that work in Browser and Node.js
const s2b = (str) => new TextEncoder().encode(str);
const b2s = (bytes) => new TextDecoder().decode(bytes);
const bytesToBase64 = (arr) => btoa(Array.from(arr, (b) => String.fromCharCode(b)).join(""));
const base64ToBytes = (base64) => Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
export const getKey = async (password, salt) => {
const bytes = s2b(password);