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=function&page=1560&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 18182 results for "function"(2941ms)

staticChessREADME.md1 match

@wesleychiyoka•Updated 11 months ago
6Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
7
8Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
9
10Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

staticChessREADME.md1 match

@rickygrassmuck•Updated 11 months ago
6Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
7
8Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
9
10Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

tootLatestPostsmain.tsx1 match

@geraldo•Updated 11 months ago
2import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems?v=6";
3
4export async function tootLatestPosts({ lastRunAt }: Interval) {
5 return Promise.all(
6 (await newRSSItems({

importValInChromeConsolemain.tsx1 match

@stevekrouse•Updated 11 months ago
1console.log("This runs on import");
2
3export function test() {
4 console.log("This runs when test() is called");
5}

dudemain.tsx2 matches

@stevekrouse•Updated 11 months ago
6console.log(theString);
7theString = theString.replace(`'squint-cljs/core.js'`, `'npm:squint-cljs/core.js'`);
8const AsyncFunction = Object.getPrototypeOf(async function() {}).constructor;
9await new AsyncFunction(theString)();

squintmain.tsx2 matches

@borkdude•Updated 11 months ago
6 console.log(theString);
7 theString = theString.replace(`'squint-cljs/core.js'`, `'npm:squint-cljs/core.js'`);
8 const AsyncFunction = Object.getPrototypeOf(async function() {}).constructor;
9 await (new AsyncFunction(theString)());
10})();

limit_model_forkmain.tsx2 matches

@std•Updated 11 months ago
14});
15
16export default async function(req: Request): Promise<Response> {
17 // Ensure only allowed pathnames are used
18 const { pathname, search } = new URL(req.url);
61}
62
63async function limitFreeModel(req: Request, user: any) {
64 if (user.tier === "pro") return req.body;
65 const input = await req.json();

aqimain.tsx1 match

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

tinygoHttpExampleREADME.md1 match

@maxm•Updated 11 months ago
18const resp = await fetch("https://maxm-wasmblobhost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
19const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
20export default async function(req: Request): Promise<Response> {
21 return handler(req);
22}

DropNotificationmain.tsx3 matches

@harper•Updated 11 months ago
3import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
4
5async function addProduct(id, title, url, priceAmount, priceCurrencyCode) {
6 console.debug("Adding product", { id, title, url, priceAmount, priceCurrencyCode });
7 // Insert the product if it doesn't exist
29}
30
31async function sendNewProductMessage(products) {
32 if (!products || products.length === 0) {
33 console.log("No new products to send.");
53}
54
55export default async function(interval: Interval) {
56 const brokerId = Deno.env.get("SHOPIFY_STORE_ID");
57 const first = 30;

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",