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=1459&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 21510 results for "function"(3454ms)

notUber_migratedmain.tsx10 matches

@vawogbemi•Updated 3 months ago
35import { Rides } from "https://esm.town/v/vawogbemi/notUberRides";
36
37function Container({ children }) {
38 return (
39 <div className="w-full md:max-w-7xl md:mx-auto md:px-4 lg:px-8">
43}
44
45function MobileNav() {
46 const location = useLocation();
47
92}
93
94function DesktopNav() {
95 const navigate = useNavigate();
96 const location = useLocation();
138}
139
140function UnauthenticatedApp() {
141 return (
142 <div className="flex flex-col min-h-screen bg-white">
154}
155
156function Modal({ isOpen, onClose, children }) {
157 if (!isOpen) return null;
158
166}
167
168function AuthenticatedApp() {
169 const db = init({ appId: INSTANTDB_APP_ID });
170 const [modalOpen, setModalOpen] = useState(false);
384}
385
386function App() {
387 return (
388 <Router>
399}
400
401function client() {
402 createRoot(document.getElementById("root")).render(<App />);
403}
407}
408
409export default async function server(request: Request): Promise<Response> {
410 console.log("Server function called");
411
412 return new Response(

emailToDiscordhttpHandler2 matches

@wilt•Updated 3 months ago
14}
15
16export function getHttpHandler(
17 { blobKeyPrefix, enforceDiscordAgent }: IHttpHandlerProps,
18): (req: Request) => Promise<Response> {
19 return async function(req: Request): Promise<Response> {
20 console.log(req);
21 if (req.method !== "GET") {

adroitIvoryEchidnamain.tsx6 matches

@hashamqureshi•Updated 3 months ago
41
42// Haversine formula for distance calculation
43function calculateDistance(
44 lat1: number,
45 lon1: number,
58}
59
60function TravelGuideApp() {
61 const [location, setLocation] = useState<{
62 latitude: number | null,
74 const recommendationsSectionRef = useRef<HTMLDivElement>(null);
75
76 // Geocoding function to convert location name to coordinates
77 const geocodeLocation = async (query: string) => {
78 try {
421}
422
423// Client-side rendering function
424function client() {
425 createRoot(document.getElementById("root")).render(<TravelGuideApp />);
426}
432
433// Server-side export
434export default async function server(request: Request): Promise<Response> {
435 if (request.method === 'POST' && request.url.includes('/recommendations')) {
436 const { OpenAI } = await import("https://esm.town/v/std/openai");

cerebras_codermain.tsx11 matches

@Reddysumanth•Updated 3 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">

accomplishedAzureAardvarkmain.tsx3 matches

@arifio•Updated 3 months ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function LoanCalculator() {
6 const [loanAmount, setLoanAmount] = useState(100000);
7 const [interestRate, setInterestRate] = useState(5);
121};
122
123function client() {
124 createRoot(document.getElementById("root")).render(<LoanCalculator />);
125}
127if (typeof document !== "undefined") { client(); }
128
129export default async function server(request: Request): Promise<Response> {
130 return new Response(
131 `

ArifioreceptiveEmeraldHoverfly1 match

@arifio•Updated 3 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

ArifioforgivingTanPig1 match

@arifio•Updated 3 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

gregariousPinkCatmain.tsx1 match

@arifio•Updated 3 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

loanCalculatormain.tsx3 matches

@arifio•Updated 3 months ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function LoanCalculator() {
6 const [loanAmount, setLoanAmount] = useState(100000);
7 const [interestRate, setInterestRate] = useState(5);
121};
122
123function client() {
124 createRoot(document.getElementById("root")).render(<LoanCalculator />);
125}
127if (typeof document !== "undefined") { client(); }
128
129export default async function server(request: Request): Promise<Response> {
130 return new Response(
131 `

feedbackmain.ts1 match

@pomdtr•Updated 3 months ago
1import { gfm } from "https://esm.town/v/pomdtr/gfm";
2
3export default async function(req: Request): Promise<Response> {
4 const markdown = await fetch(import.meta.resolve("./README.md")).then(res => res.text());
5 const url = new URL(req.url);

getFileEmail4 file matches

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

tuna8 file matches

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