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/?q=function&page=2450&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 28208 results for "function"(4267ms)

codeOnValTownmain.tsx2 matches

@Serizon•Updated 9 months ago
9 * @param val Define which val should open. Defaults to the root reference
10 */
11export function modifyHtmlString(
12 bodyText: string,
13 { val, style }: { val?: ValRef; style?: string } = {},
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style }: { val?: ValRef; style?: string } = {},

umapmain.tsx3 matches

@ejfox•Updated 9 months ago
34const resultCache = new Map();
35
36export default async function server(request: Request): Promise<Response> {
37 if (request.method === "GET") {
38 return new Response(html, {
171const openai = new OpenAI();
172
173async function getEmbeddings(texts) {
174 const response = await openai.embeddings.create({
175 model: "text-embedding-ada-002",
203
204 <script>
205 function runDemo() {
206 const testData = {
207 embeddings: Array.from({length: 100}, () => Array.from({length: 10}, () => Math.random())),

zod_demo_frontendmain.tsx1 match

@stevekrouse•Updated 9 months ago
4import type { User } from "https://esm.town/v/stevekrouse/zod_demo_shared";
5
6export function App() {
7 const [user, setUser] = useState<User>({ username: "", email: "", age: 0 });
8 const [errors, setErrors] = useState<Partial<User>>({});

zod_demo_httpmain.tsx1 match

@stevekrouse•Updated 9 months ago
2import { UserSchema } from "https://esm.town/v/stevekrouse/zod_demo_shared";
3
4async function server(request: Request): Promise<Response> {
5 if (request.method === "POST" && new URL(request.url).pathname === "/register") {
6 try {

weatherGPTmain.tsx1 match

@sarfrazkhan18•Updated 9 months ago
31console.log(text);
32
33export async function weatherGPT() {
34 await email({ subject: "Weather Today", text });
35}

aqimain.tsx1 match

@sarfrazkhan18•Updated 9 months ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "downtown brooklyn"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

turnitdownmain.tsx1 match

@yawnxyz•Updated 9 months ago
82});
83
84export default async function server(req: Request): Promise<Response> {
85 return app.fetch(req);
86}

turnitdownREADME.md1 match

@yawnxyz•Updated 9 months ago
141. The application uses the Hono framework to create a simple web server.
152. HTMX is used for handling AJAX requests without writing JavaScript.
163. Alpine.js provides reactivity for the clipboard functionality.
174. The Turndown library is used to convert HTML to Markdown.
18

newslymain.tsx2 matches

@yawnxyz•Updated 9 months ago
1/**
2 * This val creates an email storage system using SQLite.
3 * It stores each email sent through the 'newsly' function into a SQLite database.
4 * The email address of the sender is used as the key.
5 * We'll use the sqlite module for database operations and the email module for sending emails.
9
10
11export async function newsly2(e: {
12 from: string;
13 to: string[];

excessPlumCapybaramain.tsx2 matches

@yawnxyz•Updated 9 months ago
8};
9
10export async function sendSMS(phoneNumber: string, message: string, carrier: string): Promise<void> {
11 const carrierDomain = carriers[carrier.toLowerCase()];
12 if (!carrierDomain) {
22 text: message,
23 });
24 console.log('Email function returned:', result);
25 console.log('SMS sent successfully');
26 } catch (error) {

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
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.