Search

Results include substring matches and semantically similar vals. Learn more
hudini avatar
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 });
nknj avatar
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);
iLegacyy avatar
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(
stanley avatar
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() {
stevekrouse avatar
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("");
iamseeley avatar
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;
willthereader avatar
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
janpaul123 avatar
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" } });
zane avatar
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 });
u avatar
jadeCod
@u
An interactive, runnable TypeScript val by u
HTTP
export async function handlePlexWebhook(req: Request) {
console.log(await req.text());
stevekrouse avatar
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;
jbwinters avatar
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");
vs avatar
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?" +
iamseeley avatar
SignupModal
@iamseeley
@jsxImportSource https://esm.sh/hono@latest/jsx
Script
/** @jsxImportSource https://esm.sh/hono@latest/jsx */
export default function SignupModal() {
return (
<div id="signup-modal" className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 animate-fadeIn">
DegenHowAI avatar
chivalrousBronzeTiger
@DegenHowAI
An interactive, runnable TypeScript val by DegenHowAI
Script
export default function (req: any) {
// Simple validation to ensure this is an n8n webhook
if (req && req[0]?.webhookUrl?.includes('n8n.cloud')) {