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=530&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 8497 results for "fetch"(949ms)

cerebras_codermain.tsx1 match

@omerco•Updated 5 months ago
23
24 try {
25 const response = await fetch("/", {
26 method: "POST",
27 body: JSON.stringify({ prompt, currentCode: code }),

uptimemain.tsx2 matches

@omerco•Updated 5 months ago
11 const start = performance.now();
12 try {
13 const res = await fetch(url);
14 end = performance.now();
15 status = res.status;
22 } catch (e) {
23 end = performance.now();
24 reason = `couldn't fetch: ${e}`;
25 ok = false;
26 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

weatherGPTmain.tsx1 match

@omerco•Updated 5 months ago
4let location = "brooklyn ny";
5let lang = "en";
6const weather = await fetch(
7 `https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());

lovelyYellowXerinaemain.tsx18 matches

@mikehiggins•Updated 5 months ago
187}
188
189// Updated function to fetch and parse URL content
190async function fetchUrlContent(url) {
191 try {
192 console.log('Fetching URL:', url);
193 const response = await fetch(url);
194 if (!response.ok) {
195 throw new Error(`HTTP error! status: ${response.status}`);
196 }
197 const html = await response.text();
198 console.log('Fetched HTML length:', html.length);
199 const root = parse(html);
200
228 return content;
229 } catch (error) {
230 console.error('Error fetching URL:', error);
231 throw new Error(`Failed to fetch URL content: ${error.message}`);
232 }
233}
483 try {
484 if (url.length > 0) {
485 const response = await fetch('/fetch-url', {
486 method: 'POST',
487 headers: {
493 if (!response.ok) {
494 const errorData = await response.json();
495 throw new Error(errorData.error || 'Failed to fetch URL content');
496 }
497
501
502 if (!contentToAnalyse || contentToAnalyse.trim().length === 0) {
503 throw new Error('No content to analyse. The fetched content might be empty.');
504 }
505
509 }
510
511 const analysisResponse = await fetch('/analyse', {
512 method: 'POST',
513 headers: {
713});
714
715app.post('/fetch-url', async (c) => {
716 const { url } = await c.req.json();
717
718 try {
719 console.log('Fetching URL:', url);
720 const content = await fetchUrlContent(url);
721 console.log('Fetched content length:', content.length);
722 if (content.length > 100000) {
723 return c.json({ error: "Content from URL is too long. Please try a different URL with less content." }, 400);
724 }
725 if (content.trim().length === 0) {
726 return c.json({ error: "The fetched content is empty. Please try a different URL." }, 400);
727 }
728 return c.json({ content });
729 } catch (error) {
730 console.error('Error fetching URL:', error);
731 return c.json({ error: error.message }, 400);
732 }
734
735export default async function(request: Request): Promise<Response> {
736 return app.fetch(request);
737}

ogmain.tsx17 matches

@yawnxyz•Updated 5 months ago
699}
700
701// Fetch Inter font from CDN
702async function fetchFont(url: string) {
703 const res = await fetch(url);
704 return new Uint8Array(await res.arrayBuffer());
705}
707
708
709const dmMonoLight = await fetchFont(
710 "https://cdn.jsdelivr.net/fontsource/fonts/dm-mono@latest/latin-300-normal.ttf"
711);
712const dmMonoRegular = await fetchFont(
713 "https://cdn.jsdelivr.net/fontsource/fonts/dm-mono@latest/latin-400-normal.ttf"
714);
715const dmMonoMedium = await fetchFont(
716 "https://cdn.jsdelivr.net/fontsource/fonts/dm-mono@latest/latin-500-normal.ttf"
717);
718const interLight = await fetchFont(
719 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-300-normal.ttf"
720);
721const interRegular = await fetchFont(
722 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-400-normal.ttf"
723);
724const interSemiBold = await fetchFont(
725 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-600-normal.ttf"
726);
727const interMedium = await fetchFont(
728 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-500-normal.ttf"
729);
730const ebGaramondMediumItalic = await fetchFont(
731 "https://cdn.jsdelivr.net/fontsource/fonts/eb-garamond@latest/latin-500-italic.ttf"
732);
791 }
792 } catch (error) {
793 console.error("Error fetching image from Val Town blob:", error);
794 }
795 }
1230 }
1231 } catch (error) {
1232 console.error("Error fetching image from Val Town blob:", error);
1233 }
1234 }
1915
1916 async function updateImageStats(url) {
1917 const response = await fetch(url);
1918 const blob = await response.blob();
1919 const img = new Image();
1961
1962 try {
1963 const response = await fetch(imageUrlValue + '&nocache=true');
1964 const blob = await response.blob();
1965 const url = URL.createObjectURL(blob);
2038});
2039
2040// Export app.fetch for Val Town, otherwise export app — this is only for hono apps
2041export default (typeof Deno !== "undefined" && Deno.env.get("valtown") && Deno.env.get("mode") !== "local")
2042 ? app.fetch
2043 : app;
2044

sqlite_adminmain.tsx1 match

@izuchukwu•Updated 5 months ago
9app.get("/", async (c) => c.html(await sqlite_admin_tables()));
10app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
11export default basicAuth(app.fetch);

sqliteExplorerAppmain.tsx1 match

@izuchukwu•Updated 5 months ago
150});
151
152export default basicAuth(app.fetch);

imageGenmain.tsx4 matches

@muhammad_owais_warsi•Updated 5 months ago
23
24 useEffect(() => {
25 const fetchCount = async () => {
26 const response = await fetch("/visitor-count");
27 if (response.ok) {
28 const { count } = await response.json();
31 };
32
33 fetchCount();
34 }, []);
35
42
43 try {
44 const response = await fetch(imageUrl);
45 const blob = await response.blob();
46 const url = window.URL.createObjectURL(blob);

rijksREADME.md1 match

@sammeltassen•Updated 5 months ago
14- EDM response: `https://sammeltassen-rijks.web.val.run/200738982?format=edm`
15
16The val checks if the objects has additional parts, and fetches the information for those parts as well. This will slow down the val for large objects!
17
18It then passes this on to [IIIF Builder](https://github.com/IIIF-Commons/iiif-builder) with some metadata to create a IIIF Presentation Manifest.

sqlitemain.tsx2 matches

@toowired•Updated 5 months ago
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago