1// Times how long an execution takes
2// usage: @stevekrouse.panphoraDistanceTimed
3export async function timed(f) {
4 const start = Date.now();
5 const res = await f();
26 }
27 console.log(
28 `average e2e user function time: ${
29 (userFuncTimes.reduce((a, b) => a + b, 0) / count).toFixed(0)
30 }ms (fastest was ${
1export function add(...args) {
2 return args.reduce((a, b) => a + b, 0);
3}
3import { verifyAPIAuth } from "https://esm.town/v/stevekrouse/verifyAPIAuth";
4
5export async function dm(message, auth) {
6 let { handle, error } = await verifyAPIAuth(auth);
7 if (!handle)
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function weatherGovGrid({ lat, lon }): Promise<WeatherData> {
4 return fetchJSON(
5 `https://api.weather.gov/points/${lat},${lon}`,
3import { whoami } from "https://esm.town/v/stevekrouse/whoami";
4
5export async function r2(key, value?, keys?) {
6 // GET
7 if (value === undefined) {
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function runAllTests2({ names }: { names: string[] }) {
5 return names.map((name) =>
6 fetchJSON(`${TEST_API}/eval/@stevekrouse.${name}()`)
1export function myApi(name) {
2 return "hi " + name;
3}
6
7export const hnFollow = async () => {
8 // poll using @stevekrouse's helper function
9 let posts = await hnLatestPosts({
10 authors: hnAuthors,
1export function myApi(name) {
2 return "hi " + name;
3}
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": "*",