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/$%7Burl%7D?q=function&page=1909&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 24619 results for "function"(2122ms)

reflective_qamain.tsx3 matches

@stevekrouseUpdated 5 months ago
10import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
11
12function App() {
13 const [notification, setNotification] = useState({ type: "success", message: "" });
14
329}
330
331function client() {
332 createRoot(document.getElementById("root")).render(<App />);
333}
334if (typeof document !== "undefined") { client(); }
335
336export default async function server(request: Request): Promise<Response> {
337 if (request.method === "POST" && new URL(request.url).pathname === "/ask") {
338 try {

sprightlyCyanScorpionmain.tsx1 match

@suleiman_hamzaUpdated 5 months ago
1export default async function (request: Request): Promise<Response> {
2 const data = {
3 message: "Hello, JSON World! 🌍",

returnJsonDatamain.tsx1 match

@suleiman_hamzaUpdated 5 months ago
1export default async function (request: Request): Promise<Response> {
2 const data = {
3 message: "Hello, JSON World! 🌍",

GameAwards2024PredictionGamemain.tsx3 matches

@bmitchinsonUpdated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [predictions, setPredictions] = useState({});
7 const [username, setUsername] = useState("");
149}
150
151function client() {
152 createRoot(document.getElementById("root")).render(<App />);
153}
156}
157
158export default async function server(request: Request): Promise<Response> {
159 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
160 const KEY = "GameAwards2024PredictionGame";

cerebras_codermain.tsx9 matches

@nn6nUpdated 5 months ago
15 "recipe ingredient converter and scaler",
16 "morse code translator with audio output",
17 "random quote generator with tweet functionality",
18 "personal finance tracker with basic charts",
19 "multiplayer rock-paper-scissors game",
20];
21
22function Dashboard() {
23 const [stats, setStats] = useState<{
24 totalGenerations: number;
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
115}
116
117function App() {
118 const [prompt, setPrompt] = useState(
119 STARTER_PROMPTS[Math.floor(Math.random() * STARTER_PROMPTS.length)],
141 });
142
143 async function handleSubmit(e: React.FormEvent) {
144 e.preventDefault();
145 setLoading(true);
174 }
175
176 function handleVersionChange(direction: "back" | "forward") {
177 const { currentVersionIndex, versions } = versionHistory;
178
305}
306
307function client() {
308 const path = window.location.pathname;
309 const root = createRoot(document.getElementById("root")!);
320}
321
322function extractCodeFromFence(text: string): string {
323 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
324 return htmlMatch ? htmlMatch[1].trim() : text;
325}
326
327export default async function server(req: Request): Promise<Response> {
328 // Dynamic import for SQLite to avoid client-side import
329 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

dedicatedAmethystLeopardmain.tsx7 matches

@mohsenUpdated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [stocks, setStocks] = useState([]);
7 const [newStock, setNewStock] = useState({
17 }, []);
18
19 async function fetchStocks() {
20 const response = await fetch('/stocks');
21 const data = await response.json();
23 }
24
25 function handleInputChange(e) {
26 const { name, value } = e.target;
27 setNewStock(prev => ({
31 }
32
33 async function addStock(e) {
34 e.preventDefault();
35 const response = await fetch('/stocks', {
54
55 // Calculate profit/loss
56 function calculateProfit(stock) {
57 if (!stock.sellingPrice) return null;
58 const totalPurchase = stock.quantity * stock.purchasePrice;
159}
160
161function client() {
162 createRoot(document.getElementById("root")).render(<App />);
163}
164if (typeof document !== "undefined") { client(); }
165
166export default async function server(request: Request): Promise<Response> {
167 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
168 const KEY = "dedicatedAmethystLeopard";

secureBlueTortoisemain.tsx1 match

@mohsenUpdated 5 months ago
1export default async function (e: Email) {
2
3}

blobReadPictureExamplemain.tsx1 match

@adnanwahabUpdated 5 months ago
1export default async function handler(request: Request): Promise<Response> {
2 const searchParams = new URL(request.url).searchParams;
3 const url = searchParams.get("url") || "https://www.browserbase.com";

cerebras_codermain.tsx9 matches

@mimoinverseUpdated 5 months ago
15 "recipe ingredient converter and scaler",
16 "morse code translator with audio output",
17 "random quote generator with tweet functionality",
18 "personal finance tracker with basic charts",
19 "multiplayer rock-paper-scissors game",
20];
21
22function Dashboard() {
23 const [stats, setStats] = useState<{
24 totalGenerations: number;
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
115}
116
117function App() {
118 const [prompt, setPrompt] = useState(
119 STARTER_PROMPTS[Math.floor(Math.random() * STARTER_PROMPTS.length)],
141 });
142
143 async function handleSubmit(e: React.FormEvent) {
144 e.preventDefault();
145 setLoading(true);
174 }
175
176 function handleVersionChange(direction: "back" | "forward") {
177 const { currentVersionIndex, versions } = versionHistory;
178
305}
306
307function client() {
308 const path = window.location.pathname;
309 const root = createRoot(document.getElementById("root")!);
320}
321
322function extractCodeFromFence(text: string): string {
323 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
324 return htmlMatch ? htmlMatch[1].trim() : text;
325}
326
327export default async function server(req: Request): Promise<Response> {
328 // Dynamic import for SQLite to avoid client-side import
329 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

currencymain.tsx1 match

@luizhriosUpdated 5 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3function fetchJSON(url) {
4 return fetch(url).then(res => res.json());
5}

getFileEmail4 file matches

@shouserUpdated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 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.