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/$%7Bart_info.art.src%7D?q=function&page=2699&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 28734 results for "function"(7008ms)

staticmain.tsx1 match

@pomdtr•Updated 1 year ago
10const { author, name } = extractValInfo(import.meta.url);
11
12async function extractStaticContent(code: string) {
13 const blob = new Blob([code], { type: "text/javascript" });
14 const url = URL.createObjectURL(blob);

myApimain.tsx1 match

@atlae•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

watchNimbusDammain.tsx1 match

@chet•Updated 1 year ago
1import { watchWebsite } from "https://esm.town/v/chet/watchWebsite";
2
3export default async function(interval: Interval) {
4 await watchWebsite("https://cdec.water.ca.gov/dynamicapp/QueryRES?s=NAT");
5}

datetimemain.tsx3 matches

@tudorizer•Updated 1 year ago
1export default async function(req: Request): Promise<Response> {
2 interface DateTimeFormatsOutput {
3 iso: string;
5 }
6
7 function getSpecificDateTime(): Date {
8 return new Date();
9 }
10
11 function generateDateTimeFormatsOutput(): DateTimeFormatsOutput {
12 const specificDateTime = getSpecificDateTime();
13

minifyHTMLmain.tsx1 match

@yieldray•Updated 1 year ago
5const decoder = new TextDecoder();
6
7export async function minifyHTML(html: string, options?: Partial<MinifyHTMLOptions>) {
8 return decoder.decode(minify(encoder.encode(html), options));
9}

chocolateMeerkat_publicmain.tsx5 matches

@wannli•Updated 1 year ago
1export async function chocolateMeerkat(req) {
2 const body = await req.json();
3
14 }
15
16 // Function to escape special characters in a string for regex
17 function escapeRegExp(string) {
18 return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
19 }
20
21 // Function to dynamically generate the replacement string based on original casing
22 function replaceNameWithLink(match) {
23 const link = namesToLinks[match.toLowerCase()];
24 if (link) {

plausiblemain.tsx1 match

@saolsen•Updated 1 year ago
1export async function track(domain: string, req: Request) {
2 await fetch("https://plausible.io/api/event", {
3 method: "POST",

watchWebsitemain.tsx1 match

@chet•Updated 1 year ago
4import { fetch } from "https://esm.town/v/std/fetch";
5
6export async function watchWebsite(url: string) {
7 const newHtml = await fetch(url).then(r => r.text());
8

getBlockFeesmain.tsx1 match

@aryanj•Updated 1 year ago
1import { Options, Parser as CsvParser } from "npm:json2csv";
2
3export default async function(req: Request): Promise<Response> {
4 const blockFeesResp = await fetch("https://mempool.space/api/v1/mining/blocks/fees/3y");
5 const blockFees = await blockFeesResp.json();

traced_http_valmain.tsx4 matches

@saolsen•Updated 1 year ago
12 new Promise((resolve) => setTimeout(resolve, delay));
13
14function _foo(x: number) {
15 console.log(x);
16}
17const foo = traced("foo", _foo);
18
19function _throw() {
20 throw new Error("errr");
21}
26});
27
28async function afn(x: number): Promise<number> {
29 return x;
30}
31const tafn = traced("afn", afn);
32
33async function handler(request: Request): Promise<Response> {
34 await tracer.startActiveSpan("sub-span", async (span) => {
35 await doSomething();

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.