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/$%7Burl%7D?q=function&page=2430&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 27413 results for "function"(6390ms)

substrateBadgemain.tsx4 matches

@substrateUpdated 10 months ago
30`;
31
32function getHREF(mod) {
33 const url = new URL(mod);
34 return `https://val.town${url.pathname}`;
35}
36
37export function getBadgeLink(url: string): string {
38 const href = getHREF(url);
39 return `<div>
42}
43
44function handler(req: Request): Response {
45 return new Response(badge, {
46 headers: {
50}
51
52export default function htmlOrResponse(args: Request | string): string | Response {
53 if (typeof args === "string") return getBadgeLink(args);
54 if (args instanceof Request) return handler(args);

shotclipmain.tsx1 match

@kousun12Updated 10 months ago
13};
14
15async function getResults(q: string, n: number): Promise<ShotResult[]> {
16 const substrate = new Substrate({
17 apiKey: process.env.SUBSTRATE_API_KEY,

IllustratedPrimermain.tsx4 matches

@kousun12Updated 10 months ago
4import { zodToJsonSchema } from "npm:zod-to-json-schema";
5
6async function handler(req: Request): Promise<Response> {
7 const searchParams = new URL(req.url).searchParams;
8 const { prompt = "modernism" } = Object.fromEntries(searchParams);
116 </div>
117 <script>
118 function source() {
119 const currentUrl = window.location.href;
120 return currentUrl.replace(
124 }
125
126 function go() {
127 const input = document.getElementById('inputField').value;
128 const encodedInput = encodeURIComponent(input);
130 window.location.href = link;
131 }
132 document.getElementById('inputField').addEventListener('keyup', function(event) {
133 if (event.key === 'Enter') {
134 go();

substrateBadgeMiddlewaremain.tsx2 matches

@substrateUpdated 10 months ago
1import valTownBadge from "https://esm.town/v/substrate/substrateBadge";
2
3export default function badgeMiddleware(handler, url: string) {
4 return async function(req: Request): Promise<Response> {
5 if (req.method !== "GET") return await handler(req);
6

substrateBadgeMiddlewareREADME.md1 match

@substrateUpdated 10 months ago
4import wrapper from "https://esm.town/v/substrate/substrateBadgeMiddleware";
5
6async function handler(req: Request): Promise<Response> {
7 const html = `
8 <h1>Hello, world</h1>

substrateBadgeREADME.md1 match

@substrateUpdated 10 months ago
10import substrateBadge from "https://esm.town/v/substrate/substrateBadge";
11
12export default async function(req: Request): Promise<Response> {
13 const badge = substrateBadge(import.meta.url);
14 const html = `

valwritermain.tsx2 matches

@janpaul123Updated 10 months ago
11 user: "website that shows the current time",
12 content: `/** @jsxImportSource npm:react */
13export default function() {
14 return <h1>{new Date().toLocaleTimeString()}</h1>;
15}`,
91 );
92});
93export async function compile(description: string) {
94 const messages = [
95 {

spotifymain.tsx1 match

@huntyUpdated 10 months ago
125});
126
127async function getToken(c) {
128 const state = c.req.query("state") as string;
129 const authData = await db.select().from(table).where(eq(table.id, state)).limit(1);

cronPoemForSammain.tsx1 match

@iamseeleyUpdated 10 months ago
2
3// 🦹‍♂️
4export default async function (interval: Interval) {
5 await sendDailyPoem();
6}

dailyPoemForSammain.tsx2 matches

@iamseeleyUpdated 10 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3async function getRandomPoem() {
4 const response = await fetch("https://poetrydb.org/random");
5 const [poem] = await response.json();
7}
8
9export async function sendDailyPoem() {
10 try {
11 const poem = await getRandomPoem();

getFileEmail4 file matches

@shouserUpdated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 1 month ago
Simple functional CSS library for Val Town
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.