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=536&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 8457 results for "fetch"(1898ms)

generateframeImageREADME.md1 match

@michaelwschultz•Updated 6 months ago
5### Why
6I'm using this val for my 3-color e-ink display run by a Raspberry Pi Zero W. The Pi runs a cron job that tell's it
7to fetch this url twice a day and render it to the display. Works like a charm.
8
9Right now I'm not displaying much but I'm going to keep iterating on what type of information I want to display.

multilingualchatroommain.tsx21 matches

@trob•Updated 6 months ago
195 useEffect(() => {
196 if (roomId) {
197 const fetchDefaultUsername = async () => {
198 try {
199 // First, check if there's a username in localStorage
202 setUsername(storedUsername);
203 } else {
204 // If not, fetch a default username from the server
205 const response = await fetch(`/default-username?room=${roomId}`);
206 if (response.ok) {
207 const defaultUsername = await response.text();
218 }
219 } catch (error) {
220 console.error("Error fetching default username:", error);
221 }
222 };
223
224 fetchDefaultUsername();
225 }
226 }, [roomId]);
230 const pollMessages = async () => {
231 try {
232 const response = await fetch(`/messages?room=${roomId}&language=${language}`);
233 if (response.ok) {
234 const newMessages = await response.json();
242 }
243 } catch (error) {
244 console.error("Error fetching messages:", error);
245 }
246 };
247
248 const fetchUsers = async () => {
249 try {
250 const response = await fetch(`/users?room=${roomId}`);
251 if (response.ok) {
252 const userList = await response.json();
254 }
255 } catch (error) {
256 console.error("Error fetching users:", error);
257 }
258 };
259
260 const fetchTypingUsers = async () => {
261 try {
262 const response = await fetch(`/typing-users?room=${roomId}`);
263 if (response.ok) {
264 const typingUsersList = await response.json();
266 }
267 } catch (error) {
268 console.error("Error fetching typing users:", error);
269 }
270 };
271
272 pollMessages();
273 fetchUsers();
274 fetchTypingUsers();
275 const messageIntervalId = setInterval(pollMessages, 2000);
276 const userIntervalId = setInterval(fetchUsers, 5000);
277 const typingIntervalId = setInterval(fetchTypingUsers, 1000);
278
279 return () => {
289 if (language !== "en") {
290 try {
291 const translatedMessage = await fetch("/translate-text", {
292 method: "POST",
293 headers: { "Content-Type": "application/json" },
315 if (inputMessage && roomId && username) {
316 try {
317 const response = await fetch("/send-message", {
318 method: "POST",
319 headers: { "Content-Type": "application/json" },
346 } else {
347 try {
348 const response = await fetch("/update-user", {
349 method: "POST",
350 headers: { "Content-Type": "application/json" },
403 if (roomId && username) {
404 try {
405 await fetch("/update-typing", {
406 method: "POST",
407 headers: { "Content-Type": "application/json" },

Update_Wise_Old_ManREADME.md1 match

@evanrh•Updated 6 months ago
6## Config
7
8You need an environment variable called `OSRS_USERS`, which has a comma-separated string of usernames to fetch
9
10Example: `OSRS_USERS=zezima,LynxTitan,Mageboy20`

welcomingPinkAlligatormain.tsx1 match

@problem•Updated 6 months ago
85
86 try {
87 const response = await fetch("/", {
88 method: "POST",
89 body: JSON.stringify({ prompt, currentCode: code, errorMessage: shaderErrorMessage }),

dailyDadJokemain.tsx2 matches

@problem•Updated 6 months ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

isMyWebsiteDownmain.tsx2 matches

@zicklag•Updated 6 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

vttThumbMakermain.tsx1 match

@g•Updated 6 months ago
18app.get('*', r404);
19
20export default app.fetch;
21
22function html() {

seamlessBlushSwallowmain.tsx1 match

@stevekrouse•Updated 6 months ago
66
67 try {
68 const response = await fetch("/", {
69 method: "POST",
70 body: JSON.stringify({ prompt, currentCode: code }),

welcomingPinkAlligatormain.tsx1 match

@stevekrouse•Updated 6 months ago
85
86 try {
87 const response = await fetch("/", {
88 method: "POST",
89 body: JSON.stringify({ prompt, currentCode: code, errorMessage: shaderErrorMessage }),

welcomingPinkAlligatormain.tsx1 match

@stevekrouse•Updated 6 months ago
85
86 try {
87 const response = await fetch("/", {
88 method: "POST",
89 body: JSON.stringify({ prompt, currentCode: code, errorMessage: shaderErrorMessage }),

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago