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/$%7BsvgDataUrl%7D?q=function&page=77&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 31571 results for "function"(7904ms)

basic-html-starterindex.html1 match

@joestrouth1•Updated 5 days ago
39 scene.add(butterfly);
40
41 renderer.setAnimationLoop(function animate(time) {
42 renderer.render(scene, camera);
43 butterfly.rotation.y += 0.01;

marketnewsblogpostserver.ts2 matches

@cricks_unmixed4u•Updated 5 days ago
5
6// Initialize database table
7async function initDatabase() {
8 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${EMAIL_TABLE} (
9 id INTEGER PRIMARY KEY AUTOINCREMENT,
17}
18
19export default async function(req: Request): Promise<Response> {
20 const url = new URL(req.url);
21

marketnewsblogpostindex.html5 matches

@cricks_unmixed4u•Updated 5 days ago
361 let manualTheme = localStorage.getItem('theme');
362
363 function applyTheme() {
364 let isDark = manualTheme ? manualTheme === 'dark' : window.matchMedia('(prefers-color-scheme: dark)').matches;
365
379 }
380
381 function toggleTheme() {
382 const systemDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
383 manualTheme = manualTheme === null ? (systemDark ? 'light' : 'dark') :
388
389 // Iframe expansion
390 function toggleExpand() {
391 const frame = document.getElementById('soccerFrame');
392 const overlay = document.getElementById('overlay');
406 }
407
408 function toggleExpandRundown() {
409 const frame = document.getElementById('rundownFrame');
410 const overlay = document.getElementById('overlay');
425
426 // Close on overlay click
427 document.getElementById('overlay').addEventListener('click', function() {
428 if (document.getElementById('soccerFrame').classList.contains('expanded')) {
429 toggleExpand();
jsx

jsxdemo-032 matches

@jxnblk•Updated 5 days ago
4import { styles } from "./styles.tsx?hi=bloop";
5
6function App () {
7 return (
8 <html>
23}
24
25export default async function (req: Request): Promise<Response> {
26 const html = renderToString(<App />);
27 return new Response(html, {

blob_admin_honoBlobPage.tsx1 match

@stevekrouse•Updated 5 days ago
5type Blob = Awaited<ReturnType<typeof blob.list>>[number];
6
7export function BlobPage({ name, error, type, text, metadata }: {
8 name: string;
9 metadata?: Blob;
jsx

jsxdemo.tsx3 matches

@jxnblk•Updated 5 days ago
3import { renderToString } from "https://esm.sh/react-dom@19/server";
4
5function App () {
6 return (
7 <html>
22 transitionProperty: "background-color, color",
23 transitionDuration: "1s",
24 transitionTimingFunction: "ease-in-out",
25 "&:hover": {
26 backgroundColor: "magenta",
45}
46
47export default async function (req: Request): Promise<Response> {
48 const html = renderToString(<App />);
49 return new Response(html, {

blob_admin_honoLayout.tsx1 match

@stevekrouse•Updated 5 days ago
1/** @jsxImportSource npm:hono/jsx */
2
3export function Layout({ children, showLogout = true }) {
4 return (
5 <html>

my-first-val04_email.tsx1 match

@charmaine•Updated 5 days ago
2// Click "Run", copy and paste the email address and send an email to it.
3// This example will log the email details received.
4export default async function emailHandler(email: Email){
5 console.log("Email received!", email.from, email.subject, email.text);
6 for (const file of email.attachments) {

my-first-val03_cron.tsx1 match

@charmaine•Updated 5 days ago
2// Configure the timer with the 🕒 icon in the top right.
3// This example just logs the current time.
4export function scheduledHandler() {
5 const timestamp = new Date().toISOString();
6 console.log(`Cron val executed at: ${timestamp}`);

my-first-val02_http.tsx1 match

@charmaine•Updated 5 days ago
2// Access it via its public URL (you can also pick a nicer subdomain).
3// Try adding ?name=YourName to the URL!
4export default function httpHandler(req: Request): Response {
5 const url = new URL(req.url);
6 const name = url.searchParams.get("name") || "Friend";
tuna

tuna9 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 2 months ago
A helper function to build a file's email
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.