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=68&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 3875 results for "fetch"(343ms)

openaiPricingfetchOpenAiUsageData5 matches

@nbbaier•Updated 1 week ago
1import { fetch } from "https://esm.town/v/std/fetch?v=4";
2
3const fetchOpenAiUsageData = async (today: string) => {
4 const response = await fetch(
5 `https://api.openai.com/v1/usage?date=${today}`,
6 {
13
14 if (!response.ok) {
15 throw new Error("Failed to fetch openAI usage data.");
16 }
17
19};
20
21export { fetchOpenAiUsageData };

openaiPricingfetchAndStoreOpenAiUsage25 matches

@nbbaier•Updated 1 week ago
1import { createDayTotal } from "./createDayTotal";
2import { cronEvalLogger as logger } from "https://esm.town/v/nbbaier/cronLogger";
3import { fetchOpenAiUsageData } from "./fetchOpenAiUsageData";
4import { updateBlobUsageDB } from "./updateBlobUsageDB";
5import { blob } from "https://esm.town/v/std/blob?v=11";
6import { fetch } from "https://esm.town/v/std/fetch";
7import { DateTime } from "npm:luxon";
8
9const fetchAndStoreOpenAiUsage = async (interval: Interval) => {
10 const timeZone = "America/Chicago";
11 const date = DateTime.now();
15
16 try {
17 const { data, whisper_api_data, dalle_api_data } = await fetchOpenAiUsageData(today);
18
19 const day_total = await createDayTotal(data, whisper_api_data, dalle_api_data);
27};
28
29export default logger(fetchAndStoreOpenAiUsage);

openaiPricingdeftAmberSwallow2 matches

@nbbaier•Updated 1 week ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=45";
2
3type Model = {
36};
37
38const modelResults = await fetchJSON(
39 "https://raw.githubusercontent.com/BerriAI/litellm/refs/heads/main/model_prices_and_context_window.json",
40) as { [key: string]: Model };

linksDB2saveTanaLink1 match

@nbbaier•Updated 1 week ago
55});
56
57export default app.fetch;
IcarusBot

IcarusBot.cursorrules5 matches

@wittiest•Updated 1 week ago
163```
164
1655. **fetchTranspiledJavaScript** - Fetch and transpile TypeScript to JavaScript:
166```ts
167const jsCode = await fetchTranspiledJavaScript("https://esm.town/v/username/project/path/to/file.ts");
168```
169
242
243 // Inject data to avoid extra round-trips
244 const initialData = await fetchInitialData();
245 const dataScript = `<script>
246 window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
300
3015. **API Design:**
302 - `fetch` handler is the entry point for HTTP vals
303 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
304 - Properly handle CORS if needed for external access

valtowntownmain.tsx1 match

@shouser•Updated 1 week ago
173});
174
175export default app.fetch.bind(app);
176
177const css = `

Bates_botgetCalendarEvents.ts6 matches

@greasegum•Updated 1 week ago
8export default async function getCalendarEvents() {
9 try {
10 console.log("Fetching calendar events...");
11
12 // Get list of active calendars to fetch
13 const activeCalendars = getActiveCalendars();
14
36 }
37
38 console.log(`Fetching events for calendar: ${calendarConfig.name}`);
39
40 try {
42 const calendar = await pipeDreamGoogle("calendar", calendarConfig.accountId);
43
44 // Fetch events from this calendar
45 const response = await calendar.events.list({
46 calendarId: calendarConfig.id,
101 }
102 } catch (error) {
103 console.error(`Error fetching calendar ${calendarConfig.name}:`, error);
104 // Continue with other calendars even if one fails
105 }
109 return { success: true, count: totalEvents };
110 } catch (error) {
111 console.error("Error fetching calendar events:", error);
112 return { success: false, error: error.message };
113 }

familyApp.tsx1 match

@meltedfire•Updated 1 week ago
9 console.log("test");
10
11 const response = await fetch("/api/test", {
12 method: "POST",
13 headers: { "Content-Type": "application/json" },

familyapp2 matches

@meltedfire•Updated 1 week ago
27 ));
28
29// HTTP vals expect an exported "fetch handler"
30export default app.fetch;

evalUImain.tsx1 match

@shouser•Updated 1 week ago
65
66 try {
67 const response = await fetch('${httpEndpoint}', {
68 method: 'POST',
69 body: code,

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago