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=1285&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 13429 results for "fetch"(2996ms)

addSendGridEmailmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// called by supabase newsletter trigger (defined in sql editor)
4export let addSendGridEmail = ({ token, email, listId }) =>
5 fetchJSON("https://api.sendgrid.com/v3/marketing/contacts", {
6 method: "PUT",
7 headers: {

getWeatherByCoordsmain.tsx2 matches

@onemanwenttomow•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function getWeatherByCoords(lat, long) {
4 const weather = await fetchJSON(
5 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${long}&hourly=temperature_2m,precipitation_probability&forecast_days=1`,
6 );

newRSSItemsmain.tsx2 matches

@iakovos•Updated 1 year ago
1import { fetchAndParseFeeds } from "https://esm.town/v/iakovos/fetchAndParseFeeds";
2
3export const newRSSItems = async ({ url, type, lastRunAt }) => {
4 const items = await fetchAndParseFeeds(url);
5 return items?.filter(({ pubDate }) =>
6 lastRunAt && new Date(pubDate) > new Date(lastRunAt)

meowmain.tsx2 matches

@endingwithali•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let meow = fetchJSON(
4 "https://pokeapi.co/api/v2/pokemon/ditto"
5);

githubReposmain.tsx2 matches

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

load_new_subreddit_postsmain.tsx12 matches

@bnorick•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let load_new_subreddit_posts = async ({
5 filters,
6 after_utc,
7 fetch_limit,
8}) => {
9 let patterns = [];
23 }
24
25 let next_fetch_from = null;
26 let matches = [];
27 let new_posts = 0;
28 let fetches = 1;
29 let data = await fetchJSON(
30 `https://www.reddit.com/r/${subreddit}/new/.json`
31 );
65
66 let last_post_name = data.data.children.at(-1).data.name;
67 // mark this subreddit for additional fetches if it reached its budget
68 if (fetches == fetch_limit) {
69 next_fetch_from = last_post_name;
70 break;
71 }
72 fetches += 1;
73 data = await fetchJSON(
74 `https://www.reddit.com/r/${subreddit}/new/.json?after=${last_post_name}`
75 );
82 new_posts: new_posts,
83 matches: matches,
84 fetches: fetches,
85 next_fetch_from: next_fetch_from,
86 };
87};

badWordsWith5LettersOrLessmain.tsx2 matches

@joemaffei•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let badWordsWith5LettersOrLess = (async () => {
4 const res = await fetch(
5 "https://raw.githubusercontent.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words/master/en",
6 );

githubmain.tsx2 matches

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

boredActivitiesmain.tsx2 matches

@bobbydigital•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Activity suggestions for when you're bored
4export let boredActivities = fetchJSON(
5 "https://www.boredapi.com/api/activity"
6);

test_concurrencyDoesntWorkmain.tsx17 matches

@alp•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const test_concurrencyDoesntWork = (async () => {
4 const fetchDelayedResponse = async (index: number) => {
5 const start = Date.now();
6 const response = await fetch(
7 "https://api.val.town/v1/express/alp.proxyFetch1",
8 {
9 method: "POST",
19 );
20 };
21 const fetchDelayedResponseWithLoadBalancer = async (index: number) => {
22 const start = Date.now();
23 const response = await fetch(
24 `https://api.val.town/v1/express/alp.proxyFetch${index}`,
25 {
26 method: "POST",
38 console.log("w/o load balancer");
39 await Promise.all([
40 fetchDelayedResponse(1),
41 fetchDelayedResponse(2),
42 fetchDelayedResponse(3),
43 fetchDelayedResponse(4),
44 fetchDelayedResponse(5),
45 ]);
46 console.log("w/ load balancer");
47 await Promise.all([
48 fetchDelayedResponseWithLoadBalancer(1),
49 fetchDelayedResponseWithLoadBalancer(2),
50 fetchDelayedResponseWithLoadBalancer(3),
51 fetchDelayedResponseWithLoadBalancer(4),
52 fetchDelayedResponseWithLoadBalancer(5),
53 ]);
54})();

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 3 days ago