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=2698&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 29012 results for "function"(8370ms)

brownCoralmain.tsx1 match

@tarngerine•Updated 1 year ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "brooklyn navy yard"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

appendFragment_examplemain.tsx1 match

@vladimyr•Updated 1 year ago
15`.trim();
16
17export default async function(req: Request): Promise<Response> {
18 return new Response(
19 appendFragment(

codeOnValTown_testmain.tsx1 match

@vladimyr•Updated 1 year ago
4const { author, name } = extractValInfo(import.meta.url);
5
6async function serveHtml(req: Request): Promise<Response> {
7 return new Response(
8 `

codeOnValTownmain.tsx2 matches

@vladimyr•Updated 1 year ago
9 * @param val Define which val should open. Defaults to the root reference.
10 */
11export function modifyHtmlString(
12 bodyText: string,
13 { val, style }: { val?: ValRef; style?: string } = {},
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: RequestHandler,
44 { val, style }: { val?: ValRef; style?: string } = {},

dataURLmain.tsx2 matches

@vladimyr•Updated 1 year ago
2import ky from "npm:ky";
3
4export async function convertUrlToDataURL(url: string | URL): Promise<string> {
5 const blob = await ky.get(url).blob();
6 return convertBlobToDataURL(blob);
7}
8
9export function convertBlobToDataURL(blob: Blob): Promise<string> {
10 return new Promise((resolve, reject) => {
11 const reader = new FileReader();

pipeResponsemain.tsx2 matches

@vladimyr•Updated 1 year ago
6export type RequestHandler = (req?: Request) => Response | Promise<Response>;
7
8export function createWrappedHandler(
9 handler: RequestHandler,
10 ...transforms: ReadableWritablePair[]
16}
17
18export function pipeResponse(
19 res: Response,
20 ...transforms: ReadableWritablePair[]

codeOnValTownREADME.md1 match

@vladimyr•Updated 1 year ago
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`

blob_delete_by_prefixmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { blob } from "https://esm.town/v/std/blob?v=11";
2
3export async function deleteBlobs(prefix: string) {
4 (await blob.list(prefix)).forEach(({ key }) => blob.delete(key));
5}

BalanceBrightDatamain.tsx1 match

@augustohp•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function fetchBrightDataBalance(
4 token: string,
5): Promise<number> {

MyFootermain.tsx3 matches

@vladimyr•Updated 1 year ago
8const USERNAME = extractValInfo(import.meta.url).author;
9
10export async function createInjectMyFooterStream(logo = valTownLogoAuto) {
11 const footer = await MyFooter(logo);
12 return new InjectHTMLElementStream(footer.toString());
13}
14
15export async function MyFooter(logo = valTownLogoAuto) {
16 const recommendation = rootValRef().handle === USERNAME
17 ? html`<span class="recommends">${await recommends()}</span>`
41}
42
43export default async function(req) {
44 const { Layout } = await import("https://esm.town/v/postpostscript/Layout");
45 return htmlResponse`${Layout`
tuna

tuna9 file matches

@jxnblk•Updated 21 hours ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month 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.