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=1130&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 17345 results for "function"(3147ms)

AICodeGeneratorAppmain.tsx6 matches

@mrshorts•Updated 4 months ago
4
5// Main App Component
6function AppCraftAI() {
7 const [appConcept, setAppConcept] = useState('');
8 const [generatedApp, setGeneratedApp] = useState(null);
87import React, { useState } from 'react';
88
89function App() {
90 const [feature, setFeature] = useState('');
91
93 <div>
94 <h1>Sample App</h1>
95 <p>Basic app structure with placeholder functionality</p>
96 </div>
97 );
122 const simulateAppTesting = () => {
123 const testResults = [
124 { type: 'Functionality', passed: Math.random() > 0.2 },
125 { type: 'Performance', passed: Math.random() > 0.1 },
126 { type: 'User Experience', passed: Math.random() > 0.3 },
248}
249
250function client() {
251 createRoot(document.getElementById("root")).render(<AppCraftAI />);
252}
253if (typeof document !== "undefined") { client(); }
254
255export default async function server(request: Request): Promise<Response> {
256 return new Response(`
257 <html>

cerebras_codermain.tsx11 matches

@cguilarte•Updated 4 months ago
24);
25
26function Hero({
27 prompt,
28 setPrompt,
45
46 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47 Turn your ideas into fully functional apps in{" "}
48 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49 less than a second
116}
117
118function App() {
119 const previewRef = React.useRef<HTMLDivElement>(null);
120 const [prompt, setPrompt] = useState("");
170 });
171
172 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173 setLoading(true);
174 setTimeout(() => handleSubmit(promptItem.prompt), 0);
175 }
176
177 async function handleSubmit(e: React.FormEvent | string) {
178 if (typeof e !== "string") {
179 e.preventDefault();
226 }
227
228 function handleVersionChange(direction: "back" | "forward") {
229 const { currentVersionIndex, versions } = versionHistory;
230 if (direction === "back" && currentVersionIndex > 0) {
974);
975
976function client() {
977 const path = window.location.pathname;
978 const root = createRoot(document.getElementById("root")!);
1010}
1011
1012function extractCodeFromFence(text: string): string {
1013 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014 return htmlMatch ? htmlMatch[1].trim() : text;
1015}
1016
1017async function generateCode(prompt: string, currentCode: string) {
1018 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019 if (starterPrompt) {
1060}
1061
1062export default async function cerebras_coder(req: Request): Promise<Response> {
1063 // Dynamic import for SQLite to avoid client-side import
1064 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163 <meta property="og:site_name" content="Cerebras Coder">
1164 <meta property="og:url" content="https://cerebrascoder.com"/>
1165 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166 <meta property="og:type" content="website">
1167 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

gemini_codermain.tsx4 matches

@awhitter•Updated 4 months ago
22);
23
24function Hero({
25 prompt,
26 setPrompt,
114}
115
116function App() {
117 const [prompt, setPrompt] = useState("");
118 const [response, setResponse] = useState<string | null>(null);
178}
179
180function client() {
181 createRoot(document.getElementById("root")).render(<App />);
182}
183if (typeof document !== "undefined") { client(); }
184
185export default async function content_marketing_mastery(req: Request): Promise<Response> {
186 const KEY = "content_marketing_mastery";
187 const SCHEMA_VERSION = 1;

chatgptPromptWebsitemain.tsx3 matches

@tarekr93•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function AdvancedPromptGenerator() {
6 const [role, setRole] = useState('');
7 const [task, setTask] = useState('');
142}
143
144function client() {
145 createRoot(document.getElementById("root")).render(<AdvancedPromptGenerator />);
146}
147if (typeof document !== "undefined") { client(); }
148
149export default async function server(request: Request): Promise<Response> {
150 return new Response(`
151 <html>

jsonBodyParsingmain.tsx1 match

@ramirovalim•Updated 4 months ago
1export default async function handler(request: Request) {
2 if (request.method !== "GET" && request.method !== "POST") {
3 return Response.json({ message: "This val responds to GET and POST requests." }, {

cerebras_codermain.tsx11 matches

@axz2•Updated 4 months ago
24);
25
26function Hero({
27 prompt,
28 setPrompt,
45
46 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47 Turn your ideas into fully functional apps in{" "}
48 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49 less than a second
116}
117
118function App() {
119 const previewRef = React.useRef<HTMLDivElement>(null);
120 const [prompt, setPrompt] = useState("");
170 });
171
172 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173 setLoading(true);
174 setTimeout(() => handleSubmit(promptItem.prompt), 0);
175 }
176
177 async function handleSubmit(e: React.FormEvent | string) {
178 if (typeof e !== "string") {
179 e.preventDefault();
226 }
227
228 function handleVersionChange(direction: "back" | "forward") {
229 const { currentVersionIndex, versions } = versionHistory;
230 if (direction === "back" && currentVersionIndex > 0) {
974);
975
976function client() {
977 const path = window.location.pathname;
978 const root = createRoot(document.getElementById("root")!);
1010}
1011
1012function extractCodeFromFence(text: string): string {
1013 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014 return htmlMatch ? htmlMatch[1].trim() : text;
1015}
1016
1017async function generateCode(prompt: string, currentCode: string) {
1018 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019 if (starterPrompt) {
1060}
1061
1062export default async function cerebras_coder(req: Request): Promise<Response> {
1063 // Dynamic import for SQLite to avoid client-side import
1064 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163 <meta property="og:site_name" content="Cerebras Coder">
1164 <meta property="og:url" content="https://cerebrascoder.com"/>
1165 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166 <meta property="og:type" content="website">
1167 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

cerebras_codermain.tsx11 matches

@constantlycooking•Updated 4 months ago
24);
25
26function Hero({
27 prompt,
28 setPrompt,
45
46 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47 Turn your ideas into fully functional apps in{" "}
48 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49 less than a second
116}
117
118function App() {
119 const previewRef = React.useRef<HTMLDivElement>(null);
120 const [prompt, setPrompt] = useState("");
170 });
171
172 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173 setLoading(true);
174 setTimeout(() => handleSubmit(promptItem.prompt), 0);
175 }
176
177 async function handleSubmit(e: React.FormEvent | string) {
178 if (typeof e !== "string") {
179 e.preventDefault();
226 }
227
228 function handleVersionChange(direction: "back" | "forward") {
229 const { currentVersionIndex, versions } = versionHistory;
230 if (direction === "back" && currentVersionIndex > 0) {
974);
975
976function client() {
977 const path = window.location.pathname;
978 const root = createRoot(document.getElementById("root")!);
1010}
1011
1012function extractCodeFromFence(text: string): string {
1013 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014 return htmlMatch ? htmlMatch[1].trim() : text;
1015}
1016
1017async function generateCode(prompt: string, currentCode: string) {
1018 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019 if (starterPrompt) {
1060}
1061
1062export default async function cerebras_coder(req: Request): Promise<Response> {
1063 // Dynamic import for SQLite to avoid client-side import
1064 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163 <meta property="og:site_name" content="Cerebras Coder">
1164 <meta property="og:url" content="https://cerebrascoder.com"/>
1165 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166 <meta property="og:type" content="website">
1167 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

shorturlmain.tsx4 matches

@cocodrilette•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function generateShortCode(length = 5) {
6 const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
7 return Array.from(crypto.getRandomValues(new Uint8Array(length)))
10}
11
12function App() {
13 const [longUrl, setLongUrl] = useState('');
14 const [shortUrl, setShortUrl] = useState('');
167}
168
169function client() {
170 createRoot(document.getElementById("root")).render(<App />);
171}
172if (typeof document !== "undefined") { client(); }
173
174export default async function server(request: Request): Promise<Response> {
175 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
176 const KEY = "shorturl";

tldraw_computer_examplemain.tsx1 match

@sparker•Updated 4 months ago
64};
65
66export default async function(req: Request): Promise<Response> {
67 if (req.method === "GET") {
68 // handle a GET request

WebSiteReactmain.tsx2 matches

@vyatka•Updated 4 months ago
3import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
4
5export default function(_req: Request) {
6 const jobHistory = [
7 {
15 role: "Web Developer",
16 period: "2018 - 2021",
17 description: "Developed responsive web applications and collaborated with cross-functional teams to deliver high-quality software solutions."
18 },
19 {

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week 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.