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=1362&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 20424 results for "function"(1325ms)

lastloginmain.tsx4 matches

@AIWB•Updated 3 months ago
1/** @jsxImportSource npm:hono/jsx */
2async function createSession(email: string, hostname: string) {
3 const { zip } = await import("https://esm.town/v/pomdtr/sql");
4 const { sqlite } = await import("https://esm.town/v/std/sqlite");
23}
24
25async function getSession(sessionID: string, hostname: string) {
26 const { zip } = await import("https://esm.town/v/pomdtr/sql");
27 const { sqlite } = await import("https://esm.town/v/std/sqlite");
52}
53
54async function deleteSession(sessionID: string) {
55 const { sqlite } = await import("https://esm.town/v/std/sqlite");
56
64const OAUTH_COOKIE = "oauth_store";
65
66export function lastlogin(
67 handler: (req: Request) => Response | Promise<Response>,
68) {

growingAquamarineFleamain.tsx10 matches

@SowrovCIV•Updated 3 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function Header() {
6 return (
7 <header className="bg-blue-500 text-white p-4 shadow-md">
20}
21
22function MainBanner() {
23 const [videoLink, setVideoLink] = useState('');
24
63}
64
65function FeaturesSection() {
66 const features = [
67 {
110}
111
112function HowItWorksSection() {
113 return (
114 <section className="bg-gray-100 p-8 rounded-lg shadow-md">
135}
136
137function FAQSection() {
138 const [activeIndex, setActiveIndex] = useState(null);
139
187}
188
189function ContactSection() {
190 const socialLinks = [
191 {
249}
250
251function Footer() {
252 return (
253 <footer className="bg-blue-500 text-white py-6">
278}
279
280function App() {
281 return (
282 <div className="flex flex-col min-h-screen">
296}
297
298function client() {
299 createRoot(document.getElementById("root")).render(<App />);
300}
301if (typeof document !== "undefined") { client(); }
302
303export default async function server(request: Request): Promise<Response> {
304 return new Response(`
305 <html>

tikTokVideoDownloadermain.tsx3 matches

@SowrovCIV•Updated 3 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [videoUrl, setVideoUrl] = useState('');
7 const [downloadLink, setDownloadLink] = useState('');
224};
225
226function client() {
227 createRoot(document.getElementById("root")).render(<App />);
228}
229if (typeof document !== "undefined") { client(); }
230
231export default async function server(request: Request): Promise<Response> {
232 return new Response(`
233 <html>

translatormain.tsx2 matches

@AIWB•Updated 3 months ago
346
347
348 // Helper function to get the supported MIME type
349 function getSupportedMimeType() {
350 const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
351 const mimeTypes = [

getLemmyJwtmain.tsx2 matches

@AIWB•Updated 3 months ago
1export async function getLemmyJwt({ instance, username, password }: {
2 instance: string;
3 username: string;
7 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
8 let client = new LemmyHttp(`https://${instance}`, {
9 fetchFunction: fetch,
10 });
11 try {

webhookHandlermain.tsx1 match

@AIWB•Updated 3 months ago
8});
9
10export default async function(req: Request): Promise<Response> {
11 if (req.method === "GET") {
12 return Response.json({ ignored: true });

URLReceivermainFunctionURLReciver21 match

@willthereader•Updated 3 months ago
3import { URLCrawler } from "./urlCrawlerComponent";
4
5export async function checkWebsite(inputURL: string) {
6 const urlReceiver = new URLReceiver();
7 const urlCrawler = new URLCrawler(3);

API_URLmain.tsx5 matches

@awhitter•Updated 3 months ago
96}
97
98// Helper function to safely get attachment URL
99function getAttachmentUrl(attachments: AirtableAttachment[] | undefined): string {
100 if (!attachments || !attachments[0]) return '';
101 return attachments[0].url;
103
104// Val Town HTTP Endpoint for Airtable → Framer Fetch
105export default async function (req: Request): Promise<Response> {
106 // Setup CORS Headers for Framer Fetch compatibility
107 const headers = new Headers({
149 } while (offset);
150
151 // Helper function to extract attachment URL
152 const getAttachmentUrl = (field: any): string => {
153 if (Array.isArray(field) && field[0]?.url) {
195 };
196
197 // Helper functions for AI analysis parsing
198 const extractTags = (analysis: string): string[] => {
199 const tagMatch = analysis.match(/Tags:([^\n]*)/);

Globemain.tsx3 matches

@johndevor•Updated 3 months ago
4import * as THREE from 'https://esm.sh/three@0.132.2';
5
6function HelloWorld() {
7 React.useEffect(() => {
8 const scene = new THREE.Scene();
119}
120
121function client() {
122 createRoot(document.getElementById("root")).render(<HelloWorld />);
123}
125if (typeof document !== "undefined") { client(); }
126
127export default async function server(request: Request) {
128 return new Response(`
129 <html>

codeOnValTownmain.tsx2 matches

@AIWB•Updated 3 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 } = {},

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks 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.