Search
fortuitousLavenderCuckoo
@Dbtosine
A simple calculator
Cron
import React, { useState } from "https://esm.sh/react@18.2.0";
function Calculator() {
const [display, setDisplay] = useState("0");
</div>
function client() {
createRoot(document.getElementById("root")).render(<Calculator />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(
relaxedSalmonHawk
@codefromanywhere
An interactive, runnable TypeScript val by codefromanywhere
HTTP
export default async function handler(request: Request) {
if (request.method !== "POST") {
return Response.json({ message: "This val responds to POST requests." }, {
spacexcalendar
@moe
An interactive, runnable TypeScript val by moe
HTTP
import ical from "npm:ical-generator"
import moment from "npm:moment-timezone"
export default async function(req: Request): Promise<Response> {
const data = await spacexCalendar()
// return Response.json(data)
webpage_summarizer
@spinningideas
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
function App() {
const [url, setUrl] = useState(() => {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
if (request.method === "POST" && new URL(request.url).pathname === "/summarize") {
const webpageText = await webpageResponse.text();
// Use OpenAI as Claude proxy
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [

perseveringApricotSwordfish
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
function App() {
const [prompt, setPrompt] = useState("hello llamapalooza");
>(null);
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
client();
function extractCodeFromFence(text: string): string {
const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
return htmlMatch ? htmlMatch[1].trim() : text;
export default async function server(req: Request): Promise<Response> {
if (req.method === "POST") {
github_emails
@wittjosiah
An interactive, runnable TypeScript val by wittjosiah
Email
import { noteToSelf } from "https://esm.town/v/wittjosiah/discord_note_to_self";
import { parse } from "https://esm.town/v/wittjosiah/parse_github_email";
export default async function(message: Email) {
console.log(JSON.stringify(message, null, 2));
if (!message.from.endsWith("<notifications@github.com>")) {
indigoMockingbird
@tsoongg
// Fetches a random joke.
Cron
subject: setup,
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
aqi
@ayush73
dctalbot AQI Alerts Get email alerts when AQI is unhealthy near you.
Cron
import { email } from "https://esm.town/v/std/email?v=9";
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
export async function aqi(interval: Interval) {
const location = "Dallas"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
productiveCyanPigeon
@gratitude5dee
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY
HTTP
import React, { useState, useEffect } from 'react';
function MemeCoin() {
const [tokenSupply, setTokenSupply] = useState(1000000);
import React, { useState, useEffect } from 'react';
function MemeCoin() {
const [tokenSupply, setTokenSupply] = useState(500000);
estimatedTime: '10 mins'
function MemeCoinCodeGenerator() {
const [selectedTemplate, setSelectedTemplate] = useState(STARTER_PROMPTS[0]);
</div>
function App() {
return <MemeCoinCodeGenerator />;
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
freeFireMiniGame
@Miraj8022
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function FreeFire() {
const [playerPos, setPlayerPos] = useState({ x: 50, y: 50 });
</div>
function client() {
createRoot(document.getElementById("root")).render(<FreeFire />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
val_X6tag4WVBK
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
rollADice
@liyi
Roll a Dice All codes are generated by Townie AI.
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
/** Utility functions */
function generateValidRoll(): number {
return Math.floor(Math.random() * 6) + 1;
function getDiceEmoji(roll: number): string {
const diceEmojis = [
return diceEmojis[roll - 1];
function formatTime(timestamp: number): string {
const date = new Date(timestamp);
id: string; // Add unique identifier
function App() {
const [roll, setRoll] = useState(generateValidRoll());
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
const roll = generateValidRoll();
laserCutterSimulator
@all
@jsxImportSource https://esm.sh/react
HTTP
return path;
function App() {
const [position, setPosition] = useState({ x: 0, y: 0 });
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
return new Response(`

home
@rym
// Access via https://api.val.town/v1/express/rym.home
Script
import { blocks as blocks2 } from "https://esm.town/v/rym/blocks";
// Access via https://api.val.town/v1/express/rym.home
export async function home(req: express.Request, res: express.Response) {
const blocks = await blocks2();
console.log(
embedVideoWebPage
@eligosmlytics
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [youtubeUrl, setYoutubeUrl] = useState("https://www.youtube.com/embed/QskiaNqaqlc?si=MvD_ydotKgovS9pC");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
// Image proxy endpoint