Skip to content

Instantly share code, notes, and snippets.

@XeroAlpha
XeroAlpha / expr.ts
Last active February 6, 2024 07:52
A very simple expression calculator
interface TokenDefinition {
categories?: string[];
name: string;
regex: RegExp;
ignore?: true;
parse?: (...args: string[]) => any;
}
interface PrecedenceLevelDefinition {
operators: string[];
@XeroAlpha
XeroAlpha / huginn_api.js
Last active July 20, 2026 14:30
Huginn API written by Node.js
// dependence: got, cheerio, tough
// haven't complete
// haven't fully tested
const got = require("got").default;
const cheerio = require("cheerio");
const tough = require("tough-cookie");
const nodeUrl = require("url");
async function fetchAsDOM(client, url) {
return cheerio.load((await client.get(url, { responseType: "text" })).body);