Search
web_pknUV9YbLu
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_pknUV9YbLu(req) {
return new Response(`<!DOCTYPE html>
<html>
regexToBrainrot
@stainless_em
@jsxImportSource https://stainless_em-brainrotdeps.web.val.run/2
HTTP
function hydrateReactElements(obj: any): any {
function brainrotReducer(state: Object, action: { type: "PATCH"; patch: any[] } | { type: "SET"; value: any }) {
function Spinner() {
function App({ state: { share } }: { state: State }) {
function client() {
export default async function server(request: Request): Promise<Response> {
{ OpenAI },
import("https://esm.town/v/std/openai"),
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
prodigiousTanTurtle
@ocholap9
/** Toll Management and Payment System This val implements a Toll Management and Payment System with separate interfaces for drivers, toll operators, and administrators. Features User Authentication: Register and login as a driver, toll operator, or administrator. Profile Management: Update user profile information. Vehicle Registration: Drivers can register and view their vehicles. Transaction History: Drivers can view their recent toll transactions. Toll Booth Management: Operators can view and update toll booth statuses. Revenue Reporting: Administrators can view revenue reports. Traffic Analytics: Administrators can access traffic analytics data. User Roles Driver: Can register vehicles, view transaction history, and manage their profile. Toll Operator: Can manage toll booth statuses. Administrator: Can access revenue reports and traffic analytics. How to Use Register an account with your desired role (driver, operator, or admin). Log in to access your role-specific dashboard. Navigate through the application using the provided links and forms. Note: This is a simplified version of a toll management system and does not include all features of a production-ready application.
*/
HTTP
function App() {
function Home({ user }) {
function Login({ setUser }) {
function Register() {
function Profile({ user }) {
function Logout({ setUser }) {
function DriverDashboard({ user }) {
function OperatorDashboard({ user }) {
function AdminDashboard({ user }) {
function client() {
stirringVioletHookworm
@ryan_alive
Twitter 𝕏 keyword alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. This val gets Twitter data via SocialData via
@stevekrouse/socialDataProxy. Val Town Pro users can call this API
100 times per day, so be sure not to set this cron to run more than once every 15 min.
If you want to use it more, get your own SocialData
API token and pay for it directly. 1. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 2. Notification Below I'm sending these mentions to a public channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
Cron
meta?: {
result_count: number;
export default async function aliveEvidenceSearchAlert({ lastRunAt }: Interval) {
console.log("Starting Alive Evidence search alert...");
try {

list_newest_vals_action
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { ListItem } from "https://esm.town/v/pomdtr/browser";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=44";
export default async function() {
const { vals } = await fetchJSON("https://www.val.town/newest?page=0&_data=routes/_app.newest");
const items = vals.map(val => {
youtubeSearchApp
@Pruthvi123
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function App() {
const [query, setQuery] = useState('');
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
sampleVanSSR
@reosablo
simple SSR + hydration example with VanJS
HTTP
/** load client HTML */
async function loadClientHtml() {
// import VanJS framework and App component
/** load client script for App component hydration */
async function loadClientScript() {
// import esbuild and plugins
return result.outputFiles[0].text;
export default async function fetch(req: Request) {
try {
LifeLogFitbitAuthorize
@snowypowers
* Visit this url to get authorized for lifelog to collect data.
HTTP
const verifier = crypto.randomUUID().replace(/-/g, "").repeat(4); // Needs to be 43 - 128 chars.
* Visit this url to get authorized for lifelog to collect data.
export default async function(req: Request): Promise<Response> {
console.log(`verifier: ${verifier}`);
blob.set(`fibit_state_${state}`, verifier);
what_did_i_work_on_today
@danphilibin
@jsxImportSource https://esm.sh/react
HTTP
const ErrorMessage = memo(({ message }: { message: string }) => <div className="error">Error: {message}</div>);
function App() {
const [data, setData] = useState<{
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
new Response(JSON.stringify({ message }), { status, headers: JSON_HEADERS });
export default async function server(req: Request): Promise<Response> {
const url = new URL(req.url);

savedNamedPlaygrounds
@kaleidawave
For the future playground for the Ezno type checker: https://github.com/kaleidawave/ezno/pull/115 Can save an id for a content and recall content from an id (thus acting as a sort of compressor) Inspired by how the https://play.rust-lang.org/ shares playgrounds. (However uses a SQL-lite db hosted by Valtown rather than GitHub gists)
HTTP
const reversed_order = Array.from({ length: 32 }, (_, i) => order.indexOf(i));
const radix = 36;
export default async function(req: Request): Promise<Response> {
if (req.method === "POST") {
const { content } = await req.json();

cabinAdjacentTweets
@jonbo
scans tweets and then uses an llm to decide whether to and where to send it to forked from https://www.val.town/v/stevekrouse/twitterAlert
Cron
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
async function isTweetProcessed(tweetId: string): Promise<boolean> {
async function markTweetAsProcessed(tweetId: string, tweetText: string): Promise<void> {
// Core API functions
async function searchTweets(query: string, startTime: Date): Promise<Tweet[]> {
async function getUserTweets(username: string, startTime: Date): Promise<Tweet[]> {
// Search functions
async function scanKeywords(startTime: Date): Promise<Tweet[]> {
async function scanAccounts(startTime: Date): Promise<Tweet[]> {
Globe
@johndevor
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import * as THREE from 'https://esm.sh/three@0.132.2';
function HelloWorld() {
React.useEffect(() => {
<div className="w-screen h-screen m-0 overflow-hidden bg-black"></div>
function client() {
createRoot(document.getElementById("root")).render(<HelloWorld />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request) {
return new Response(`

githubParser
@yawnxyz
// Add new endpoint to handle file type fetching
HTTP
async function updateRepoList() {
function displayRepoData(repo) {
function updateStats(content) {
function updateTokenCounts(tokenCounts) {
// Add this new function to parse the patterns
function parseIgnoredPatterns() {
async function fetchFileTypes(repoUrl) {
function displayFileTypeSelector(fileTypes, ignoredPatterns) {
function getTiktokenSegments(encoder, inputText) {
function getFileExtension(filename) {
celestialBeigeDove
@jacoblefneu
// Fetches a random joke.
Script
// Fetches a random joke.
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
aqi
@davidhariri
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 = "Toronto, Canada"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });