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=20&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 14090 results for "fetch"(3048ms)

Snotel-Analyzerindex.html10 matches

@bjtitus•Updated 3 days 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 3 days 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

tex-primitivesmain.ts2 matches

@aeaton•Updated 3 days ago
1export default async function(req: Request): Promise<Response> {
2 // fetch tex.web and extract all the lines containing primitive descriptions
3 // e.g. primitive("lineskip",assign_glue,glue_base+line_skip_code);@/
4 const url = "https://mirror.ox.ac.uk/sites/ctan.org/systems/knuth/dist/tex/tex.web";
5 const response = await fetch(url);
6 const text = await response.text();
7 const content = text.replaceAll(/\s+/g, "");

live-reloaddemo.tsx2 matches

@stevekrouse•Updated 3 days ago
21
22app.onError((e) => Promise.reject(e));
23export default app.fetch
24// export default liveReload(app.fetch, import.meta.url);

osindex.ts4 matches

@dinavinter•Updated 3 days ago
36 });
37
38 const response = await fetch(url, {
39 method: "POST",
40 headers: { "Content-Type": "application/x-www-form-urlencoded" },
65 return response;
66 } catch (error) {
67 console.error(`Error fetching account info for UID ${uid}:`, error);
68 return null;
69 }
141 return response;
142 } catch (error) {
143 console.error("Error fetching account schema:", error);
144 return null;
145 }
483});
484
485export default app.fetch;

osAccountForm.tsx1 match

@dinavinter•Updated 3 days ago
99
100 try {
101 const response = await fetch('${submitUrl}', {
102 method: '${method}',
103 headers: {

orbiterHealthmonitor3 matches

@stevedylandev•Updated 3 days ago
10async function notifySlack(message: string) {
11 try {
12 await fetch(WEBHOOK_URL, {
13 method: "POST",
14 headers: {
29 const start = performance.now();
30 try {
31 const res = await fetch(url);
32 end = performance.now();
33 status = res.status;
40 } catch (e) {
41 end = performance.now();
42 reason = `couldn't fetch: ${e}`;
43 ok = false;
44 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

townie-126useUser.tsx4 matches

@dinavinter•Updated 3 days ago
8 const [error, setError] = useState(null);
9
10 const fetchData = async () => {
11 try {
12 const userEndpoint = new URL(USER_ENDPOINT, window.location.origin);
13
14 const res = await fetch(userEndpoint);
15 const data = await res.json();
16 if (!res.ok) {
33
34 useEffect(() => {
35 fetchData();
36 }, []);
37
38 return { data, loading, error, refetch: fetchData };
39}
40

townie-126useProject.tsx5 matches

@dinavinter•Updated 3 days ago
9 const [error, setError] = useState(null);
10
11 const fetchData = async () => {
12 try {
13 const projectEndpoint = new URL(PROJECT_ENDPOINT, window.location.origin);
17 if (branchId) filesEndpoint.searchParams.append("branchId", branchId);
18
19 const { project } = await fetch(projectEndpoint).then((res) =>
20 res.json()
21 );
22 const { files } = await fetch(filesEndpoint).then((res) => res.json());
23
24 setData({ project, files });
34 useEffect(() => {
35 if (!projectId) return;
36 fetchData();
37 }, [projectId, branchId]);
38
39 return { data, loading, error, refetch: fetchData };
40}
41

townie-126useProjects.tsx4 matches

@dinavinter•Updated 3 days ago
8 const [error, setError] = useState(null);
9
10 const fetchData = async () => {
11 try {
12 const res = await fetch(ENDPOINT);
13 const data = await res.json();
14 if (!res.ok) {
32
33 useEffect(() => {
34 fetchData();
35 }, []);
36
37 return { data, loading, error, refetch: fetchData };
38}
39

FetchBasic2 file matches

@ther•Updated 1 week ago

GithubPRFetcher

@andybak•Updated 1 week ago