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/$%7Bart_info.art.src%7D?q=function&page=2483&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 28581 results for "function"(7479ms)

sendSMSmain.tsx2 matches

@dtensor•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) {

razzamain.tsx9 matches

@gio•Updated 9 months ago
7const TABLE_NAME = `${KEY}_razza_users_${SCHEMA_VERSION}`;
8
9async function initDB() {
10 await sqlite.execute(`
11 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
21}
22
23function generateQRCode(text: string): string {
24 const qr = qrcode(0, 'L');
25 qr.addData(text);
117 let existingCodes = [];
118
119 function updateExistingCodes() {
120 const category = document.getElementById('filterCategory').value;
121 fetch('/existing-qr-codes?category=' + encodeURIComponent(category))
127 }
128
129 function renderExistingCodes() {
130 const container = document.getElementById('qrCodesContainer');
131 container.innerHTML = '';
147 }
148
149 function updateCountdowns() {
150 const countdowns = document.querySelectorAll('.countdown');
151 const now = new Date();
162 }
163
164 function formatPhoneNumber(phoneNumberString) {
165 const cleaned = phoneNumberString.replace(/\\D/g, '');
166 const match = cleaned.match(/^(\\d{0,3})(\\d{0,3})(\\d{0,4})$/);
178 }
179
180 document.getElementById('phone').addEventListener('input', function(e) {
181 const input = e.target;
182 const formatted = formatPhoneNumber(input.value);
184 });
185
186 function validatePhoneNumber(phone) {
187 const phoneRegex = /^\\(\\d{3}\\)\\s\\d{3}-\\d{4}$/;
188 return phoneRegex.test(phone);
225`;
226
227export default async function server(req: Request): Promise<Response> {
228 try {
229 await initDB();

labLoginDeleteAccountmain.tsx1 match

@todepond•Updated 9 months ago
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4export default async function(req: Request): Promise<Response> {
5 const TABLE_NAME = "lab_login_users_with_times";
6 const body = await req.json();

labLoginBanUsermain.tsx1 match

@todepond•Updated 9 months ago
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4export default async function(req: Request): Promise<Response> {
5 const TABLE_NAME = "lab_login_users_with_times";
6 const body = await req.json();

townGenmain.tsx15 matches

@cofsana•Updated 9 months ago
9 * Added 25 small prompt phrases below the generate button to assist in website generation.
10 * A welcome message from the Mayor of val.town is now included.
11 * When submitted, it now iterates step by step in a tree structure on features for main functionality.
12 * Sub-functionalities are now listed under the main functionality to help describe it better.
13 */
14/** @jsxImportSource https://esm.sh/react */
124 "serverless",
125 "aws-sdk",
126 "azure-functions",
127 ],
128 database: [
270];
271
272function App() {
273 const [idea, setIdea] = useState("");
274 const [prompt, setPrompt] = useState("");
294 }
295
296 const subFunctionalities = generateSubFunctionalities(idea);
297
298 const generatedPrompt = `Create a Hono application for Deno with the following features:
2991. Main functionality: ${idea}
300 Sub-functionalities:
301 ${subFunctionalities.map(sub => ` - ${sub}`).join("\n")}
3022. Incorporate Hono features:
303 ${features.hono.map(feature => `- ${feature}`).join("\n ")}
330 "Initialize project structure",
331 "Set up Hono router",
332 "Implement main functionality logic",
333 "Add database integration",
334 "Implement authentication system",
342 };
343
344 const generateSubFunctionalities = (mainIdea: string) => {
345 // This is a simple example. In a real-world scenario, you might use AI or a more sophisticated algorithm
346 const commonSubFunctionalities = [
347 "User authentication and authorization",
348 "Data persistence and retrieval",
352 ];
353
354 const specificSubFunctionalities = mainIdea.split(" ")
355 .filter(word => word.length > 3)
356 .map(word => `${word.charAt(0).toUpperCase() + word.slice(1)} management`);
357
358 return [...new Set([...commonSubFunctionalities, ...specificSubFunctionalities])].slice(0, 5);
359 };
360
516}
517
518function client() {
519 createRoot(document.getElementById("root")).render(<App />);
520}
524}
525
526async function server(request: Request): Promise<Response> {
527 return new Response(
528 `

townGenmain.tsx15 matches

@all•Updated 9 months ago
9 * Added 25 small prompt phrases below the generate button to assist in website generation.
10 * A welcome message from the Mayor of val.town is now included.
11 * When submitted, it now iterates step by step in a tree structure on features for main functionality.
12 * Sub-functionalities are now listed under the main functionality to help describe it better.
13 */
14/** @jsxImportSource https://esm.sh/react */
124 "serverless",
125 "aws-sdk",
126 "azure-functions",
127 ],
128 database: [
270];
271
272function App() {
273 const [idea, setIdea] = useState("");
274 const [prompt, setPrompt] = useState("");
294 }
295
296 const subFunctionalities = generateSubFunctionalities(idea);
297
298 const generatedPrompt = `Create a Hono application for Deno with the following features:
2991. Main functionality: ${idea}
300 Sub-functionalities:
301 ${subFunctionalities.map(sub => ` - ${sub}`).join("\n")}
3022. Incorporate Hono features:
303 ${features.hono.map(feature => `- ${feature}`).join("\n ")}
330 "Initialize project structure",
331 "Set up Hono router",
332 "Implement main functionality logic",
333 "Add database integration",
334 "Implement authentication system",
342 };
343
344 const generateSubFunctionalities = (mainIdea: string) => {
345 // This is a simple example. In a real-world scenario, you might use AI or a more sophisticated algorithm
346 const commonSubFunctionalities = [
347 "User authentication and authorization",
348 "Data persistence and retrieval",
352 ];
353
354 const specificSubFunctionalities = mainIdea.split(" ")
355 .filter(word => word.length > 3)
356 .map(word => `${word.charAt(0).toUpperCase() + word.slice(1)} management`);
357
358 return [...new Set([...commonSubFunctionalities, ...specificSubFunctionalities])].slice(0, 5);
359 };
360
516}
517
518function client() {
519 createRoot(document.getElementById("root")).render(<App />);
520}
524}
525
526async function server(request: Request): Promise<Response> {
527 return new Response(
528 `

promptGenmain.tsx3 matches

@all•Updated 9 months ago
21];
22
23function App() {
24 const [idea, setIdea] = useState("");
25 const [prompt, setPrompt] = useState("");
81}
82
83function client() {
84 createRoot(document.getElementById("root")).render(<App />);
85}
89}
90
91async function server(request: Request): Promise<Response> {
92 const url = new URL(request.url);
93

multirouteHonomain.tsx5 matches

@cofsana•Updated 9 months ago
12const app = new Hono();
13
14function App() {
15 const [page, setPage] = React.useState('home');
16
53}
54
55function HomePage() {
56 return (
57 <div>
62}
63
64function AboutPage() {
65 return (
66 <div>
71}
72
73function ServicesPage() {
74 return (
75 <div>
86}
87
88function client() {
89 createRoot(document.getElementById("root")).render(<App />);
90}

pollRSSFeedsmain.tsx1 match

@cdnclass•Updated 9 months ago
3import { rssFeeds } from "https://www.val.town/v/cdnclass/scrawnyLavenderThrush/rssFeeds";
4
5export async function pollRSSFeeds({ lastRunAt }: Interval) {
6 return Promise.all(
7 Object.entries(rssFeeds).map(async ([name, url]) => {

valleBlogV0main.tsx4 matches

@roadlabs•Updated 9 months ago
8import _ from "npm:lodash@4";
9
10async function main(req: Request): Promise<Response> {
11 const { readable, writable } = new TransformStream();
12 const writer = writable.getWriter();
20 <script>
21 // Scroll to the bottom of the page when the page changes.
22 (new MutationObserver(function (mutationsList, observer) {
23 window.scrollTo({ left: 0, top: document.body.scrollHeight, behavior: "instant" });
24 })).observe(document, { childList: true, characterData: true, subtree: true });
47 Your response should start with \`\`\`ts and end with \`\`\`, so full code fences.
48 There should be no comments like "more content here", it should be complete and directly runnable.
49 The val should have an "export default async function main". The val should return a valid HTML website.
50 Prefer using Tailwind. Put frontend functions in a <script> tag, using dangerouslySetInnerHTML. Don't use Hono. Don't use Response.redirect.
51 `.replace("\n", " "),
52 },

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.