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/$%7Bart_info.art.src%7D?q=fetch&page=773&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 8046 results for "fetch"(1350ms)

fetchABirdmain.tsx3 matches

@crsven•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let fetchABird = async () => {
4 const MAX_ID = 777905;
5 const baseUrl = "https://xeno-canto.org/api/2/recordings";
6 const minAnimalId = Math.floor(Math.random() * (MAX_ID + 10));
7 const query = `?query=nr:${minAnimalId}-${minAnimalId + 10}`;
8 const response = await fetch(`${baseUrl}${query}`);
9 const json = await response.json();
10 return json.recordings[Math.floor(Math.random() * 9)];

fourchan_catalogmain.tsx2 matches

@nukeop•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const fourchan_catalog = (board: string) =>
4 fetchJSON(`https://a.4cdn.org/${board}/catalog.json`);

isCloseToCitibikeStationmain.tsx2 matches

@philherbert•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const isCloseToCitibikeStation = async ({ lon, lat }) => {
7 const dist = (station) =>
8 Math.sqrt(Math.pow(station.lat - lat, 2) + Math.pow(station.lon - lon, 2));
9 const { data } = await fetchJSON(
10 "https://gbfs.citibikenyc.com/gbfs/en/station_information.json",
11 );

githubReposmain.tsx2 matches

@grantcuster•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// GitHub repos
4export let githubRepos = fetchJSON(
5 "https://api.github.com/users/stevekrouse/repos"
6);

pugmain.tsx2 matches

@wilt•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function pug(
14 const { default: genCode } = await pugCodegen;
15 const pugFnStr = genCode(parser.parse(), { inlineRuntimeFunctions: true });
16 const evalResp = await fetch("https://api.val.town/v1/eval", {
17 method: "POST",
18 body: JSON.stringify({

nyChargingStationsmain.tsx2 matches

@tmcw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const nyChargingStations = (async () => {
5 const { group } = await import("npm:d3-array");
6 const { micromark } = await import("npm:micromark");
7 const rows = await fetch(
8 "https://data.ny.gov/api/views/7rrd-248n/rows.csv?accessType=DOWNLOAD&sorting=true",
9 )

evalPost1main.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let evalPost1 = fetchJSON(
4 "https://api.val.town/v1/eval",
5 {

fetchCongressTradeReportsmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function fetchCongressTradeReports({ lastRunAt }) {
5 const res = await fetchJSON(
6 "https://bff.capitoltrades.com/trades?sortBy=-pubDate",
7 );

subredditExamplemain.tsx2 matches

@funkie•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Reddit recent posts from /r/aww (cute animals)
4export let subredditExample = fetchJSON(
5 "https://www.reddit.com/r/aww/.json"
6);

simpleSurfmain.tsx3 matches

@cjpais•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const simpleSurf = (async () => {
4 // fetch these from the surfline page
5 const spotIds = [
6 "5842041f4e65fad6a770883f",
11 ];
12 const spots = spotIds.join(",");
13 const surfForecast = await fetch(
14 `https://services.surfline.com/kbyg/spots/batch?units%5BswellHeight%5D=FT&units%5Btemperature%5D=F&units%5BtideHeight%5D=FT&units%5BwaveHeight%5D=FT&units%5BwindSpeed%5D=KTS&spotIds=${spots}`,
15 ).then((r) => r.json()).then((d) => d.data);

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago