11`);
12
13export default async function(req: Request): Promise<Response> {
14 const res = await db.query(`
15 UPDATE test
10type GeneratedImage = { imageUrl: string; prompt: string };
11
12function App() {
13 const [prompt, setPrompt] = useState("");
14 const [imageUrl, setImageUrl] = useState("");
92}
93
94function client() {
95 createRoot(document.getElementById("root")).render(<App />);
96}
100}
101
102export default async function server(request: Request): Promise<Response> {
103 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
104 const url = new URL(request.url);
11`);
12
13export default async function(req: Request): Promise<Response> {
14 const res = await db.query(`
15 UPDATE test
5import moment from "npm:moment";
6
7export default async function(req: Request): Promise<Response> {
8 // ============= Data Fetching =================
9 const today = new Date();
63 };
64
65 function groupSchedulesByDate(schedules) {
66 return schedules.reduce((acc, schedule) => {
67 const date = schedule.interval.start.split("T")[0];
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "lefkada greece"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
3 * Below each section, there's a text input field. Each color section can have up to 8 values.
4 * It uses React for the UI and CSS for styling the gradient line and inputs.
5 * It includes a reorder functionality for the items in each section and an expandable "Learn more" section.
6 */
7/** @jsxImportSource https://esm.sh/react */
9import { createRoot } from "https://esm.sh/react-dom/client";
10
11function App() {
12 const [redItems, setRedItems] = useState<string[]>([]);
13 const [yellowItems, setYellowItems] = useState<string[]>([]);
186}
187
188function client() {
189 createRoot(document.getElementById("root")).render(<App />);
190}
191if (typeof document !== "undefined") { client(); }
192
193async function server(request: Request): Promise<Response> {
194
195 return new Response(`
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({
6const JSDOM = jsdom.JSDOM;
7
8export function readableHtml(urlOrContent: URL | string, options?: RequestInit): Promise<string> {
9 if (typeof urlOrContent === "string") {
10 return readableHtmlFromText(urlOrContent);
15export default readableHtml;
16
17async function readableHtmlFromUrl(url: URL, options?: RequestInit): Promise<string> {
18 const body = await fetchText(url.toString(), options);
19 return readableHtmlFromText(body);
20}
21
22async function readableHtmlFromText(content: string): Promise<string> {
23 let doc = new JSDOM(content);
24 let reader = new Readability(doc.window.document);
1export default async function server(request: Request): Promise<Response> {
2 const url = new URL(request.url);
3
50
51 <script>
52 async function fetchFiles() {
53 const user = document.getElementById('user').value;
54 const repo = document.getElementById('repo').value;
1export default async function handler(request: Request) {
2 if (request.method !== "POST") {
3 return Response.json({ message: "This val responds to POST requests." }, {
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.