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=2622&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 28792 results for "function"(2405ms)

squintmain.tsx2 matches

@borkdude•Updated 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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;

pushovermain.tsx1 match

@harper•Updated 1 year ago
3// Send a pushover message.
4// token, user, and other opts are as specified at https://pushover.net/api
5export async function pushover({ token, user, message, title, device, ...opts }) {
6 try {
7 const requestBody = new URLSearchParams({

ShopifyProductSearchmain.tsx1 match

@harper•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function ShopifyProductSearch(brokerId, first = 20) {
4 // The GraphQL endpoint you're going to query
5 const url = "https://shop.app/web/api/graphql";

OpenAImain.tsx1 match

@pattysi•Updated 1 year ago
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.

staticChessREADME.md1 match

@maxm•Updated 1 year ago
9Plain, 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?
10
11Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
12
13Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

bookmarkletsmain.tsx1 match

@pomdtr•Updated 1 year ago
9const app = new Hono();
10
11async function bookmarkletUrl(author: string, name: string) {
12 const resp = await fetch(`https://esm.town/v/${author}/${name}`);
13 const { code } = await minify(await resp.text());

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 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.