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=713&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 8158 results for "fetch"(3031ms)

htmxExamplemain.tsx1 match

@neverstew•Updated 1 year ago
49 </li>,
50 )));
51 return app.fetch(request);
52};

getAccessTokenmain.tsx1 match

@raymondcamden•Updated 1 year ago
5 params.append("scope", "openid,AdobeID,read_organizations");
6
7 let resp = await fetch(`https://ims-na1.adobelogin.com/ims/token/v2?client_id=${id}`, {
8 method: "POST",
9 body: params,

getRedditAccessTokenmain.tsx2 matches

@tambre•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { Buffer } from "node:buffer";
3import process from "node:process";
13 `${process.env.reddit_client_id}:${process.env.reddit_client_secret}`,
14 ).toString("base64");
15 const response = await fetch("https://www.reddit.com/api/v1/access_token", {
16 method: "POST",
17 body: formData,

authenticateRedditmain.tsx2 matches

@mschleske•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { Buffer } from "node:buffer";
3
24
25 try {
26 response = await fetch("https://www.reddit.com/api/v1/access_token", {
27 headers: headers,
28 method: "POST",

addShortlinkmain.tsx4 matches

@byjp•Updated 1 year ago
1import { shortlink_domain } from "https://esm.town/v/byjp/shortlink_domain";
2import { shortlink_repo } from "https://esm.town/v/byjp/shortlink_repo";
3import { fetch } from "https://esm.town/v/std/fetch";
4import { Buffer } from "node:buffer";
5
18 return;
19 }
20 const check = await fetch(
21 `https://${shortlink_domain}${shortlink}`,
22 {
54 };
55 const path = `https://api.github.com/repos/${shortlink_repo}/contents/public/_redirects`;
56 const getRes = await fetch(path, {
57 method: "GET",
58 headers,
80 let redirects = atob(ghJson.content);
81 redirects = `${shortlink} ${to} 302\n${redirects}`;
82 const putRes = await fetch(path, {
83 method: "PUT",
84 headers,

pollRSSFeedsmain.tsx3 matches

@iakovos•Updated 1 year ago
1import { chunk as chunk2 } from "https://esm.town/v/iakovos/chunk";
2import { fetchAndParseFeeds } from "https://esm.town/v/iakovos/fetchAndParseFeeds";
3import { lastRunAt } from "https://esm.town/v/iakovos/lastRunAt";
4import { rssFeeds } from "https://esm.town/v/iakovos/rssFeeds";
10 await Promise.all(chunk.map(async ({ name, url, type }) => {
11 try {
12 const feeds = await fetchAndParseFeeds(url) || [];
13 const newFeeds = feeds.filter(({ pubDate }) =>
14 lastRunAt
20 }
21 catch (error) {
22 console.error(`Failed to fetch items for ${name}: ${error.message}!`);
23 }
24 }));

callGoogleSheetsAPImain.tsx2 matches

@clayway•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3type Args = {
17 };
18 const { access_token } = await getToken(serviceAccount, googleAuthOptions);
19 const result = fetchJSON(
20 `https://sheets.googleapis.com/v4/spreadsheets/${sheetId}/${action}`,
21 {

nearestOpenStationmain.tsx3 matches

@tmcw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const nearestOpenStation = async ({ lon, lat }) => {
12 const {
13 data: { stations: stationInfo },
14 } = await fetch(
15 "https://gbfs.citibikenyc.com/gbfs/en/station_status.json"
16 ).then((r) => r.json());
22 const {
23 data: { stations },
24 } = await fetch(
25 "https://gbfs.citibikenyc.com/gbfs/en/station_information.json"
26 ).then((r) => r.json());

getDuckDBmain.tsx2 matches

@tmcw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let getDuckDB = (async () => {
4 async function createWorker(url: string) {
5 const workerScript = await fetch(url);
6 const workerURL = URL.createObjectURL(await workerScript.blob());
7 return new Worker(workerURL, { type: "module" });

getMuniStopInfomain.tsx2 matches

@cathy•Updated 1 year ago
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4// e.g. https://www.sfmta.com/stops/carl-st-stanyan-st-13915
5export const getMuniStopInfo = (stopCode) => {
6 return fetchJSON(
7 `https://api.511.org/transit/StopMonitoring?api_key=${process.env.transitApiKey}&agency=SF&stopCode=${stopCode}`,
8 );

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago