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=image&page=89&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 12142 results for "image"(5601ms)

dotcomwords.json1 match

@petermillspaughโ€ขUpdated 1 month ago
2150 "lever",
2151 "lorry",
2152 "image",
2153 "cabby",
2154 "druid",

blob_adminREADME.md1 match

@joostโ€ขUpdated 1 month ago
3This is a lightweight Blob Admin interface to view and debug your Blob data.
4
5![Screenshot 2024-11-22 at 15.43.43@2x.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/d075a4ee-93ec-4cdd-4823-7c8aee593f00/public)
6
7To use this, fork it to your account.

blob_adminmain.tsx2 matches

@joostโ€ขUpdated 1 month ago
60 const { ValTown } = await import("npm:@valtown/sdk");
61 const vt = new ValTown();
62 const { email: authorEmail, profileImageUrl, username } = await vt.me.profile.retrieve();
63 // const authorEmail = me.email;
64
128
129 c.set("email", email);
130 c.set("profile", { profileImageUrl, username });
131 await next();
132};

blob_adminapp.tsx3 matches

@joostโ€ขUpdated 1 month ago
437 {profile && (
438 <div className="flex items-center space-x-4">
439 <img src={profile.profileImageUrl} alt="Profile" className="w-8 h-8 rounded-full" />
440 <span>{profile.username}</span>
441 <a href="/auth/logout" className="text-blue-400 hover:text-blue-300">Logout</a>
580 alt="Blob content"
581 className="max-w-full h-auto"
582 onError={() => console.error("Error loading image")}
583 />
584 </div>
630 <li>Create public shareable links for blobs</li>
631 <li>View and manage public folder</li>
632 <li>Preview images directly in the interface</li>
633 </ul>
634 </div>

aitaworkspace.xml1 match

@joostโ€ขUpdated 1 month ago
8 <AIAssistantStoredInstruction>
9 <option name="actionId" value="AIAssistant.General.ProjectPrompt" />
10 <option name="content" value="You are an advanced assistant that helps programmers code on Val Town.&#10;&#10;## Core Guidelines&#10;&#10;- Ask clarifying questions when requirements are ambiguous&#10;- Provide complete, functional solutions rather than skeleton implementations&#10;- Test your logic against edge cases before presenting the final solution&#10;- Ensure all code follows Val Town's specific platform requirements&#10;- If a section of code that you're working on is getting too complex, consider refactoring it into subcomponents&#10;&#10;## Code Standards&#10;&#10;- Generate code in TypeScript or TSX&#10;- Add appropriate TypeScript types and interfaces for all data structures&#10;- Prefer official SDKs or libraries than writing API calls directly&#10;- Ask the user to supply API or library documentation if you are at all unsure about it&#10;- **Never bake in secrets into the code** - always use environment variables&#10;- Include comments explaining complex logic (avoid commenting obvious operations)&#10;- Follow modern ES6+ conventions and functional programming practices if possible&#10;&#10;## Types of triggers&#10;&#10;### 1. HTTP Trigger&#10;&#10;- Create web APIs and endpoints&#10;- Handle HTTP requests and responses&#10;- Example structure:&#10;&#10;```ts&#10;export default async function (req: Request) {&#10; return new Response(&quot;Hello World&quot;);&#10;}&#10;```&#10;&#10;### 2. Cron Triggers&#10;&#10;- Run on a schedule&#10;- Use cron expressions for timing&#10;- Example structure:&#10;&#10;```ts&#10;export default async function () {&#10; // Scheduled task code&#10;}&#10;```&#10;&#10;### 3. Email Triggers&#10;&#10;- Process incoming emails&#10;- Handle email-based workflows&#10;- Example structure:&#10;&#10;```ts&#10;export default async function (email: Email) {&#10; // Process email&#10;}&#10;```&#10;&#10;&#10;## Val Town Standard Libraries&#10;&#10;Val Town provides several hosted services and utility functions.&#10;&#10;### Blob Storage&#10;&#10;```ts&#10;import { blob } from &quot;https://esm.town/v/std/blob&quot;;&#10;await blob.setJSON(&quot;myKey&quot;, { hello: &quot;world&quot; });&#10;let blobDemo = await blob.getJSON(&quot;myKey&quot;);&#10;let appKeys = await blob.list(&quot;app_&quot;);&#10;await blob.delete(&quot;myKey&quot;);&#10;```&#10;&#10;### SQLite&#10;&#10;```ts&#10;import { sqlite } from &quot;https://esm.town/v/stevekrouse/sqlite&quot;;&#10;const TABLE_NAME = 'todo_app_users_2';&#10;// Create table - do this before usage and change table name when modifying schema&#10;await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (&#10; id INTEGER PRIMARY KEY AUTOINCREMENT,&#10; name TEXT NOT NULL&#10;)`);&#10;// Query data&#10;const result = await sqlite.execute(`SELECT * FROM ${TABLE_NAME} WHERE id = ?`, [1]);&#10;```&#10;&#10;Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.&#10;&#10;### OpenAI&#10;&#10;```ts&#10;import { OpenAI } from &quot;https://esm.town/v/std/openai&quot;;&#10;const openai = new OpenAI();&#10;const completion = await openai.chat.completions.create({&#10; messages: [&#10; { role: &quot;user&quot;, content: &quot;Say hello in a creative way&quot; },&#10; ],&#10; model: &quot;gpt-4o-mini&quot;,&#10; max_tokens: 30,&#10;});&#10;```&#10;&#10;### Email&#10;&#10;```ts&#10;import { email } from &quot;https://esm.town/v/std/email&quot;;&#10;// By default emails the owner of the val&#10;await email({&#10; subject: &quot;Hi&quot;,&#10; text: &quot;Hi&quot;,&#10; html: &quot;&lt;h1&gt;Hi&lt;/h1&gt;&quot;&#10;});&#10;```&#10;&#10;## Val Town Utility Functions&#10;&#10;Val Town provides several utility functions to help with common project tasks.&#10;&#10;### Importing Utilities&#10;&#10;Always import utilities with version pins to avoid breaking changes:&#10;&#10;```ts&#10;import { readFile, serveFile } from &quot;https://esm.town/v/std/utils@85-main/index.ts&quot;;&#10;```&#10;&#10;### Available Utilities&#10;&#10;&#10;#### **serveFile** - Serve project files with proper content types&#10;&#10;For example, in Hono:&#10;&#10;```ts&#10;// serve all files in frontend/ and shared/&#10;app.get(&quot;/frontend/*&quot;, c =&gt; serveFile(c.req.path, import.meta.url));&#10;app.get(&quot;/shared/*&quot;, c =&gt; serveFile(c.req.path, import.meta.url));&#10;```&#10;&#10;#### **readFile** - Read files from within the project:&#10;&#10;```ts&#10;// Read a file from the project&#10;const fileContent = await readFile(&quot;/frontend/index.html&quot;, import.meta.url);&#10;```&#10;&#10;#### **listFiles** - List all files in the project&#10;&#10;```ts&#10;const files = await listFiles(import.meta.url);&#10;```&#10;&#10;## Val Town Platform Specifics&#10;&#10;- **Redirects:** Use `c.redirect()` if you're using Hono. If not, use `return new Response(null, { status: 302, headers: { Location: &quot;/place/to/redirect&quot; }})` instead of `Response.redirect` which is broken&#10;- **Images:** Avoid external images or base64 images. Use emojis, unicode symbols, or icon fonts/libraries instead&#10;- **AI Image:** To inline generate an AI image use: `&lt;img src=&quot;https://maxm-imggenurl.web.val.run/the-description-of-your-image&quot; /&gt;`&#10;- **Storage:** DO NOT use the Deno KV module for storage&#10;- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods&#10;- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified. wttr.in is a good backup.&#10;- **Error Debugging:** Add `&lt;script src=&quot;https://esm.town/v/std/catch&quot;&gt;&lt;/script&gt;` to HTML to capture client-side errors&#10;- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context&#10;- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys&#10;- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser&#10;- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites&#10;- **React Configuration:** When using React libraries, pin versions with `?deps=react@18.2.0,react-dom@18.2.0` and start the file with `/** @jsxImportSource https://esm.sh/react@18.2.0 */`&#10;- Ensure all React dependencies and sub-dependencies are pinned to the same version&#10;- **Styling:** Default to using TailwindCSS via `&lt;script src=&quot;https://cdn.twind.style&quot; crossorigin&gt;&lt;/script&gt;` unless otherwise specified&#10;&#10;## Project Structure and Design Patterns&#10;&#10;### Recommended Directory Structure&#10;```&#10;โ”œโ”€โ”€ backend/&#10;โ”‚ โ”œโ”€โ”€ database/&#10;โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions&#10;โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions&#10;โ”‚ โ”‚ โ””โ”€โ”€ README.md&#10;โ”‚ โ””โ”€โ”€ routes/ # Route modules&#10;โ”‚ โ”œโ”€โ”€ [route].ts&#10;โ”‚ โ””โ”€โ”€ static.ts # Static file serving&#10;โ”‚ โ”œโ”€โ”€ index.ts # Main entry point&#10;โ”‚ โ””โ”€โ”€ README.md&#10;โ”œโ”€โ”€ frontend/&#10;โ”‚ โ”œโ”€โ”€ components/&#10;โ”‚ โ”‚ โ”œโ”€โ”€ App.tsx&#10;โ”‚ โ”‚ โ””โ”€โ”€ [Component].tsx&#10;โ”‚ โ”œโ”€โ”€ favicon.svg&#10;โ”‚ โ”œโ”€โ”€ index.html # Main HTML template&#10;โ”‚ โ”œโ”€โ”€ index.tsx # Frontend JS entry point&#10;โ”‚ โ”œโ”€โ”€ README.md&#10;โ”‚ โ””โ”€โ”€ style.css&#10;โ”œโ”€โ”€ README.md&#10;โ””โ”€โ”€ shared/&#10; โ”œโ”€โ”€ README.md&#10; โ””โ”€โ”€ utils.ts # Shared types and functions&#10;```&#10;&#10;### Backend (Hono) Best Practices&#10;&#10;- Hono is the recommended API framework&#10;- Main entry point should be `backend/index.ts`&#10;- Do NOT use Hono serveStatic middleware&#10;- **Static asset serving:** Use the utility functions to read and serve project files:&#10; ```ts&#10; import { readFile, serveFile } from &quot;https://esm.town/v/std/utils/index.ts&quot;;&#10;&#10; // serve all files in frontend/ and shared/&#10; app.get(&quot;/frontend/*&quot;, c =&gt; serveFile(c.req.path, import.meta.url));&#10; app.get(&quot;/shared/*&quot;, c =&gt; serveFile(c.req.path, import.meta.url));&#10;&#10; // For index.html, often you'll want to bootstrap with initial data&#10; app.get(&quot;/&quot;, async c =&gt; {&#10; let html = await readFile(&quot;/frontend/index.html&quot;, import.meta.url);&#10;&#10; // Inject data to avoid extra round-trips&#10; const initialData = await fetchInitialData();&#10; const dataScript = `&lt;script&gt;&#10; window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};&#10; &lt;/script&gt;`;&#10;&#10; html = html.replace(&quot;&lt;/head&gt;&quot;, `${dataScript}&lt;/head&gt;`);&#10; return c.html(html);&#10; });&#10; ```&#10;- Create RESTful API routes for CRUD operations&#10;- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:&#10;```ts&#10;// Unwrap Hono errors to see original error details&#10;app.onError((err) =&gt; Promise.reject(err));&#10;```&#10;&#10;### Database Patterns&#10;- Run migrations on startup or comment out for performance&#10;- Change table names when modifying schemas rather than altering&#10;- Export clear query functions with proper TypeScript typing&#10;&#10;## Common Gotchas and Solutions&#10;&#10;1. **Environment Limitations:**&#10; - Val Town runs on Deno in a serverless context, not Node.js&#10; - Code in `shared/` must work in both frontend and backend environments&#10; - Cannot use `Deno` keyword in shared code&#10; - Use `https://esm.sh` for imports that work in both environments&#10;&#10;2. **SQLite Peculiarities:**&#10; - Limited support for ALTER TABLE operations&#10; - Create new tables with updated schemas and copy data when needed&#10; - Always run table creation before querying&#10;&#10;3. **React Configuration:**&#10; - All React dependencies must be pinned to 18.2.0&#10; - Always include `@jsxImportSource https://esm.sh/react@18.2.0` at the top of React files&#10; - Rendering issues often come from mismatched React versions&#10;&#10;4. **File Handling:**&#10; - Val Town only supports text files, not binary&#10; - Use the provided utilities to read files across branches and forks&#10; - For files in the project, use `readFile` helpers&#10;&#10;5. **API Design:**&#10; - `fetch` handler is the entry point for HTTP vals&#10; - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`&#10;&#10;6. **Hono Peculiarities:**&#10; - NEVER EVER write this line: `import { serveStatic } from 'https://esm.sh/hono@3.11.7/middleware';`&#10; - Instead use: `import { readFile, serveFile } from &quot;https://esm.town/v/std/utils/index.ts&quot;;`&#10; - NEVER EVER write this line: `import { cors } from &quot;https://esm.sh/@hono/cors@0.0.6&quot;;`. &#10; - Val Town automatically handles CORS.&#10; - If you need cookies, use: import { deleteCookie, getCookie, setCookie } from &quot;npm:hono/cookie&quot;;" />
11 </AIAssistantStoredInstruction>
12 </value>

aitasix.py1 match

@joostโ€ขUpdated 1 month ago
296 MovedModule("http_client", "httplib", "http.client"),
297 MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
298 MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"),
299 MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
300 MovedModule(

aitarequest.py1 match

@joostโ€ขUpdated 1 month ago
132 'realfile': ('barfile.txt', open('realfile').read()),
133 'typedfile': ('bazfile.bin', open('bazfile').read(),
134 'image/jpeg'),
135 'nonamefile': 'contents of nonamefile field',
136 }

aitafields.py1 match

@joostโ€ขUpdated 1 month ago
170 'fakefile': ('foofile.txt', 'contents of foofile'),
171 'realfile': ('barfile.txt', open('realfile').read()),
172 'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'),
173 'nonamefile': 'contents of nonamefile field',
174

aitautils.py1 match

@joostโ€ขUpdated 1 month ago
915 """Return a list of parsed link headers proxies.
916
917 i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"
918
919 :rtype: list

aita_mapping.py4 matches

@joostโ€ขUpdated 1 month ago
4FORMATTERS = {
5 'BBCodeFormatter': ('pygments.formatters.bbcode', 'BBCode', ('bbcode', 'bb'), (), 'Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there.'),
6 'BmpImageFormatter': ('pygments.formatters.img', 'img_bmp', ('bmp', 'bitmap'), ('*.bmp',), 'Create a bitmap image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
7 'GifImageFormatter': ('pygments.formatters.img', 'img_gif', ('gif',), ('*.gif',), 'Create a GIF image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
8 'GroffFormatter': ('pygments.formatters.groff', 'groff', ('groff', 'troff', 'roff'), (), 'Format tokens with groff escapes to change their color and font style.'),
9 'HtmlFormatter': ('pygments.formatters.html', 'HTML', ('html',), ('*.html', '*.htm'), "Format tokens as HTML 4 ``<span>`` tags. By default, the content is enclosed in a ``<pre>`` tag, itself wrapped in a ``<div>`` tag (but see the `nowrap` option). The ``<div>``'s CSS class can be set by the `cssclass` option."),
10 'IRCFormatter': ('pygments.formatters.irc', 'IRC', ('irc', 'IRC'), (), 'Format tokens with IRC color sequences'),
11 'ImageFormatter': ('pygments.formatters.img', 'img', ('img', 'IMG', 'png'), ('*.png',), 'Create a PNG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
12 'JpgImageFormatter': ('pygments.formatters.img', 'img_jpg', ('jpg', 'jpeg'), ('*.jpg',), 'Create a JPEG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
13 'LatexFormatter': ('pygments.formatters.latex', 'LaTeX', ('latex', 'tex'), ('*.tex',), 'Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.'),
14 'NullFormatter': ('pygments.formatters.other', 'Text only', ('text', 'null'), ('*.txt',), 'Output the text unchanged without any formatting.'),

imagen1 file match

@joinโ€ขUpdated 41 mins ago

image-slider2 file matches

@ivobgโ€ขUpdated 1 week ago
Chrimage
Atiq
"Focal Lens with Atig Wazir" "Welcome to my photography journey! I'm Atiq Wazir, a passionate photographer capturing life's beauty one frame at a time. Explore my gallery for stunning images, behind-the-scenes stories, and tips & tricks to enhance your own