Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$1?q=function&page=2451&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 31546 results for "function"(19233ms)

calculatormain.tsx3 matches

@NiD•Updated 4 months ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function Calculator() {
6 const [display, setDisplay] = useState("0");
7 const [previousValue, setPreviousValue] = useState(null);
80}
81
82function client() {
83 createRoot(document.getElementById("root")).render(<Calculator />);
84}
85if (typeof document !== "undefined") { client(); }
86
87export default async function server(request: Request): Promise<Response> {
88 return new Response(
89 `

voiceControlCalculatormain.tsx3 matches

@NiD•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function VoiceCalculator() {
6 const [result, setResult] = useState('0');
7 const [isListening, setIsListening] = useState(false);
132}
133
134function client() {
135 createRoot(document.getElementById("root")).render(<VoiceCalculator />);
136}
138if (typeof document !== "undefined") { client(); }
139
140export default async function server(request: Request): Promise<Response> {
141 return new Response(`
142 <html>
simpleSqliteLock

simpleSqliteLockREADME.md1 match

@maxm•Updated 4 months ago
12const lock = new SqliteLock(projectVal.name, twoMinutes);
13
14export default async function(interval: Interval) {
15 await lock.lock()
16}
simpleSqliteLock

simpleSqliteLockexample1 match

@maxm•Updated 4 months ago
6const lock = new SqliteLock(projectVal.name, twoMinutes);
7
8export default async function(interval: Interval) {
9 console.log(await lock.lock());
10}

nobleBronzeBadgerexclusiveAmethystRoadrunner1 match

@yus100•Updated 4 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

hardballcitysubmitLink9 matches

@flymaster•Updated 4 months ago
6
7const authDomain = Deno.env.get("CLERK_DOMAIN");
8export default async function(req: Request): Promise<Response> {
9 const app = await getApp();
10
12}
13
14export async function getApp(): Promise<Hono> {
15 var app = new Hono();
16 app.use(clerkMiddleware());
21}
22
23async function newLinkForm(c): Promise<string> {
24 const auth = getAuth(c);
25 if (!auth?.userId) {
38}
39
40export async function linkExists(url: string): Promise<boolean> {
41 var rows = await sqlite.execute(
42 "SELECT * FROM hbc_stories WHERE url = ? AND (CURRENT_TIMESTAMP - posted) < (86400 * 60)",
46}
47
48export async function insertLink(title: string, url: string, poster: string) {
49 await sqlite.execute({
50 sql: `INSERT INTO hbc_stories (title, url, poster) VALUES (?, ?, ?)`,
53}
54
55async function addLink(c): Promise<string> {
56 const auth = getAuth(c);
57 if (auth?.userId) {
68}
69
70function dupe(c): string {
71 return template(`
72 <h3>Duplicate link</h3>
75}
76
77// Helper function to escape HTML special characters
78function escapeHtml(str: string): string {
79 return str
80 .replace(/&/g, "&amp;")

hardballcitymlbCron1 match

@flymaster•Updated 4 months ago
2import { insertLink, linkExists } from "./submitLink";
3
4export default async function(interval: Interval) {
5 // Get the first story from mlb.com rss feed
6 let parser = new Parser({

SideProjectSaturdaylogic.ts3 matches

@zeko•Updated 4 months ago
17const guests: Record<string, Guest> = {};
18
19export function addGuest(name: string, email: string): string {
20 // Check if guest already exists with this email
21 const existingGuest = Object.values(guests).find(g => g.email === email);
36}
37
38export function getNextEventStatus(): EventStatus {
39 const now = new Date();
40 const nextSaturday = new Date(now);
60export type SignupData = z.infer<typeof SignupSchema>;
61
62export function getEventDateMessage(date: Date | null): string {
63 if (!date) return "Most Saturday Mornings";
64

SideProjectSaturdayemail.ts1 match

@zeko•Updated 4 months ago
10// });
11
12export function sendGuestProfileLink() {
13 resend.emails.send({
14 from: "info@sideprojectsaturday",

weather_forecast_in_the_morningmain.tsx1 match

@flafi87•Updated 4 months ago
158 await fetch(telegramSendUrl);
159};
160export default async function(interval: Interval) {
161 const forecast = await fetchForecast();
162 const formatted = formatWeatherForecast(forecast);
tuna

tuna9 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.