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=fetch&page=260&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 2746 results for "fetch"(585ms)

whoIsHiringmain.tsx12 matches

@stevekrouse•Updated 7 months ago
61 }, [state.loading, state.hasMore]);
62
63 const fetchStories = async () => {
64 try {
65 const response = await fetch("/api/stories");
66 if (!response.ok) throw new Error("Failed to fetch dates");
67 const data = await response.json();
68 setStories(data);
70 }
71 catch (err) {
72 console.error("Error fetching stories:", err);
73 }
74 };
75
76 const fetchComments = async (query: string, story: string, page: number) => {
77 try {
78 dispatch({ type: "loading", value: true });
79 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80 if (!response.ok) throw new Error("Failed to fetch comments");
81 const data = await response.json();
82 setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84 dispatch({ type: "loading", value: false });
85 } catch (err) {
86 console.error("Error fetching comments:", err);
87 dispatch({ type: "loading", value: false });
88 }
99 dispatch({ type: "hasMore", value: true });
100 dispatch({ type: "query", value: newQuery });
101 fetchComments(fullQuery, state.story, 1);
102 };
103
104 useEffect(() => {
105 fetchStories();
106
107 const handleScroll = () => {
122 : "";
123 const fullQuery = `${filtersQuery} ${state.query}`;
124 fetchComments(fullQuery, state.story, state.page);
125 }
126 }
391 tags: `comment, story_${story}`,
392 page: 0,
393 hitsPerPage: 100, // Fetch a moderate number of comments
394 });
395

cronJobToCheckCISAKEVmain.tsx1 match

@hrbrmstr•Updated 7 months ago
6
7async function checkNewVulnerabilities() {
8 const response = await fetch(KEV_URL);
9 const data = await response.json();
10 const currentVulnerabilities = new Set(data.vulnerabilities.map(v => v.cveID));

knownExploitedVulnsEndpointmain.tsx2 matches

@hrbrmstr•Updated 7 months ago
1export default async function server(request: Request): Promise<Response> {
2 try {
3 const response = await fetch("https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json");
4 if (!response.ok) {
5 throw new Error(`HTTP error! status: ${response.status}`);
23 } catch (error) {
24 console.error("Error:", error);
25 return new Response(JSON.stringify({ error: "Failed to fetch or process vulnerabilities data" }), {
26 status: 500,
27 headers: {

cisaKEVToRSSmain.tsx2 matches

@hrbrmstr•Updated 7 months ago
70export async function handler(req: Request): Promise<Response> {
71 try {
72 const response = await fetch(CISA_JSON_URL);
73
74 if (!response.ok) {
75 throw new Error(`Failed to fetch data: ${response.status} ${response.statusText}`);
76 }
77

valWallmain.tsx3 matches

@stevekrouse•Updated 7 months ago
67 }
68
69 console.log(`Fetching contributions for ${username}`);
70 try {
71 let vals;
81 }
82
83 console.log(`Fetched ${vals.length} contributions`);
84 const contributionData = processVals(vals, useVersions);
85 console.log(`Processed ${contributionData.length} contributions`);
282}
283
284export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;

resyGetMatchingSlotmain.tsx2 matches

@maxm•Updated 7 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { resyPublicAPIKey } from "https://esm.town/v/vtdocs/resyPublicAPIKey";
3
22 const startTime = new Date(`${day} ${start}`);
23 const endTime = new Date(`${day} ${end}`);
24 const slotsRes = await fetch(
25 `https://api.resy.com/4/find?lat=0&long=0&day=${day}&party_size=${partySize}&venue_id=${venueId}`,
26 {

resyAuthmain.tsx2 matches

@maxm•Updated 7 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { resyPublicAPIKey } from "https://esm.town/v/vtdocs/resyPublicAPIKey";
3
9 }[];
10}> => {
11 const authRes = await fetch("https://api.resy.com/3/auth/password", {
12 "headers": {
13 "authorization": `ResyAPI api_key="${resyPublicAPIKey}"`,

grievingYellowAspmain.tsx2 matches

@stevekrouse•Updated 7 months ago
10 const start = performance.now();
11 try {
12 await fetch(url);
13 const end = performance.now();
14 return end - start;
15 } catch (error) {
16 console.error("Error fetching URL:", error);
17 return null;
18 }

buttonmain.tsx5 matches

@stevekrouse•Updated 7 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function server(req: Request): Promise<Response> {
7 for (const urlMatch of cssString.matchAll(urlRegex)) {
8 const originalUrl = urlMatch[1];
9 const response = await fetch(originalUrl);
10 const data = new Uint8Array(await response.arrayBuffer());
11 result = result.replace(
29 let fontCss = "";
30 try {
31 const r = await fetch(
32 "https://fonts.googleapis.com/css2?family=" +
33 encodeURIComponent("IBM Plex Sans:wght@600") +
37 );
38 if (!r.ok)
39 throw new Error("Failed to fetch font CSS");
40 fontCss = await inlineUrls(await r.text());
41 }
42 catch (e) {
43 console.error("Error fetching font CSS:", e);
44 }
45

dateme_migratedmain.tsx2 matches

@stevekrouse•Updated 7 months ago
1import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
2import { form } from "https://esm.town/v/stevekrouse/date_me_form";
3import browse from "https://esm.town/v/stevekrouse/dateme_browse";
13app.get("/faq", faq);
14app.get("/rss.xml", c => dateMeRSS(c.req as unknown as Request));
15export default modifyFetchHandler(app.fetch, {
16 style: `@media (max-width: 500px) {
17 .github-fork-ribbon {

fetchPaginatedData2 file matches

@nbbaier•Updated 6 days ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago