Search
truthfulTealTyrannosaurus
@hudini
AQI Alerts Get email alerts when AQI is unhealthy near you. Set up Click Fork Change location (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast
AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
Cron
import { email } from "https://esm.town/v/std/email?v=9";
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
export async function aqi(interval: Interval) {
const location = "new york"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
salmonMole
@nknj
Find comments on HN (powered by Algolia ), extract content and return a streaming markdown summary (powered by Substrate ). The RAG portion of this is 34 lines of Substrate code. Read the walkthrough: https://x.com/vprtwn/status/1812844236401762513 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits. See also: https://www.val.town/v/substrate/twitterRAG
HTTP
const stream = await substrate.stream(markdown);
// Render streaming markdown
export default async function handler(req: Request): Promise<Response> {
const renderMarkdown = (await import("https://esm.town/v/substrate/renderMarkdown")).default;
return renderMarkdown(stream);
valentine
@iLegacyy
for ashleigh :)
HTTP
"Don't break my heart :(",
function App() {
const [noClicks, setNoClicks] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
export default async function server(request: Request): Promise<Response> {
return new Response(
scl_2024
@stanley
// Utility functions for formatting
HTTP
// Utility functions for formatting
function formatDate(dateString: string): string {
function formatCurrency(amount: number, currencyCode: string): string {
function formatGoalAmount(amount: number): string {
function calculateBarWidth(totalRaised: number, goalAmount: number): string {
async function fetchAndCacheData() {
async function getFullData() {
async function getDonationProgress() {
async function getCheckoutDetails() {
async function getCampaignInfo() {

blobCommentsReact
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
import { renderToReadableStream } from "https://esm.sh/react-dom/server";
import { blob } from "https://esm.town/v/std/blob?v=10";
function App() {
const [comments, setComments] = useState();
const [newComment, setNewComment] = useState("");
pyodideSetup
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
const pyodideUrl = "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/";
export async function initializePyodide() {
// Set up the global objects that Pyodide expects
(globalThis as any).window = globalThis;
processFeed
@willthereader
An interactive, runnable TypeScript val by willthereader
Script
import { untitled_blackCrayfish } from "https://esm.town/v/stevekrouse/untitled_blackCrayfish?v=1";
async function processFeed() {
let rssData = await untitled_blackCrayfish; // Line 1
console.log("Keys of rssData.rss:", Object.keys(rssData.rss)); // Log the keys of rssData.rss
links.push(rssData[i].link); // If it does, push it into the links array
return links; // Line 5
processFeed().then(output => console.log(output)); // Call the function and print the output to the console
valle_tmp_84405148150117935901731145572002
@janpaul123
// This val will respond to any request with an HTML "Hello, world!" message
HTTP
// This val will respond to any request with an HTML "Hello, world!" message
export default async function(req: Request): Promise<Response> {
return new Response("<h1>Hello, world!</h1>", { headers: { "Content-Type": "text/html" } });

aqiPushGotify
@zane
AQI Alerts Get push notification alerts via Gotify when AQI is unhealthy near you. Set up Click Fork Change location (Line 7) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Create an app in your Gotify Server and add your message endpoint URL w/ the app's API key (e.g., "https://push.example.de/message?token= ") as a Val Town Secret named "gotifyWebhookURL". Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast
AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
Cron
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
import process from "node:process";
export async function aqiPushGotify(interval: Interval) {
const location = "Portland, Oregon"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });

jadeCod
@u
An interactive, runnable TypeScript val by u
HTTP
export async function handlePlexWebhook(req: Request) {
console.log(await req.text());

cron_client_side_script_fork
@stevekrouse
CronGPT This is a minisite to help you create cron expressions, particularly for crons on Val Town. It was inspired by Cron Prompt , but also does the timezone conversion from wherever you are to UTC (typically the server timezone). Tech Hono for routing ( GET / and POST /compile .) Hono JSX HTML (probably overcomplicates things; should remove) @stevekrouse/openai, which is a light wrapper around @std/openai
HTTP
* HTML (probably overcomplicates things; should remove)
* @stevekrouse/openai, which is a light wrapper around @std/openai
/** @jsxImportSource npm:hono@3/jsx */
import { chat } from "https://esm.town/v/stevekrouse/openai";
import cronstrue from "npm:cronstrue";
return c.html(<Cron cron={cron} timezone={timezone} />);
function clientScript() {
// Set the timezone input
(document.getElementById("cron") as HTMLDivElement).innerHTML = cron;
function Cron({ cron, timezone }) {
let translation;
KidsCodingDameDinoAdventure
@jbwinters
* This val implements a Dino Code Adventure game using React.
* It uses client-side React for the game logic and UI, and
* includes a server-side endpoint for storing high scores.
HTTP
return grid;
function App() {
const [grid, setGrid] = useState(initialGrid);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
time
@vs
An interactive, runnable TypeScript val by vs
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export async function time() {
return await fetchJSON(
"https://api.openaq.org/v2/latest?" +