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=859&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 10292 results for "function"(1164ms)

hardworkingLimeCheetahmain.tsx10 matches

@stevekrouse•Updated 4 months ago
12type PromptItem = typeof prompts[number];
13
14function Hero({
15 prompt,
16 setPrompt,
50
51 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
52 Turn your ideas into fully functional apps in{" "}
53 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
54 less than a second
121}
122
123function App() {
124 const previewRef = React.useRef<HTMLDivElement>(null);
125 const [prompt, setPrompt] = useState("");
174 });
175
176 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
177 setLoading(true);
178 setTimeout(() => handleSubmit(promptItem.prompt), 0);
179 }
180
181 async function handleSubmit(e: React.FormEvent | string) {
182 if (typeof e !== "string") {
183 e.preventDefault();
230 }
231
232 function handleVersionChange(direction: "back" | "forward") {
233 const { currentVersionIndex, versions } = versionHistory;
234 if (direction === "back" && currentVersionIndex > 0) {
993);
994
995function client() {
996 const path = window.location.pathname;
997 const root = createRoot(document.getElementById("root")!);
1029}
1030
1031function extractCodeFromFence(text: string): string {
1032 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1033 return htmlMatch ? htmlMatch[1].trim() : text;
1034}
1035
1036async function generateCode(prompt: string, currentCode: string) {
1037 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1038 if (starterPrompt) {
1075}
1076
1077export default async function server(req: Request): Promise<Response> {
1078 // Dynamic import for SQLite to avoid client-side import
1079 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

strategiesHelpersmain.tsx2 matches

@nmsilva•Updated 4 months ago
777 }
778
779 function predictDraw(teamA, teamB, tournament) {
780 if (!teamA || !teamB) return 0;
781
782 // Helper function to calculate draw rate
783 const calculateDrawRate = (team) =>
784 team.results.draws / team.totalMatches;

blob_adminmain.tsx8 matches

@stevekrouse1•Updated 4 months ago
13}
14
15function Tooltip({ children, content }: TooltipProps) {
16 const [isVisible, setIsVisible] = useState(false);
17 const tooltipRef = useRef<HTMLDivElement>(null);
52}
53
54function formatBytes(bytes: number, decimals = 2) {
55 if (bytes === 0) return "0 Bytes";
56 const k = 1024;
61}
62
63function copyToClipboard(text: string) {
64 navigator.clipboard.writeText(text).then(() => {
65 console.log("Text copied to clipboard");
69}
70
71function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72 const [isOpen, setIsOpen] = useState(false);
73 const menuRef = useRef(null);
76
77 useEffect(() => {
78 function handleClickOutside(event) {
79 if (menuRef.current && !menuRef.current.contains(event.target)) {
80 event.stopPropagation();
158}
159
160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161 const [isLoading, setIsLoading] = useState(false);
162 const decodedKey = decodeURIComponent(blob.key);
219}
220
221function App({ initialEmail, initialProfile }) {
222 const encodeKey = (key: string) => encodeURIComponent(key);
223 const decodeKey = (key: string) => decodeURIComponent(key);
645}
646
647function client() {
648 const initialEmail = document.getElementById("root").getAttribute("data-email");
649 const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));

notUberHomemain.tsx1 match

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

notUberAccountmain.tsx1 match

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

notUberRidemain.tsx1 match

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

notUberNewmain.tsx2 matches

@vawogbemi•Updated 4 months ago
205};
206
207export function New() {
208 return (
209 <div className="p-0 md:py-4">
241`;
242
243export default async function server(request: Request): Promise<Response> {
244 return new Response(
245 `

notUberRidesmain.tsx1 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

gregariousCrimsonFlamingomain.tsx9 matches

@Saadaap•Updated 4 months ago
13const FONT_FAMILY = 'CIRO, Arial, sans-serif';
14
15function MainHeader() {
16 const [dropdownOpen, setDropdownOpen] = useState(false);
17
77}
78
79function MorePage() {
80 const navigate = useNavigate();
81
208}
209
210function App() {
211 return (
212 <BrowserRouter>
231}
232
233function BottomNavbar() {
234 const navigate = useNavigate();
235
272}
273
274function MainPage() {
275 const navigate = useNavigate();
276
337}
338
339function ServicesPage() {
340 const navigate = useNavigate();
341 const [searchTerm, setSearchTerm] = useState('');
460}
461
462function ReportsPage() {
463 const navigate = useNavigate();
464 const [selectedReport, setSelectedReport] = useState(null);
581}
582
583function client() {
584 createRoot(document.getElementById("root")).render(<App />);
585}
587if (typeof document !== "undefined") { client(); }
588
589export default async function server(request: Request): Promise<Response> {
590 return new Response(`
591 <html>

widemain.tsx1 match

@vawogbemi•Updated 4 months ago
74}
75
76export default async function(req: Request): Promise<Response> {
77 // Use your Val Town API Token to create a session
78 const wide = new Wide(await ValSession.new(Deno.env.get("valtown")));

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago