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=303&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 3114 results for "fetch"(328ms)

hasValTownStyleGuideUpdatedmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import process from "node:process";
2import { basicAuthorization } from "https://esm.town/v/stevekrouse/basicAuthorization";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
4
5export let hasValTownStyleGuideUpdated = async (since: Date) => {
6 let commits = await fetchJSON(
7 "https://api.github.com/repos/val-town/val.town/commits?path=/src/style.tsx&since=" +
8 since.toISOString(),

dsnyEventsFeedmain.tsx2 matches

@tmcw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const dsnyEventsFeed = (async () => {
4 const ics = await import("npm:ics");
5 const events = await fetch(
6 "https://a827-donatenyc.nyc.gov/DSNYApi/api/Events/GetAllByBorough?borough=",
7 )

chessTimemain.tsx2 matches

@tmcw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let chessTime = (async () => {
4 const { secondsToHours } = await import("npm:date-fns");
5 const stats = await fetch("https://lichess.org/api/user/tmcw").then((r) =>
6 r.json()
7 );

referencesmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { searchParams } from "https://esm.town/v/stevekrouse/searchParams";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function references({ token, since, until, offset, limit }: {
23 "referencedAt": string;
24}[]> {
25 const res = await fetchJSON(
26 "https://api.val.town/v1/me/references?" +
27 searchParams({

githubFollowingmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { getGithubStars } from "https://esm.town/v/vtdocs/getGithubStars?v=2";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4// Github following
5export let githubFollowing =
6 (await fetchJSON(
7 "https://api.github.com/users/stevekrouse/following",
8 )).map((f) => f.login).map((h) => ({

stevekrouseFollowingmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { twitterJSON } from "https://esm.town/v/stevekrouse/twitterJSON";
4
6 let userId = 431200836; // stevekrouse
7 twitterJSON;
8 let resp = await fetchJSON(
9 `https://api.twitter.com/1.1/friends/ids.json?user_id=${userId}`,
10 {

privateAPIUnauthenticatedmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const privateAPIUnauthenticated =
4 (await fetch("https://api.val.town/v1/run/stevekrouse.example3")).status;

pricemain.tsx3 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let price = async (asset, base = "usd", amount = 1) => {
4 let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`)
5 if (rates && rates[asset.toUpperCase()]) return amount * (1 / rates[asset.toUpperCase()])
6 else {
7 let { rates } = await fetchJSON('https://api.coingecko.com/api/v3/exchange_rates')
8 return amount * rates[base.toLowerCase()]?.value / rates[asset.toLowerCase()]?.value
9 }

githubFileChangedmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { githubFileCache } from "https://esm.town/v/stevekrouse/githubFileCache";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export let githubFileChanged = async (owner, repo, file) => {
5 let handle = `${owner}/${repo}/${file}`
6 let current = await fetchJSON(`https://api.github.com/repos/${owner}/${repo}/contents/${file}`)
7 let previous = githubFileCache[handle]
8 if (previous?.content && current?.content && previous?.content !== current?.content) {

elysiaExamplemain.tsx1 match

@tmcw•Updated 1 year ago
3 const app = new Elysia()
4 .get("/", () => "Hello Elysia");
5 return app.fetch(req);
6};

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago