1import { Buffer } from "node:buffer";
2
3export async function imageUrlToBase64(res: Response) {
4 // From https://stackoverflow.com/a/60321567
5 const buffer = Buffer.from(await res.arrayBuffer());
4import { rssFeeds } from "https://esm.town/v/iakovos/rssFeeds";
5
6export async function pollRSSFeeds() {
7 let allNewItems = [];
8 const rssFeedChunks = chunk2(rssFeeds, 25);
1import { generateFeedHTML } from "https://esm.town/v/iakovos/generateFeedHTML";
2
3export function renderFeedsForEmail(feeds) {
4 let html = `
5<!DOCTYPE html>
2Gets information about a specific val.
3
4To access private vals, pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: Archive/getVal
3export const parsePacoEx = (async () => {
4 var pako = await import("npm:pako");
5 function decodeMermaid(encodedString) {
6 var binaryData = Buffer.from(encodedString, "base64");
7 var inflatedString = pako.inflate(binaryData, { to: "string" });
1import { Buffer } from "node:buffer";
2
3export async function qr(req: express.Request, res: express.Response) {
4 if (req.path.startsWith("/qr")) {
5 const { qrcode } = await import("https://deno.land/x/qrcode/mod.ts");
20 let img = document.getElementsByTagName("img")[0]
21 let input = document.getElementsByTagName("input")[0]
22 input.addEventListener('input', function(e){
23 img.src="/qr?data=" + e.target.value
24 })
7 data: object;
8};
9export async function callGoogleSheetsAPI(
10 { serviceAccount, sheetId, action, data }: Args,
11) {
4 lon = +lon;
5 lat = +lat;
6 function dist(station) {
7 return Math.sqrt(
8 Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2)
2
3export let getDuckDB = (async () => {
4 async function createWorker(url: string) {
5 const workerScript = await fetch(url);
6 const workerURL = URL.createObjectURL(await workerScript.blob());
2import { hasValTownStyleGuideUpdated } from "https://esm.town/v/stevekrouse/hasValTownStyleGuideUpdated";
3
4export async function valTownStyleGuideUpdated({ lastRunAt }) {
5 if (await hasValTownStyleGuideUpdated(lastRunAt))
6 email({
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",