1export function test(){
2 return Math.random();
3}
1// View at https://andreterron-htmlExample.web.val.run?name=Andre
2export default async function(req: Request): Promise<Response> {
3 const query = new URL(req.url).searchParams;
4
2
3const script = `
4def mapFunction(r, i):
5 v = r * i
6 return v
8x = [1, 2, 3, 4]
9x
10 .map(mapFunction)
11 .filter(r => r * r)
12 .join(",")
2
3const script = `
4def mapFunction(r, i):
5 v = r * i
6 return v
8x = [1, 2, 3, 4]
9x
10 .map(mapFunction)
11 .filter(r => r * r)
12 .join(",")
3 const { jsPython } = await import("npm:jspython-interpreter");
4 const script = `
5def mapFunction(r, i):
6 v = r * i
7 return v
9x = [1, 2, 3, 4]
10x
11 .map(mapFunction)
12 .filter(r => r * r)
13 .join(",")
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function latestBlogContent() {
4 return (
5 await fetch(
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8 let btcPrice = await currency("usd", "btc");
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function openaiUploadFile({ key, data, filename = "data.json", purpose = "assistants" }: {
4 key: string;
5 data: any;
1export default function(req) {
2 const url = new URL(req.url);
3 if (url.pathname == "/val-town") {
7 * @param val Define which val should open. Defaults to the root reference.
8 */
9export function modifyResponse(
10 res: Response,
11 { val, style }: { val?: ValRef; style?: string } = {},
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": "*",