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/image-url.jpg%20%22Optional%20title%22?q=function&page=2298&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 29886 results for "function"(3861ms)

instamain.tsx4 matches

@aazad•Updated 4 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [user, setUser] = useState(null);
7 const [posts, setPosts] = useState([]);
133}
134
135function LoginForm({ onLogin }) {
136 const [username, setUsername] = useState("");
137 const [password, setPassword] = useState("");
161}
162
163function client() {
164 createRoot(document.getElementById("root")).render(<App />);
165}
166if (typeof document !== "undefined") { client(); }
167
168export default async function server(request: Request): Promise<Response> {
169 const { blob } = await import("https://esm.town/v/std/blob");
170 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

linksmain.tsx6 matches

@aazad•Updated 4 months ago
3import React from "https://esm.sh/react@18.2.0";
4
5// Function to generate CSS with variables and styles
6function generateCSS() {
7 return `
8 :root {
108
109// Group links by section
110function groupLinksBySection(links: SavedLink[]) {
111 return links.reduce((acc, link) => {
112 if (!acc[link.section]) {
119
120// Link component with data attribute for edit URL
121function SavedLink({ link }: { link: SavedLink }) {
122 return (
123 <a
131}
132
133function client() {
134 // Prevent the default context menu globally
135 document.addEventListener('contextmenu', (e) => {
160}
161
162export default async function(req: Request) {
163 const groupedLinks = groupLinksBySection(savedLinks);
164

verseOfTheDayAppmain.tsx3 matches

@aazad•Updated 4 months ago
19let lastRequestTime = 0;
20
21function App() {
22 const [verse, setVerse] = useState<{ text: string; reference: string; version: string } | null>(null);
23 const [status, setStatus] = useState<"idle" | "loading" | "error">("loading");
246}
247
248function client() {
249 createRoot(document.getElementById("root")).render(<App />);
250}
251if (typeof document !== "undefined") { client(); }
252
253export default async function server(request: Request): Promise<Response> {
254 // Handle worker endpoint
255 if (new URL(request.url).pathname.endsWith('/worker')) {

wordRangeFindermain.tsx3 matches

@aazad•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [words, setWords] = useState<string[]>([]);
7 const [startWord, setStartWord] = useState('');
63}
64
65function client() {
66 createRoot(document.getElementById("root")).render(<App />);
67}
68if (typeof document !== "undefined") { client(); }
69
70export default async function server(request: Request): Promise<Response> {
71 const url = new URL(request.url);
72

FetchBasicmain.tsx3 matches

@dtecho•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [greeting, setGreeting] = useState("");
7 const [language, setLanguage] = useState("english");
46}
47
48function client() {
49 createRoot(document.getElementById("root")).render(<App />);
50}
51if (typeof document !== "undefined") { client(); }
52
53export default async function server(req: Request): Promise<Response> {
54 const url = new URL(req.url);
55

verseOfTheDayAppmain.tsx3 matches

@mallovelli•Updated 4 months ago
19let lastRequestTime = 0;
20
21function App() {
22 const [verse, setVerse] = useState<{ text: string; reference: string; version: string } | null>(null);
23 const [status, setStatus] = useState<"idle" | "loading" | "error">("loading");
246}
247
248function client() {
249 createRoot(document.getElementById("root")).render(<App />);
250}
251if (typeof document !== "undefined") { client(); }
252
253export default async function server(request: Request): Promise<Response> {
254 // Handle worker endpoint
255 if (new URL(request.url).pathname.endsWith('/worker')) {
notUber

notUbernotUber10 matches

@vawogbemi•Updated 4 months ago
35import { Rides } from "./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(
notUber

notUbernotUberRide1 match

@vawogbemi•Updated 4 months ago
82};
83
84export function Ride() {
85 return (
86 <div className="">
notUber

notUbernotUberHome1 match

@vawogbemi•Updated 4 months ago
117};
118
119export function Home() {
120 return (
121 <div className="p-0 md:p-4">
notUber

notUbernotUberRides1 match

@vawogbemi•Updated 4 months ago
6import { INSTANTDB_APP_ID } from "https://esm.town/v/vawogbemi/notUberConsts";
7
8export function Rides() {
9 const db = init({ appId: INSTANTDB_APP_ID });
10
tuna

tuna9 file matches

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