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=1071&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 17298 results for "function"(2781ms)

cerebrasTemplatemain.tsx3 matches

@rootvertex•Updated 3 months ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [messages, setMessages] = useState([]);
7 const [input, setInput] = useState("");
71}
72
73function client() {
74 createRoot(document.getElementById("root")).render(<App />);
75}
79}
80
81export default async function server(request: Request): Promise<Response> {
82 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
83 const { messages } = await request.json();

Code_Debuggermain.tsx6 matches

@sakshamkapoor2911•Updated 3 months ago
8const marked = markedLib.marked;
9
10function App() {
11 const [messages, setMessages] = useState([]);
12 const [input, setInput] = useState("");
35 // Configure marked for enhanced markdown rendering
36 marked.setOptions({
37 highlight: function(code, lang) {
38 try {
39 return hljs.highlight(code, { language: lang || "plaintext" }).value;
138}
139
140function client() {
141 // Load highlight.js and markdown CSS
142 const links = [
166}
167
168export default async function server(request: Request): Promise<Response> {
169 if (request.method === "POST" && new URL(request.url).pathname === "/debug") {
170 const { messages, context } = await request.json();
171 const lastUserMessage = messages[messages.length - 1].content;
172
173 // Function to search StackOverflow
174 async function searchStackOverflow(query: string) {
175 try {
176 const response = await fetch(

productiveCyanPigeonmain.tsx6 matches

@gratitude5dee•Updated 3 months ago
11import React, { useState, useEffect } from 'react';
12
13function MemeCoin() {
14 const [tokenSupply, setTokenSupply] = useState(1000000);
15 const [price, setPrice] = useState(0.01);
45import React, { useState, useEffect } from 'react';
46
47function MemeCoin() {
48 const [tokenSupply, setTokenSupply] = useState(500000);
49 const [price, setPrice] = useState(0.05);
88];
89
90function MemeCoinCodeGenerator() {
91 const [selectedTemplate, setSelectedTemplate] = useState(STARTER_PROMPTS[0]);
92 const [generatedCode, setGeneratedCode] = useState(selectedTemplate.baseCode);
161}
162
163function App() {
164 return <MemeCoinCodeGenerator />;
165}
166
167function client() {
168 createRoot(document.getElementById("root")).render(<App />);
169}
170if (typeof document !== "undefined") { client(); }
171
172export default async function server(request: Request): Promise<Response> {
173 return new Response(`
174 <html>

cerebras_codermain.tsx3 matches

@buddydagamer•Updated 3 months ago
28);
29
30function FinanceApp() {
31 // Existing state variables
32 const [income, setIncome] = useState([]);
283}
284
285function client() {
286 createRoot(document.getElementById("root")).render(<FinanceApp />);
287}
289if (typeof document !== "undefined") { client(); }
290
291export default async function server(request: Request) {
292 return new Response(`
293 <!DOCTYPE html>

fastPlumBonobomain.tsx11 matches

@gratitude5dee•Updated 3 months ago
73const PoweredByInfo = "";
74
75function Hero({
76 prompt,
77 setPrompt,
94
95 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
96 Turn your ideas into fully functional apps in{" "}
97 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
98 less than a second
168}
169
170function App() {
171 const previewRef = React.useRef<HTMLDivElement>(null);
172 const [prompt, setPrompt] = useState("");
222 });
223
224 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
225 setLoading(true);
226 setTimeout(() => handleSubmit(promptItem.prompt), 0);
227 }
228
229 async function handleSubmit(e: React.FormEvent | string) {
230 if (typeof e !== "string") {
231 e.preventDefault();
278 }
279
280 function handleVersionChange(direction: "back" | "forward") {
281 const { currentVersionIndex, versions } = versionHistory;
282 if (direction === "back" && currentVersionIndex > 0) {
994);
995
996function client() {
997 const path = window.location.pathname;
998 const root = createRoot(document.getElementById("root")!);
1030}
1031
1032function extractCodeFromFence(text: string): string {
1033 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1034 return htmlMatch ? htmlMatch[1].trim() : text;
1035}
1036
1037async function generateCode(prompt: string, currentCode: string) {
1038 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1039 if (starterPrompt) {
1080}
1081
1082export default async function cerebras_coder(req: Request): Promise<Response> {
1083 // Dynamic import for SQLite to avoid client-side import
1084 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1183 <meta property="og:site_name" content="Cerebras Coder">
1184 <meta property="og:url" content="https://cerebrascoder.com"/>
1185 <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."">
1186 <meta property="og:type" content="website">
1187 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

observantBronzeOrcamain.tsx11 matches

@gratitude5dee•Updated 3 months ago
73const PoweredByInfo = "";
74
75function Hero({
76 prompt,
77 setPrompt,
94
95 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
96 Turn your ideas into fully functional apps in{" "}
97 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
98 less than a second
168}
169
170function App() {
171 const previewRef = React.useRef<HTMLDivElement>(null);
172 const [prompt, setPrompt] = useState("");
222 });
223
224 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
225 setLoading(true);
226 setTimeout(() => handleSubmit(promptItem.prompt), 0);
227 }
228
229 async function handleSubmit(e: React.FormEvent | string) {
230 if (typeof e !== "string") {
231 e.preventDefault();
278 }
279
280 function handleVersionChange(direction: "back" | "forward") {
281 const { currentVersionIndex, versions } = versionHistory;
282 if (direction === "back" && currentVersionIndex > 0) {
994);
995
996function client() {
997 const path = window.location.pathname;
998 const root = createRoot(document.getElementById("root")!);
1030}
1031
1032function extractCodeFromFence(text: string): string {
1033 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1034 return htmlMatch ? htmlMatch[1].trim() : text;
1035}
1036
1037async function generateCode(prompt: string, currentCode: string) {
1038 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1039 if (starterPrompt) {
1080}
1081
1082export default async function cerebras_coder(req: Request): Promise<Response> {
1083 // Dynamic import for SQLite to avoid client-side import
1084 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1183 <meta property="og:site_name" content="Cerebras Coder">
1184 <meta property="og:url" content="https://cerebrascoder.com"/>
1185 <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."">
1186 <meta property="og:type" content="website">
1187 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

cerebras_codermain.tsx11 matches

@smc•Updated 3 months ago
73const PoweredByInfo = "";
74
75function Hero({
76 prompt,
77 setPrompt,
94
95 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
96 Turn your ideas into fully functional apps in{" "}
97 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
98 less than a second
168}
169
170function App() {
171 const previewRef = React.useRef<HTMLDivElement>(null);
172 const [prompt, setPrompt] = useState("");
222 });
223
224 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
225 setLoading(true);
226 setTimeout(() => handleSubmit(promptItem.prompt), 0);
227 }
228
229 async function handleSubmit(e: React.FormEvent | string) {
230 if (typeof e !== "string") {
231 e.preventDefault();
278 }
279
280 function handleVersionChange(direction: "back" | "forward") {
281 const { currentVersionIndex, versions } = versionHistory;
282 if (direction === "back" && currentVersionIndex > 0) {
994);
995
996function client() {
997 const path = window.location.pathname;
998 const root = createRoot(document.getElementById("root")!);
1030}
1031
1032function extractCodeFromFence(text: string): string {
1033 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1034 return htmlMatch ? htmlMatch[1].trim() : text;
1035}
1036
1037async function generateCode(prompt: string, currentCode: string) {
1038 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1039 if (starterPrompt) {
1080}
1081
1082export default async function cerebras_coder(req: Request): Promise<Response> {
1083 // Dynamic import for SQLite to avoid client-side import
1084 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1183 <meta property="og:site_name" content="Cerebras Coder">
1184 <meta property="og:url" content="https://cerebrascoder.com"/>
1185 <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."">
1186 <meta property="og:type" content="website">
1187 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

cerebras_codermain.tsx11 matches

@gratitude5dee•Updated 3 months ago
73const PoweredByInfo = "";
74
75function Hero({
76 prompt,
77 setPrompt,
94
95 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
96 Turn your ideas into fully functional apps in{" "}
97 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
98 less than a second
168}
169
170function App() {
171 const previewRef = React.useRef<HTMLDivElement>(null);
172 const [prompt, setPrompt] = useState("");
222 });
223
224 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
225 setLoading(true);
226 setTimeout(() => handleSubmit(promptItem.prompt), 0);
227 }
228
229 async function handleSubmit(e: React.FormEvent | string) {
230 if (typeof e !== "string") {
231 e.preventDefault();
278 }
279
280 function handleVersionChange(direction: "back" | "forward") {
281 const { currentVersionIndex, versions } = versionHistory;
282 if (direction === "back" && currentVersionIndex > 0) {
994);
995
996function client() {
997 const path = window.location.pathname;
998 const root = createRoot(document.getElementById("root")!);
1030}
1031
1032function extractCodeFromFence(text: string): string {
1033 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1034 return htmlMatch ? htmlMatch[1].trim() : text;
1035}
1036
1037async function generateCode(prompt: string, currentCode: string) {
1038 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1039 if (starterPrompt) {
1080}
1081
1082export default async function cerebras_coder(req: Request): Promise<Response> {
1083 // Dynamic import for SQLite to avoid client-side import
1084 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1183 <meta property="og:site_name" content="Cerebras Coder">
1184 <meta property="og:url" content="https://cerebrascoder.com"/>
1185 <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."">
1186 <meta property="og:type" content="website">
1187 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

instagramExtractmain.tsx3 matches

@wolf•Updated 3 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [url, setUrl] = useState("");
7 const [resultCaption, setResultText] = useState("");
111}
112
113function client() {
114 createRoot(document.getElementById("root")).render(<App />);
115}
116if (typeof document !== "undefined") client();
117
118export default async function server(request: Request): Promise<Response> {
119 const instagramPostExtract =
120 (await import("https://esm.town/v/wolf/instagramExtractUtils?v=55"))

textToGeneratemain.tsx3 matches

@KALPESHPATEL•Updated 3 months ago
5import React, { useState } from "https://esm.sh/react@18.2.0";
6
7function App() {
8 const [prompt, setPrompt] = useState("");
9 const [imageUrl, setImageUrl] = useState("");
202};
203
204function client() {
205 createRoot(document.getElementById("root")).render(<App />);
206}
207if (typeof document !== "undefined") { client(); }
208
209export default function server(request: Request) {
210 const app = new Hono();
211

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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",