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=2&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 13941 results for "fetch"(3497ms)

preview-htmlmain.ts1 match

@ishbrzero•Updated 6 hours ago
62formData.append('html', 'your HTML goes here...');
63
64fetch('https://ishbrzero--086bc172453a11f0896c76b3cceeab13.web.val.run', {
65 method: 'POST',
66 body: formData,

geolocationlib.ts1 match

@mattrossman•Updated 6 hours ago
20 if (!xForwardedFor) throw new Error(`Missing "x-forwarded-for" header`);
21
22 const json = await fetch(`http://ip-api.com/json/${xForwardedFor}`).then(
23 (res) => res.json(),
24 ) as IpApiResponse;

tuempresaupdateSatCatalogsBlob.tsx2 matches

@arequipe•Updated 7 hours ago
1import { blob } from "https://esm.town/v/std/blob";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4// URL para la última versión de catalogs.db.bz2
10
11 try {
12 const response = await fetch(CATALOGS_BZ2_URL);
13 if (!response.ok) {
14 throw new Error(`Fallo al descargar el archivo .bz2: ${response.status} - ${response.statusText}`);

untitled-4042main.js5 matches

@hald•Updated 8 hours ago
3
4try {
5 // Fetch with browser-like headers to avoid basic bot detection
6 const response = await fetch(targetUrl, {
7 method: "GET",
8 headers: {
15 "Connection": "keep-alive",
16 "Upgrade-Insecure-Requests": "1",
17 "Sec-Fetch-Dest": "document",
18 "Sec-Fetch-Mode": "navigate",
19 "Sec-Fetch-Site": "none",
20 "Cache-Control": "max-age=0",
21 },

LifeWeightedCompoundingindex.html3 matches

@bjtitus•Updated 9 hours ago
32 };
33
34 const fetchData = async url => {
35 const text = await fetch(url).then(r => r.text());
36 return d3.csvParse(text).map(d => ({ age: +d.Age, qx: +d.qx }));
37 };
38
39 const [male, female] = await Promise.all([fetchData(urls.M), fetchData(urls.F)]);
40 const data = { M: male, F: female };
41 const maxAge = 120;

LifeWeightedCompoundingmain.tsx1 match

@bjtitus•Updated 9 hours ago
8});
9
10export default app.fetch;

slackBotExamplemain.tsx3 matches

@charmaine•Updated 10 hours ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const slackReplyToMessage = async (req: Request) => {
33 if (body.event?.type === "app_mention") {
34 try {
35 // Use standard fetch instead of fetchJSON for more control
36 const result = await fetch("https://slack.com/api/chat.postMessage", {
37 method: "POST",
38 headers: {

Snotel-Analyzerindex.ts6 matches

@bjtitus•Updated 11 hours ago
30 ];
31
32 const response = await fetch(
33 `https://wcc.sc.egov.usda.gov/awdbRestApi/services/v1/stations?stationIds=${coStationIds.join(',')}`
34 );
59 return c.json(apiResponse);
60 } catch (error) {
61 console.error("Error fetching sites:", error);
62 const apiResponse: ApiResponse<SnotelSite[]> = {
63 success: false,
85 ];
86
87 // Fetch recent data for these stations
88 const dataResponse = await fetch(
89 `https://wcc.sc.egov.usda.gov/awdbRestApi/services/v1/data?stationIds=${coStationIds.join(',')}&elementCds=SNWD,WTEQ,TOBS&ordinal=1&duration=DAILY&getFlags=false&alwaysReturnDailyFeb29=false&format=json&beginDate=${formatDate(startDate)}&endDate=${formatDate(endDate)}`
90 );
143 return c.json(apiResponse);
144 } catch (error) {
145 console.error("Error fetching data:", error);
146 const apiResponse: ApiResponse<SnotelData[]> = {
147 success: false,
152});
153
154export default app.fetch;

Snotel-Analyzerindex.html10 matches

@bjtitus•Updated 11 hours ago
34
35 useEffect(() => {
36 fetchData();
37 }, []);
38
39 const fetchData = async () => {
40 try {
41 setLoading(true);
42 setError(null);
43
44 // Fetch sites and data in parallel
45 const [sitesResponse, dataResponse] = await Promise.all([
46 fetch('/api/sites'),
47 fetch('/api/data')
48 ]);
49
52
53 if (!sitesResult.success) {
54 throw new Error(sitesResult.error || 'Failed to fetch sites');
55 }
56
57 if (!dataResult.success) {
58 throw new Error(dataResult.error || 'Failed to fetch data');
59 }
60
63 } catch (err) {
64 setError(err.message);
65 console.error('Error fetching data:', err);
66 } finally {
67 setLoading(false);
103 </div>
104 <button
105 onClick={fetchData}
106 className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
107 >
122 </p>
123 <button
124 onClick={fetchData}
125 className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded transition-colors"
126 >

Snotel-AnalyzerREADME.md3 matches

@bjtitus•Updated 11 hours ago
7- Displays latest snow and weather data from SNOTEL sites
8- Interactive table with site information
9- Real-time data fetching from USDA AWDB API
10
11## Project Structure
19
20- `GET /` - Serves the main application
21- `GET /api/sites` - Fetches SNOTEL site data
22- `GET /api/data/:stationId` - Fetches latest data for a specific station
23
24## Usage

FetchBasic2 file matches

@ther•Updated 4 days ago

GithubPRFetcher

@andybak•Updated 1 week ago