Search
zygomorphicPurpleStoat
@seanodotcom
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 = "Philadelphia"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
valle_tmp_0102751451670317635326502042755992
@janpaul123
// This script will respond with a basic HTML page, including styled content and an animated cat GIF.
HTTP
* HTTP Val: Hello World Example (HTML Response with CSS and Animated Cat GIF)
* This script will respond with a basic HTML page that says "Hello world" to any incoming HTTP request. It includes some cool CSS styles and an animated cat GIF that crawls around the screen.
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
MoonCatWalk
@midnightlightning
@jsxImportSource https://esm.sh/react
HTTP
moveTime: number;
function parseGoal(x: number, y: number, goalX: number, goalY: number) {
const parsed: { x: number; y: number; animation: AnimationLabel } = {
return parsed;
function VirtualPet({ spriteNum }: { spriteNum: number }) {
const [petState, setPetState] = useState<PetState>({
useEffect(() => {
function handleMouseMove(e) {
const now = Date.now();
let ignore = false;
function doTick() {
if (ignore) return;
backgroundPosition: `-${petState.frameIndex * SPRITE_SIZE}px -${ROW_INDEX[petState.animation] * SPRITE_SIZE}px`,
function client() {
const root = document.getElementById("root");
client();
export default async function server(req: Request): Promise<Response> {
const pathSegment = new URL(req.url).pathname.split("/")[1];
valtowntown
@maxm
ποΈ Val Town Town Val Town implemented in Val Town. What if you want to build your own Val Town? What if you want features we haven't built yet? Val Town Town demonstrates how you can run untrusted code yourself. Extend it and see what you can build!
HTTP
await contentStore.init();
function Town() {
return (
</div>
function HomePage() {
return (
<textarea name="handler" rows={10} cols={50} autoFocus>
{`export default async function(req: Request) {
return Response.json("Hello, world!");
</html>
function ContentPage({ handler, id }: { handler: string; id: string }) {
return (
let originalContent = textarea.value;
textarea.addEventListener('input', function() {
if (textarea.value !== originalContent) {
isthegtrainfucked
@pbt
@jsxImportSource https://esm.sh/preact
HTTP
import { render } from "npm:preact-render-to-string";
import Uwuifier from "npm:uwuifier";
export default async function(req: Request) {
const uwuifier = new Uwuifier();
const query = new URL(req.url).searchParams;

ghAddAssigneesToAssignable
@augustohp
An interactive, runnable TypeScript val by augustohp
Script
export async function ghAddAssigneesToAssignable(
assignableId: string,
assigneeIds: string[],

myApi
@elsurudo
An interactive, runnable TypeScript val by elsurudo
Script
export function myApi(name) {
return "hi " + name;
valle_tmp_1112761154422132706439156901497722
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
aqi
@mateoclarke
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 = "80212"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
rssProxy
@lchtao26
@jsxImportSource https://esm.sh/preact
HTTP
const search = new URL(request.url).searchParams;
return search.get("url");
export default async function(request: Request): Promise<Response> {
const feedUrl = getFeedUrl(request);
if (!feedUrl) {
val_BUsb2yqi8y
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_BUsb2yqi8y(req) {
function generateStringProblems() {
"Write a function to find the longest palindromic substring",
"Implement a function to check if two strings are anagrams",
"Create a function to find the first non-repeating character",
"Write a function to perform string compression (e.g., 'aabbb' -> 'a2b3')",
"Implement a function to validate balanced parentheses"
function generateArrayProblems() {
"Implement a function to find the missing number in an array of 1 to N",
"Write a function to rotate an array by k positions",

myApiDeleteAll
@acmu
An interactive, runnable TypeScript val by acmu
Script
import { set } from "https://esm.town/v/std/set?v=11";
let { nameList } = await import("https://esm.town/v/acmu/nameList");
export async function myApiDeleteAll() {
nameList = [];
await set("nameList", nameList);
web_o6DeeRMtzQ
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_o6DeeRMtzQ(req) {
return new Response(`<!DOCTYPE html>
<html>
juicyBowTie
@all
fix pattern layering
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [mainColor, setMainColor] = useState("#666666");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
export default async function server(request: Request): Promise<Response> {
return new Response(
import { default as mod } from "${import.meta.url}";
if (mod && typeof mod === "function") mod();
</script>