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=764&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 7888 results for "fetch"(812ms)

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);

postHogAPICapturemain.tsx2 matches

@ianvph•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function postHogAPICapture({ key, event, properties, distinct_id }: {
13 "distinct_id": distinct_id,
14 };
15 let result = await fetch("https://app.posthog.com/capture/", {
16 method: "POST",
17 headers: {

fetchJSONmain.tsx3 matches

@dvergin•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let fetchJSON = async (url: string, options?: any) => {
4 //url must return a JSON in string form
5 //this function parses that string into a javascript object
6 let f = await fetch(url, {
7 ...options,
8 headers: {

fetchBcycleCountsmain.tsx10 matches

@jonbo•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchBcycleCounts = (async () => {
4 const tokenResponse = await fetch(
5 "https://boulder.bcycle.com/api/bearertoken/getclient?_=1673303289964",
6 {
8 accept: "*/*",
9 "accept-language": "en-US,en;q=0.9",
10 "sec-fetch-dest": "empty",
11 "sec-fetch-mode": "cors",
12 "sec-fetch-site": "same-origin",
13 "sec-gpc": "1",
14 "x-requested-with": "XMLHttpRequest",
23 );
24 const tokenData = await tokenResponse.json();
25 const dataResponse = await fetch(
26 "https://portal-den.bcycle.com/1/publicApi/kiosks?programId=54&refresh=true&_=1673303289965",
27 {
30 "accept-language": "en-US,en;q=0.9",
31 authorization: tokenData.BearerToken,
32 "sec-fetch-dest": "empty",
33 "sec-fetch-mode": "cors",
34 "sec-fetch-site": "same-site",
35 "sec-gpc": "1",
36 },

weatherDescriptionmain.tsx2 matches

@sdan•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const weatherDescription = async (
4 params: string[],
5): Promise<unknown> => {
6 let data = await fetch(`https://wttr.in/${params["city"]}?format=j1`);
7 let jsonData = await data.json();
8 return `${params["city"]}: ${

githubGistsmain.tsx2 matches

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

fetchTextWithCachingREADME.md1 match

@iakovos•Updated 1 year ago
1Migrated from folder: RSS/fetchTextWithCaching

testFetchCommentsValREADME.md1 match

@willthereader•Updated 1 year ago
1Migrated from folder: Tangle_comment_notification/testFetchCommentsVal

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago