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=image&page=232&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=image

Returns an array of strings in format "username" or "username/projectName"

Found 2617 results for "image"(507ms)

bingImageOfDayfetchBingImage.tsx17 matches

@wolf•Updated 1 month ago
1/**
2 * Helper function to fetch the Bing Image of the Day
3
4 * @returns Promise containing the image response
5 */
6export async function fetchBingImage(): Promise<Response> {
7 try {
8 // Fetch the HTML page
10 const html = await pageResponse.text();
11
12 // Extract image URL using regex for img tag with class "fl"
13 const match = html.match(/<img[^>]*class="fl"[^>]*src="([^"]+)"/);
14 if (!match) throw new Error("Could not find image URL");
15
16 // Remove _mb suffix to get full resolution image
17 const imageUrl = match[1].replace("_mb", "");
18
19 // Fetch the actual image
20 const imageResponse = await fetch(imageUrl);
21
22 if (!imageResponse.ok) {
23 throw new Error(`Failed to fetch image: ${imageResponse.status}`);
24 }
25
26 // Return the image with appropriate headers
27 return new Response(await imageResponse.arrayBuffer(), {
28 headers: {
29 "Content-Type": "image/jpeg",
30 "Cache-Control": "public, max-age=3600",
31 "X-Image-Source": "Bing Daily Image via gifposter.com",
32 "X-Image-URL": imageUrl,
33 },
34 });
35 } catch (error) {
36 console.error("Error:", error);
37 return new Response(`Error fetching image: ${error.message}`, {
38 status: 500,
39 headers: { "Content-Type": "text/plain" },

bingImageOfDaybackupImage.tsx12 matches

@wolf•Updated 1 month ago
1import { blob } from "https://esm.town/v/std/blob";
2import { fetchBingImage } from "./fetchBingImage.tsx";
3
4/**
5 * Backup the current Bing Image of the Day to blob storage
6 */
7export async function backupBingImage(): Promise<void> {
8 try {
9 // Fetch the Bing image of the day using our helper
10 const response = await fetchBingImage();
11
12 if (!response.ok) {
14 }
15
16 // Get the image as a binary blob
17 const imageBlob = await response.blob();
18
19 // Create a filename with today's date in mm-dd-yyyy format
20 const today = new Date();
21 const filename = `bing-images-of-day/${today.getMonth() + 1}-${today.getDate()}-${today.getFullYear()}.jpg`;
22
23 // Store the image in blob storage
24 await blob.set(filename, imageBlob);
25
26 console.log(`Bing image of the day saved: ${filename}`);
27 } catch (error) {
28 console.error("Failed to fetch or save Bing image:", error);
29 }
30}

forky_1742582577934index.html1 match

@charmaine•Updated 1 month ago
6 <title>React Hono Val Town Starter</title>
7 <script src="https://cdn.tailwindcss.com"></script>
8 <link rel="icon" href="/public/favicon.svg" sizes="any" type="image/svg+xml">
9 </head>
10 <body>

forky_1742582577934index.ts1 match

@charmaine•Updated 1 month ago
69 name: `${projectDetails.name}_${Date.now().toString()}`,
70 description: projectDetails.description ?? undefined,
71 imageUrl: projectDetails.imageUrl ?? undefined,
72 });
73 console.log("New project created:", newProject);

tank_1742579939417tank.js15 matches

@shouser•Updated 1 month ago
16
17class Face {
18 constructor(currImageSource, xPos, yPos, xSpeed, ySpeed, topTint) {
19 this.faceRightImageSource = 'res/falafelFaceRight.png';
20 this.faceLeftImageSource = 'res/falafelFaceLeft.png';
21
22 this.topTint = topTint;
25 this.xSpeed = xSpeed;
26 this.ySpeed = ySpeed;
27 this.currImageSource = currImageSource
28 this.image = loadImage(currImageSource);
29 }
30
31 flip() {
32 if (this.currImageSource == this.faceRightImageSource) {
33 this.currImageSource = this.faceLeftImageSource;
34 } else if (this.currImageSource == this.faceLeftImageSource) {
35 this.currImageSource = this.faceRightImageSource;
36 }
37
38 this.image = loadImage(this.currImageSource);
39 }
40
41 move() {
42 image(this.image, this.xPos, this.yPos);
43
44 this.xPos = this.xPos + this.xSpeed;
45 this.yPos = this.yPos + this.ySpeed;
46
47 if (this.xPos + this.image.width >= width) {
48 this.xSpeed = -this.xSpeed;
49 this.xPos = width - this.image.width;
50 this.tint();
51 this.flip();
57 }
58
59 if (this.yPos + this.image.height >= height) {
60 this.ySpeed = -this.ySpeed;
61 this.yPos = height - this.image.height;
62 this.tint();
63 } else if (this.yPos <= 0) {

import_from_githubindex.ts1 match

@shouser•Updated 1 month ago
267 "ico",
268 "webp",
269 "tiff", // Images
270 "pdf",
271 "doc",

forky_1742579787862index.html1 match

@shouser•Updated 1 month ago
6 <title>React Hono Val Town Starter</title>
7 <script src="https://cdn.tailwindcss.com"></script>
8 <link rel="icon" href="/public/favicon.svg" sizes="any" type="image/svg+xml">
9 </head>
10 <body>

forky_1742579787862index.ts1 match

@shouser•Updated 1 month ago
69 name: `${projectDetails.name}_${Date.now().toString()}`,
70 description: projectDetails.description ?? undefined,
71 imageUrl: projectDetails.imageUrl ?? undefined,
72 });
73 console.log("New project created:", newProject);

forkyindex.ts1 match

@shouser•Updated 1 month ago
69 name: `${projectDetails.name}_${Date.now().toString()}`,
70 description: projectDetails.description ?? undefined,
71 imageUrl: projectDetails.imageUrl ?? undefined,
72 });
73 console.log("New project created:", newProject);

pondiverseindex.html3 matches

@todepond•Updated 1 month ago
7<title>Pondiverse</title>
8<!-- <link rel="shortcut icon" href="/favicon.png" /> -->
9<!-- <meta property="og:image" content="https://todepond.com/og.png" /> -->
10<!-- <meta property="og:title" content="Todepond dot com" /> -->
11<!-- <meta name="twitter:card" content="summary_large_image" /> -->
12<!-- <meta name="twitter:title" content="Todepond dot com" /> -->
13<!-- <meta name="twitter:description" content="" /> -->
14<!-- <meta name="twitter:image" content="https://todepond.com/og.png" /> -->
15
16<link rel="stylesheet" href="/style.css" />

brainrot_image_gen1 file match

@dcm31•Updated 1 day ago
Generate images for Italian Brainrot characters using FAL AI

bingImageOfDay4 file matches

@wolf•Updated 1 month ago