1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function(req: Request): Promise<Response> {
4 const openai = new OpenAI();
5
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [prompt, setPrompt] = useState("");
7 const [isLoading, setIsLoading] = useState(false);
9 const [error, setError] = useState("");
10
11 async function generateImage() {
12 setIsLoading(true);
13 setError("");
51}
52
53function client() {
54 createRoot(document.getElementById("root")).render(<App />);
55}
59}
60
61export default async function server(req: Request): Promise<Response> {
62 return new Response(`
63 <!DOCTYPE html>
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
2
3export async function modifyImage(
4 file: File,
5 params: { width: number; height: number },
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
2
3export async function modifyImage(
4 file: File,
5 params: { width: number; height: number },
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [weather, setWeather] = useState(null);
7
33}
34
35function client() {
36 createRoot(document.getElementById("root")).render(<App />);
37}
39if (typeof document !== "undefined") { client(); }
40
41export default async function server(request: Request): Promise<Response> {
42 if (request.url.endsWith('/weather')) {
43 const weatherData = await fetchWeather();
67}
68
69function celsiusToFahrenheit(celsius: number): number {
70 return Math.round((celsius * 9/5) + 32);
71}
72
73async function fetchWeather() {
74 const response = await fetch(
75 'https://api.open-meteo.com/v1/forecast?latitude=40.5853&longitude=-105.0844¤t_weather=true&daily=temperature_2m_max,temperature_2m_min&timezone=America%2FDenver'
84}
85
86function getWeatherCondition(code: number): string {
87 const conditions: { [key: number]: string } = {
88 0: 'Clear sky',
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [activeTab, setActiveTab] = useState('home');
7
43}
44
45function client() {
46 createRoot(document.getElementById("root")).render(<App />);
47
60if (typeof document !== "undefined") { client(); }
61
62export default async function server(request: Request): Promise<Response> {
63 const url = new URL(request.url);
64
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function SoundMaker() {
6 const [isRecording, setIsRecording] = useState(false);
7 const [recordedNotes, setRecordedNotes] = useState([]);
72}
73
74function Meditation() {
75 const mantras = [
76 "Tokens flow, I am whole",
189}
190
191function TokenAnimation() {
192 const canvasRef = useRef(null);
193
243}
244
245function App() {
246 const [isDarkMode, setIsDarkMode] = useState(false);
247 const [currentFeature, setCurrentFeature] = useState("intro");
299}
300
301function client() {
302 createRoot(document.getElementById("root")).render(<App />);
303}
307}
308
309export default async function server(request: Request): Promise<Response> {
310 return new Response(
311 `
10const CHANNEL_ID = "<project_id>";
11
12async function main() {
13 const body = {
14 title: "Hello World",
27const PR_ALERTS_CHANNEL_ID = "izu9x0b54xy2";
28
29export default async function server(request: Request): Promise<Response> {
30 if (request.method !== "POST") {
31 return new Response("Method not allowed", { status: 405 });
19const campsite = new Campsite({ apiKey: CAMPSITE_API_KEY });
20
21export async function emailValHandler(payload: Email) {
22 // ignore emails sent to the public val :)
23 if (payload.to === "campsite.email_channel@valtown.email") {
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.