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%22Image%20title%22?q=api&page=112&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 13140 results for "api"(835ms)

HonoDenoVite2server.tsx3 matches

@vawogbemi•Updated 5 days ago
30const projectVal = parseProject(import.meta.url);
31
32// Create a main Hono app that will handle both API routes and proxy to Vite
33const mainApp = new Hono();
34
35// Mount the Hono app from src/index.tsx to handle API routes
36mainApp.route("/api", app);
37
38// For all other routes, use the Vite proxy

HonoDenoViteindex.tsx1 match

@vawogbemi•Updated 5 days ago
3const app = new Hono();
4
5const routes = app.get("/api/clock", (c) => {
6 return c.json({
7 time: new Date().toLocaleTimeString(),

HonoDenoViteclient.tsx2 matches

@vawogbemi•Updated 5 days ago
12 <h2>Example of useState()</h2>
13 <Counter />
14 <h2>Example of API fetch()</h2>
15 <ClockButton />
16 </>
31
32 const handleClick = async () => {
33 const response = await client.api.clock.$get();
34 const data = await response.json();
35 const headers = Array.from(response.headers.entries()).reduce<

NowPlayingGrabbermain.tsx2 matches

@wrngwrld•Updated 5 days ago
2import querystring from "npm:querystring";
3
4const NOW_PLAYING_ENDPOINT = "https://api.spotify.com/v1/me/player/currently-playing";
5const TOKEN_ENDPOINT = "https://accounts.spotify.com/api/token";
6
7const client_id = Deno.env.get("spotify_client_id");

orangeSolemultiembed-dood.tsx1 match

@temptemp•Updated 5 days ago
146export default async function(request, env, ctx) {
147 const url = new URL(request.url);
148 if (!url.pathname.startsWith("/api")) {
149 return new Response("welcome", {
150 headers: { "content-type": "text/html" },

sssmain.tsx7 matches

@vawogbemi•Updated 5 days ago
432
433function ProductCarousel({ children }: { children: React.ReactNode }) {
434 const [emblaRef, emblaApi] = useEmblaCarousel({
435 axis: "x",
436 loop: false,
457
458 useEffect(() => {
459 if (emblaApi) {
460 scrollByRef.current = (delta: number) => {
461 isScrollingRef.current = true;
462 const scrollResult = emblaApi.scrollTo(emblaApi.selectedScrollSnap() + Math.sign(delta));
463
464 if (scrollResult && typeof scrollResult.then === "function") {
471 };
472
473 const rootNode = emblaApi.rootNode();
474 rootNode.addEventListener("wheel", onWheel, { passive: false });
475 rootNode.style.overflowY = "auto";
480 };
481 }
482 }, [emblaApi, onWheel]);
483
484 return (
682
683 const script = document.createElement("script");
684 script.src = `https://maps.googleapis.com/maps/api/js?key=AIzaSyAOtUMb5jLTjTVM7iKzIx2SJ3HgMKNcM7U&libraries=places`;
685 script.async = true;
686 script.defer = true;
806 // Reverse geocode the coordinates to get an address
807 const response = await fetch(
808 `https://maps.googleapis.com/maps/api/geocode/json?latlng=${position.coords.latitude},${position.coords.longitude}&key=AIzaSyAOtUMb5jLTjTVM7iKzIx2SJ3HgMKNcM7U`,
809 );
810 const data = await response.json();

parallelmain.ts10 matches

@salon•Updated 5 days ago
562 }
563
564 const apiRequestBody: any = { model, messages: messagesPayload };
565 if (typeof params.temperature === "number") apiRequestBody.temperature = params.temperature;
566 if (typeof params.max_tokens === "number" && params.max_tokens > 0)
567 apiRequestBody.max_tokens = Math.floor(params.max_tokens);
568
569 log("INFO", "OpenAiCallTool", "Making OpenAI chat completion call.", {
576
577 try {
578 const completion = await openaiClient.chat.completions.create(apiRequestBody);
579 if (!completion?.choices?.length) {
580 log("WARN", "OpenAiCallTool", "OpenAI response empty/unexpected.", { response: completion });
583 return { mandateId, correlationId: taskId, payload: { result: completion } };
584 } catch (e: any) {
585 log("ERROR", "OpenAiCallTool", "OpenAI API call failed.", e);
586 const errMsg = e.response?.data?.error?.message || e.error?.message || e.message || "Unknown OpenAI API error";
587 return { mandateId, correlationId: taskId, payload: { result: null }, error: errMsg };
588 }
701 const { mandateId, taskId, payload } = input;
702 const { log } = context;
703 log("INFO", "ScrapeEmails", `Scraping emails for ${payload.businesses?.length ?? 0} sites.`);
704
705 if (!payload?.businesses || !Array.isArray(payload.businesses)) {
753 await delay(WEBSITE_VISIT_DELAY_MS);
754 }
755 log("SUCCESS", "ScrapeEmails", `Scraping done. Found emails for ${foundLeads.length} leads.`);
756 return { mandateId, correlationId: taskId, payload: { leads: foundLeads } };
757}
810 } catch (error: any) {
811 log("ERROR", "DraftEmails", `Failed for ${lead.name}: ${error.message}`, error);
812 finalLeads.push({ ...lead, draftedEmail: "[OpenAI API call failed]" });
813 }
814 await delay(300); // Small delay between OpenAI calls
1117<body><h1>Superpowered Agent Platform - Lead Gen Demo</h1>
1118<p>Runs <code>leadGenWorkflowV1</code>. See <a href="/">Original V3 Demo</a>.</p>
1119<p><strong>Note:</strong> Google Search is simulated. Scraping is basic.</p>
1120<form id="leadGenForm">
1121 <label for="searchQuery">Search Query (Required):</label><input type="text" id="searchQuery" name="searchQuery" required value="dentists in Los Angeles">

TESTmain.tsx4 matches

@vawogbemi•Updated 5 days ago
61 const fetchStories = async () => {
62 try {
63 const response = await fetch("/api/stories");
64 if (!response.ok) throw new Error("Failed to fetch dates");
65 const data = await response.json();
75 try {
76 dispatch({ type: "loading", value: true });
77 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
78 if (!response.ok) throw new Error("Failed to fetch comments");
79 const data = await response.json();
364export default async function(req: Request): Promise<Response> {
365 const url = new URL(req.url);
366 if (url.pathname === "/api/stories") {
367 const storySearch = await hnSearch({
368 search_by_date: true,
385 }
386
387 if (url.pathname === "/api/comments") {
388 const params = url.searchParams;
389 const query = params.get("query") || "";

Afolabis2main.tsx8 matches

@vawogbemi•Updated 5 days ago
440
441function ProductCarousel({ children }: { children: React.ReactNode }) {
442 const [emblaRef, emblaApi] = useEmblaCarousel({
443 axis: "x",
444 loop: false,
465
466 useEffect(() => {
467 if (emblaApi) {
468 scrollByRef.current = (delta: number) => {
469 isScrollingRef.current = true;
470 const scrollResult = emblaApi.scrollTo(emblaApi.selectedScrollSnap() + Math.sign(delta));
471
472 if (scrollResult && typeof scrollResult.then === "function") {
479 };
480
481 const rootNode = emblaApi.rootNode();
482 rootNode.addEventListener("wheel", onWheel, { passive: false });
483 rootNode.style.overflowY = "auto";
488 };
489 }
490 }, [emblaApi, onWheel]);
491
492 return (
690
691 const script = document.createElement("script");
692 script.src = `https://maps.googleapis.com/maps/api/js?key=AIzaSyAOtUMb5jLTjTVM7iKzIx2SJ3HgMKNcM7U&libraries=places`;
693 script.async = true;
694 script.defer = true;
814 // Reverse geocode the coordinates to get an address
815 const response = await fetch(
816 `https://maps.googleapis.com/maps/api/geocode/json?latlng=${position.coords.latitude},${position.coords.longitude}&key=AIzaSyAOtUMb5jLTjTVM7iKzIx2SJ3HgMKNcM7U`,
817 );
818 const data = await response.json();
1184});
1185
1186app.post("/api", async (c) => {
1187 console.log(c.req.body);
1188 return c.json({ ok: true });

stevensDemoREADME.md1 match

@kuanche•Updated 5 days ago
53You'll need to set up some environment variables to make it run.
54
55- `ANTHROPIC_API_KEY` for LLM calls
56- You'll need to follow [these instructions](https://docs.val.town/integrations/telegram/) to make a telegram bot, and set `TELEGRAM_TOKEN`. You'll also need to get a `TELEGRAM_CHAT_ID` in order to have the bot remember chat contents.
57- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALENDAR_CALENDAR_ID`. See [these instuctions](https://www.val.town/v/stevekrouse/pipedream) for details.

vapi-minutes-db1 file match

@henrywilliams•Updated 2 days ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 2 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
mux
Your friendly, neighborhood video API.