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=782&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 8075 results for "fetch"(3077ms)

emailMeWhenBadAirQualitymain.tsx2 matches

@logan•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { set } from "https://esm.town/v/std/set?v=11";
3import { lastRun } from "https://esm.town/v/logan/lastRun";
14 throw new Error("Must define WEATHER_BIT_API_KEY in secrets");
15 }
16 const res = await fetch(
17 `https://api.weatherbit.io/v2.0/current/airquality?lat=${lat}&lon=${long}&key=${apiKey}`,
18 );

getPocketmain.tsx2 matches

@jessmartin•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export function getPocket(params) {
4 return fetchJSON("https://getpocket.com/v3/get", {
5 method: "POST",
6 body: JSON.stringify(params),

cityLookupmain.tsx2 matches

@christian•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Cities named Brooklyn
4export let cityLookup = fetchJSON(
5 "https://nominatim.openstreetmap.org/search.php?city=brooklyn&format=jsonv2"
6);

trpcmain.tsx2 matches

@stungeye•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function trpc(userHandle, valName) {
4 return await fetch(
5 `https://www.val.town/api/trpc/getValReferenceTypes?input={%22userHandle%22:%22${userHandle}%22,%22valName%22:%22${valName}%22}`,
6 ).then((data) => data.json());

aqimain.tsx2 matches

@shane98c•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let aqi = async () => {
4 let pm25 = (
5 await fetchJSON(
6 "https://api.openaq.org/v2/latest?" +
7 new URLSearchParams({

valEvalmain.tsx2 matches

@healeycodes•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const valEval = async function (
6 const encoded = encodeURIComponent(expr.toString());
7 try {
8 const res = await fetch(`https://api.val.town/eval/${encoded}`);
9 return (await res.json()).data;
10 } catch (e) {

postWebhookTest5main.tsx2 matches

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

ListenTomain.tsx2 matches

@zzz•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { runVal } from "https://esm.town/v/std/runVal";
3
6 const { val = "zzz.demoOpenAIGPT4Summary" } = req.query;
7 const url = `https://api.val.town/v1/run/${val.replace("@", "")}`
8 const resp = await fetch(url);
9 const text = await resp.text();
10 const speaker = "young_male_unmarked-1";

Tokenizermain.tsx5 matches

@zzz•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export const Tokenizer = async (text: string, modelName?: string) => {
7 );
8 const { load } = await import("https://esm.sh/@dqbd/tiktoken@1.0.7/load");
9 const registry = await fetchJSON(
10 "https://esm.sh/@dqbd/tiktoken@1.0.7/registry.json",
11 );
12 const models = await fetchJSON(
13 "https://esm.sh/@dqbd/tiktoken@1.0.7/model_to_encoding.json",
14 );
32 // Initialize the wasm via discussion in https://github.com/dqbd/tiktoken/issues/22
33 await init(async (imports) => {
34 const req = await fetch(
35 "https://esm.sh/@dqbd/tiktoken@1.0.7/lite/tiktoken_bg.wasm",
36 );

githubFollowingmain.tsx2 matches

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

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago