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/$%7Bsuccess?q=fetch&page=626&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 9274 results for "fetch"(1844ms)

passwordgamemain.tsx1 match

@stevekrouse•Updated 6 months ago
54 setLoading(true);
55 try {
56 const response = await fetch("/", {
57 method: "POST",
58 body: JSON.stringify({ level, password, requirements }),

skilledCoffeePanthermain.tsx2 matches

@gigmx•Updated 6 months ago
95
96 // Test API connection
97 fetch(API_URL + "/")
98 .then(response => {
99 if (!response.ok) throw new Error();
138
139 try {
140 const response = await fetch(API_URL + "/message", {
141 method: "POST",
142 headers: {

findSlamArticlesmain.tsx1 match

@dupontgu•Updated 6 months ago
24
25 try {
26 const response = await fetch(targetUrl);
27 const html = await response.text();
28 const $ = cheerio.load(html);

slackReplyToMessagemain.tsx4 matches

@nicot•Updated 6 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const slackReplyToMessage = async (req: Request) => {
16 // Reply to app_mention events
17 if (body.event.type === "app_mention") {
18 const usersResponse = await fetchJSON(
19 `https://slack.com/api/usergroups.users.list?usergroup=S07S1056LN6`,
20 {
28 // Ensure the response was successful and contains users
29 if (!usersResponse.ok || !usersResponse.users || usersResponse.users.length === 0) {
30 console.error("Failed to fetch users or no users found");
31 return new Response(undefined, { status: 500 });
32 }
37
38 // Send a message mentioning the randomly selected user
39 const result = await fetchJSON(
40 "https://slack.com/api/chat.postMessage",
41 {

bingomain.tsx9 matches

@nn•Updated 6 months ago
40 }
41
42 const response = await fetch("/create", {
43 method: "POST",
44 headers: { "Content-Type": "application/json" },
138
139 // Record the win
140 await fetch("/record-win", {
141 method: "POST",
142 headers: { "Content-Type": "application/json" },
232
233 useEffect(() => {
234 fetchGames();
235 }, []);
236
237 const fetchGames = async () => {
238 const response = await fetch("/admin/games");
239 const data = await response.json();
240 setGames(data);
243 const deleteGame = async (id: string) => {
244 if (!confirm(`Delete game "${games.find(g => g.id === id)?.name}"?`)) return;
245 await fetch(`/admin/games/${id}`, { method: "DELETE" });
246 fetchGames();
247 };
248
249 const deleteAllGames = async () => {
250 if (!confirm("Delete ALL games? This cannot be undone!")) return;
251 await fetch("/admin/games", { method: "DELETE" });
252 fetchGames();
253 };
254

blob_adminmain.tsx2 matches

@esjay•Updated 6 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

kalshimain.tsx14 matches

@adjacent•Updated 6 months ago
15 <label for="dateSelect">Select Date: </label>
16 <input type="date" id="dateSelect">
17 <button id="fetchButton" class="fetch-button">Fetch Data</button>
18 </div>
19 <div class="table-container">
50 // Set up date picker with yesterday as default
51 const dateSelect = document.getElementById('dateSelect');
52 const fetchButton = document.getElementById('fetchButton');
53 const loadingElement = document.getElementById('loading');
54
65 dateSelect.max = formatDate(yesterday); // Prevent future dates
66
67 async function fetchData() {
68 try {
69 loadingElement.classList.remove('hidden');
70 fetchButton.disabled = true;
71
72 const selectedDate = dateSelect.value;
73 const url = \`https://kalshi-public-docs.s3.amazonaws.com/reporting/market_data_\${selectedDate}.json\`;
74 const response = await fetch(url);
75 if (!response.ok) {
76 throw new Error('Data not available for selected date');
81 renderTable();
82 } catch (error) {
83 console.error('Error fetching data:', error);
84 document.getElementById('tableBody').innerHTML =
85 '<tr><td colspan="10" style="text-align: center;">No data available for selected date</td></tr>';
86 } finally {
87 loadingElement.classList.add('hidden');
88 fetchButton.disabled = false;
89 }
90 }
150 });
151
152 // Add fetch button click handler
153 fetchButton.addEventListener('click', fetchData);
154
155 // Initial fetch
156 fetchData();
157 </script>
158 </body>
187}
188
189.fetch-button {
190 padding: 8px 16px;
191 background-color: #007bff;
197}
198
199.fetch-button:hover {
200 background-color: #0056b3;
201}
202
203.fetch-button:disabled {
204 background-color: #ccc;
205 cursor: not-allowed;

kalshimain.tsx5 matches

@lucaskohorst•Updated 6 months ago
42 let currentSort = { key: 'daily_volume', direction: 'desc' };
43
44 async function fetchData() {
45 try {
46 const response = await fetch('https://kalshi-public-docs.s3.amazonaws.com/reporting/market_data_2024-10-22.json');
47 const data = await response.json();
48 tableData = Array.isArray(data) ? data : [data]; // Handle single object or array
50 renderTable();
51 } catch (error) {
52 console.error('Error fetching data:', error);
53 }
54 }
115 });
116
117 // Initial fetch
118 fetchData();
119 </script>
120 </body>

unpaywallmain.tsx4 matches

@yawnxyz•Updated 6 months ago
1import { Hono } from "npm:hono@3";
2import { cors } from "npm:hono/cors";
3import { fetch } from "https://esm.town/v/std/fetch";
4
5const app = new Hono();
19
20 try {
21 const response = await fetch(url, options);
22 if (!response.ok) {
23 throw new Error(`HTTP error! status: ${response.status}`);
53
54 console.log('search url:', url)
55 const response = await fetch(url, options);
56 if (!response.ok) {
57 throw new Error(`HTTP error! status: ${response.status}`);
111});
112
113export default app.fetch;
114export { unpaywallDOI, unpaywallSearch };

promptOrangeHookwormmain.tsx5 matches

@rohernan76•Updated 6 months ago
7
8 useEffect(() => {
9 fetch('/weather')
10 .then(response => response.json())
11 .then(data => setWeather(data))
12 .catch(error => console.error('Error fetching weather:', error));
13 }, []);
14
41export default async function server(request: Request): Promise<Response> {
42 if (request.url.endsWith('/weather')) {
43 const weatherData = await fetchWeather();
44 return new Response(JSON.stringify(weatherData), {
45 headers: { 'Content-Type': 'application/json' },
71}
72
73async function fetchWeather() {
74 const response = await fetch(
75 'https://api.open-meteo.com/v1/forecast?latitude=40.5853&longitude=-105.0844&current_weather=true&daily=temperature_2m_max,temperature_2m_min&timezone=America%2FDenver'
76 );

proxyFetch2 file matches

@vidar•Updated 1 day ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 2 days ago