10import { randomStyle } from "https://esm.town/v/stevekrouse/classless_css";
11
12export default async function(req: Request): Promise<Response> {
13 return new Response(`<h1>Welcome to Val Town!</h1>${randomStyle}`, {
14 headers: {
4delete frameworks[""];
5
6function absolutePath(url: string) {
7 if (url.startsWith("http")) return url;
8 else return `https://classless-css-demo.deno.dev` + url;
13export const randomStyle = `<link rel="stylesheet" href="${randomURL}">`;
14
15export default function(req: Response) {
16 const url = new URL(req.url);
17
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "prishtina"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
1const self = "this";
2
3export function follow(obj: any, chain: (string | number)[]): any {
4 let current = obj;
5
15}
16
17function trimmed(input: string): string {
18 const max = 500;
19 if (input.length <= max) {
33}
34
35export function asParts(obj: any): ObjectPart[] {
36 const objectParts: ObjectPart[] = [];
37 const record = asMap(obj);
55}
56
57export function asMap(obj: any, deep: number = 1): Record<string, any> {
58 const objectMap: Record<string, any> = {};
59
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
1# Render form and save data
2
3This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data.
4
5Fork this val to customize it and use it on your account.
1export function h2(value) { return `<h2>${value}</h2>`; }
2export function li(value) { return `<li>${value}</li>`; }
3export function td(value) { return `<td>${value}</td>`; }
4export function th(value) { return `<th>${value}</th>`; }
5export function tr(...cells) { return `<tr>${cells.join('')}</tr>`; }
6export function ul(...items) { return `<ul>${items.join('')}</ul>`; }
7export function table(...items) { return `<table>${items.join('')}</table>`; }
8export function bordered(...items) { return `<table border>${items.join('')}</table>`; }
9export function a(href,label) { return `<a href="${href}">${label}</a>`; }
10export function download(label,href,filename) { return `<a href="${href}" download="${filename}">${label}</a>`; }
11export function img(src) { return `<img src="${src}" alt="photo for ${src}" width="100">`}
12export function p(value) { return `<p>${value}</p>`; }
13export function pre(value) { return `<pre>${value}</pre>`; }
14export function details(summary,details) { return `<details><summary>${summary}</summary>${details}</details>`; }
15export function html(...items) { return `<!DOCTYPE html><html>${items.join('')}</html>`; }
16export function head(...items) { return `<head>${items.join('')}</head>`; }
17export function body(...items) { return `<body">${items.join('')}</body>`; }
18
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
1export async function beckerBarley() {
2 const Plot = await import("https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.14/+esm");
3 const d3 = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm");
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
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.