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/image-url.jpg%20%22Image%20title%22?q=fetch&page=1088&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 13507 results for "fetch"(1449ms)

hackerNewsDigestmain.tsx8 matches

@igel•Updated 9 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);

hackerNewsDigestmain.tsx8 matches

@aslemammad•Updated 9 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);

hackerNewsDigestmain.tsx8 matches

@stevekrouse•Updated 9 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);

valcontributionchartmain.tsx4 matches

@iamseeley•Updated 9 months ago
1// This approach will fetch data from the specified endpoint, process it to create a GitHub-style contribution chart,
2// and render it using React. We'll use the fetch API to get the data, process it to create a heatmap-like structure,
3// and then use CSS Grid to render the chart with varying shades of green based on the number of vals created each day.
4
12
13 useEffect(() => {
14 fetch('https://ejfox-allvals.web.val.run')
15 .then(response => response.json())
16 .then(data => {
20 })
21 .catch(error => {
22 console.error('Error fetching data:', error);
23 setLoading(false);
24 });

weatherGPTmain.tsx1 match

@abar04•Updated 9 months ago
4let location = "Perth WA";
5let lang = "en";
6const weather = await fetch(
7 `https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());

duckdbExamplemain.tsx2 matches

@yawnxyz•Updated 9 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let duckdbExample = await (async () => {
8 }
9 // For browser environments (keeping the original logic)
10 const workerScript = await fetch(url);
11 const workerURL = URL.createObjectURL(await workerScript.blob());
12 return new Worker(workerURL, { type: "module" });

denoBlogAPImain.tsx1 match

@roramigator•Updated 9 months ago
5export default async function main(req: Request): Promise<Response> {
6 const url = "https://deno.com/blog";
7 const response = await fetch(url);
8 const html = await response.text();
9

bulletinBoardmain.tsx7 matches

@roramigator•Updated 9 months ago
14
15 useEffect(() => {
16 fetchPosts();
17 const interval = setInterval(fetchPosts, 30000); // Refresh every 30 seconds
18 return () => clearInterval(interval);
19 }, []);
20
21 const fetchPosts = async () => {
22 const response = await fetch("/posts");
23 const data = await response.json();
24 setPosts(data);
28 e.preventDefault();
29 setError("");
30 const response = await fetch("/post", {
31 method: "POST",
32 headers: { "Content-Type": "application/json" },
36 setNewTitle("");
37 setNewPost("");
38 fetchPosts();
39 } else {
40 const error = await response.text();
112 const url = new URL(request.url);
113 if (url.pathname === "/posts") {
114 // Fetch posts
115 const posts = await sqlite.execute(`
116 SELECT * FROM ${TABLE_NAME}

canvasvalcontributionchartmain.tsx6 matches

@ejfox•Updated 9 months ago
1async function fetchContributionData() {
2 try {
3 const response = await fetch('https://ejfox-allvals.web.val.run');
4 if (!response.ok) {
5 throw new Error(`HTTP error! status: ${response.status}`);
8 return processContributionData(data.vals);
9 } catch (error) {
10 console.error('Error fetching contribution data:', error);
11 throw error;
12 }
80async function server(request: Request): Promise<Response> {
81 try {
82 console.log('Fetching contribution data...');
83 const contributionData = await fetchContributionData();
84 console.log('Contribution data fetched successfully');
85
86 const width = 53 * (10 + 4) - 4; // 53 weeks * (10px cell + 4px gap) - 4px (no gap after last week)

valcontributionchartmain.tsx4 matches

@ejfox•Updated 9 months ago
1// This approach will fetch data from the specified endpoint, process it to create a GitHub-style contribution chart,
2// and render it using React. We'll use the fetch API to get the data, process it to create a heatmap-like structure,
3// and then use CSS Grid to render the chart with varying shades of green based on the number of vals created each day.
4
12
13 useEffect(() => {
14 fetch('https://ejfox-allvals.web.val.run')
15 .then(response => response.json())
16 .then(data => {
20 })
21 .catch(error => {
22 console.error('Error fetching data:', error);
23 setLoading(false);
24 });

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 3 days ago