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=2287&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 29395 results for "function"(4651ms)

sensitiveCoralGorillamain.tsx11 matches

@vesty91•Updated 4 months ago
89};
90
91function LanguageProvider({ children }) {
92 const [language, setLanguage] = useState('fr');
93
103}
104
105function useTranslation() {
106 const { language } = useContext(LanguageContext);
107 return (key) => translations[language][key] || key;
108}
109
110function Navigation() {
111 const { language, toggleLanguage } = useContext(LanguageContext);
112 const t = useTranslation();
133}
134
135function HomePage() {
136 const t = useTranslation();
137 const testimonials = [
205}
206
207function ServicesPage() {
208 const t = useTranslation();
209
244}
245
246function AboutPage() {
247 const t = useTranslation();
248
264}
265
266function ContactPage() {
267 const t = useTranslation();
268 const [formData, setFormData] = useState({
316}
317
318function Footer() {
319 const t = useTranslation();
320
353}
354
355function App() {
356 return (
357 <LanguageProvider>
370}
371
372function client() {
373 createRoot(document.getElementById("root")).render(<App />);
374}
378}
379
380export default async function server(request: Request): Promise<Response> {
381 return new Response(`
382 <!DOCTYPE html>

accomplishedPeachWildebeestmain.tsx11 matches

@vesty91•Updated 4 months ago
89};
90
91function LanguageProvider({ children }) {
92 const [language, setLanguage] = useState('fr');
93
103}
104
105function useTranslation() {
106 const { language } = useContext(LanguageContext);
107 return (key) => translations[language][key] || key;
108}
109
110function Navigation() {
111 const { language, toggleLanguage } = useContext(LanguageContext);
112 const t = useTranslation();
133}
134
135function HomePage() {
136 const t = useTranslation();
137 const testimonials = [
205}
206
207function ServicesPage() {
208 const t = useTranslation();
209
244}
245
246function AboutPage() {
247 const t = useTranslation();
248
264}
265
266function ContactPage() {
267 const t = useTranslation();
268 const [formData, setFormData] = useState({
316}
317
318function Footer() {
319 const t = useTranslation();
320
353}
354
355function App() {
356 return (
357 <LanguageProvider>
370}
371
372function client() {
373 createRoot(document.getElementById("root")).render(<App />);
374}
378}
379
380export default async function server(request: Request): Promise<Response> {
381 return new Response(`
382 <!DOCTYPE html>

studiousChocolateCanidaemain.tsx11 matches

@vesty91•Updated 4 months ago
89};
90
91function LanguageProvider({ children }) {
92 const [language, setLanguage] = useState('fr');
93
103}
104
105function useTranslation() {
106 const { language } = useContext(LanguageContext);
107 return (key) => translations[language][key] || key;
108}
109
110function Navigation() {
111 const { language, toggleLanguage } = useContext(LanguageContext);
112 const t = useTranslation();
133}
134
135function HomePage() {
136 const t = useTranslation();
137 const testimonials = [
205}
206
207function ServicesPage() {
208 const t = useTranslation();
209
244}
245
246function AboutPage() {
247 const t = useTranslation();
248
264}
265
266function ContactPage() {
267 const t = useTranslation();
268 const [formData, setFormData] = useState({
316}
317
318function Footer() {
319 const t = useTranslation();
320
353}
354
355function App() {
356 return (
357 <LanguageProvider>
370}
371
372function client() {
373 createRoot(document.getElementById("root")).render(<App />);
374}
378}
379
380export default async function server(request: Request): Promise<Response> {
381 return new Response(`
382 <!DOCTYPE html>

cerebras_codermain.tsx11 matches

@ninadxc•Updated 4 months ago
26const PoweredByInfo = "";
27
28function Hero({
29 prompt,
30 setPrompt,
47
48 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
49 Turn your ideas into fully functional apps in{" "}
50 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
51 less than a second!
121}
122
123function App() {
124 const previewRef = React.useRef<HTMLDivElement>(null);
125 const [prompt, setPrompt] = useState("");
175 });
176
177 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
178 setLoading(true);
179 setTimeout(() => handleSubmit(promptItem.prompt), 0);
180 }
181
182 async function handleSubmit(e: React.FormEvent | string) {
183 if (typeof e !== "string") {
184 e.preventDefault();
231 }
232
233 function handleVersionChange(direction: "back" | "forward") {
234 const { currentVersionIndex, versions } = versionHistory;
235 if (direction === "back" && currentVersionIndex > 0) {
920);
921
922function client() {
923 const path = window.location.pathname;
924 const root = createRoot(document.getElementById("root")!);
956}
957
958function extractCodeFromFence(text: string): string {
959 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
960 return htmlMatch ? htmlMatch[1].trim() : text;
961}
962
963async function generateCode(prompt: string, currentCode: string) {
964 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
965 if (starterPrompt) {
1006}
1007
1008export default async function cerebras_coder(req: Request): Promise<Response> {
1009 // Dynamic import for SQLite to avoid client-side import
1010 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1109 <meta property="og:site_name" content="Cerebras Coder">
1110 <meta property="og:url" content="https://cerebrascoder.com"/>
1111 <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."">
1112 <meta property="og:type" content="website">
1113 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

pioneeringAzureChickadeemain.tsx11 matches

@vesty91•Updated 4 months ago
89};
90
91function LanguageProvider({ children }) {
92 const [language, setLanguage] = useState('fr');
93
103}
104
105function useTranslation() {
106 const { language } = useContext(LanguageContext);
107 return (key) => translations[language][key] || key;
108}
109
110function Navigation() {
111 const { language, toggleLanguage } = useContext(LanguageContext);
112 const t = useTranslation();
133}
134
135function HomePage() {
136 const t = useTranslation();
137 const testimonials = [
205}
206
207function ServicesPage() {
208 const t = useTranslation();
209
244}
245
246function AboutPage() {
247 const t = useTranslation();
248
264}
265
266function ContactPage() {
267 const t = useTranslation();
268 const [formData, setFormData] = useState({
316}
317
318function Footer() {
319 const t = useTranslation();
320
353}
354
355function App() {
356 return (
357 <LanguageProvider>
370}
371
372function client() {
373 createRoot(document.getElementById("root")).render(<App />);
374}
378}
379
380export default async function server(request: Request): Promise<Response> {
381 return new Response(`
382 <!DOCTYPE html>

geminichatmain.tsx10 matches

@arfan•Updated 4 months ago
160
161// ==============================================================================
162// SECTION 2: DATABASE FUNCTIONS
163// ==============================================================================
164
165function createDatabaseFunctions(sqlite, KEY, SCHEMA_VERSION) {
166 return {
167 async initialize() {
194
195// ==============================================================================
196// SECTION 3: SERVER FUNCTION
197// ==============================================================================
198
199export default async function server(request: Request): Promise<Response> {
200 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
201 const { GoogleGenerativeAI } = await import("https://esm.sh/@google/generative-ai@0.1.3");
203 const SCHEMA_VERSION = 2;
204 const KEY = "geminichat";
205 const db = createDatabaseFunctions(sqlite, KEY, SCHEMA_VERSION);
206 await db.initialize();
207
290// ==============================================================================
291
292function Settings({ isOpen, onClose }) {
293 if (!isOpen) return null;
294
308}
309
310function formatMessage(content) {
311 const codeBlockRegex = /```(\w+)?\n([\s\S]*?)```/g;
312 const parts = [];
339}
340
341function Message({ role, content, debug }) {
342 return (
343 <div className={`message ${role}`}>
358}
359
360function App() {
361 const [input, setInput] = useState("");
362 const [messages, setMessages] = useState([]);
489// ==============================================================================
490
491function client() {
492 createRoot(document.getElementById("root")).render(<App />);
493}

neatChocolateLynxmain.tsx9 matches

@vesty91•Updated 4 months ago
6import { BrowserRouter as Router, Route, Routes, Link } from "https://esm.sh/react-router-dom@6.11.2?deps=react@18.2.0,react-dom@18.2.0";
7
8function Navigation() {
9 return (
10 <Navbar bg="dark" variant="dark" expand="lg" className="mb-4 gaming-navbar">
25}
26
27function HomePage() {
28 const testimonials = [
29 { name: "Alex G.", text: "Service exceptionnel ! Mon PC gaming fonctionne mieux que jamais." },
96}
97
98function ServicesPage() {
99 return (
100 <Container className="my-5">
133}
134
135function AboutPage() {
136 return (
137 <Container className="my-5">
151}
152
153function ContactPage() {
154 const [formData, setFormData] = useState({
155 name: "",
202}
203
204function Footer() {
205 return (
206 <footer className="bg-dark text-light py-4 mt-5">
237}
238
239function App() {
240 return (
241 <Router>
252}
253
254function client() {
255 createRoot(document.getElementById("root")).render(<App />);
256}
260}
261
262export default async function server(request: Request): Promise<Response> {
263 return new Response(`
264 <!DOCTYPE html>

scholarlyRedWhalemain.tsx9 matches

@vesty91•Updated 4 months ago
6import { BrowserRouter as Router, Route, Routes, Link } from "https://esm.sh/react-router-dom@6.11.2?deps=react@18.2.0,react-dom@18.2.0";
7
8function Navigation() {
9 return (
10 <Navbar bg="dark" variant="dark" expand="lg" className="mb-4 gaming-navbar">
25}
26
27function HomePage() {
28 const testimonials = [
29 { name: "Alex G.", text: "Service exceptionnel ! Mon PC gaming fonctionne mieux que jamais." },
96}
97
98function ServicesPage() {
99 return (
100 <Container className="my-5">
133}
134
135function AboutPage() {
136 return (
137 <Container className="my-5">
151}
152
153function ContactPage() {
154 const [formData, setFormData] = useState({
155 name: "",
202}
203
204function Footer() {
205 return (
206 <footer className="bg-dark text-light py-4 mt-5">
237}
238
239function App() {
240 return (
241 <Router>
252}
253
254function client() {
255 createRoot(document.getElementById("root")).render(<App />);
256}
260}
261
262export default async function server(request: Request): Promise<Response> {
263 return new Response(`
264 <!DOCTYPE html>

p5main.tsx3 matches

@moe•Updated 4 months ago
1import { frameHtml } from "https://esm.town/v/moe/frameHtmlRaw";
2
3export function sketch(module: string, title = "P5 Sketch") {
4 return async function(req: Request): Promise<Response> {
5 // console.log("module:", module)
6 const url = new URL(req.url);
87}
88
89function r() {
90 return Math.floor(Math.random() * 100);
91}

countryOutlineSVGmain.tsx3 matches

@andybak•Updated 4 months ago
1export default async function server(request: Request): Promise<Response> {
2 // Pre-import external modules to avoid async import inside function
3 const topojson = await import("https://esm.sh/topojson-client");
4 const path = await import("https://esm.sh/d3-geo");
41
42 // Generate SVG from country boundaries
43 async function generateSVG(geojsonFeatures) {
44 // Create a feature collection to use for projection
45 const featureCollection = {
tuna

tuna9 file matches

@jxnblk•Updated 2 days ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.