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/$%7Bsuccess?q=function&page=2371&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 30766 results for "function"(6159ms)

utilitiesdivideNumberEqually1 match

@nbbaier•Updated 4 months ago
13 *
14 * @remarks
15 * - The function ensures that the difference between any two numbers in the result
16 * is at most 1
17 * - The sum of all numbers in the returned array equals the input number

utilitiesfilterObject3 matches

@nbbaier•Updated 4 months ago
1/**
2 * Filters an object by applying a callback function to each key-value pair and returns a new object
3 * containing only the entries where the callback returns true.
4 *
5 * @template T - The type of the input object
6 * @param {T} obj - The source object to filter
7 * @param {function(T[keyof T], keyof T): boolean} callback - The predicate function to test each entry
8 * @param {T[keyof T]} callback.value - The value of the current entry
9 * @param {keyof T} callback.key - The key of the current entry
15 * // result: { b: 2, c: 3 }
16 */
17export default function<T>(
18 obj: T,
19 callback: (value: T[keyof T], key: keyof T) => boolean,

multiplayerCirclesmain.tsx6 matches

@zenmerchant•Updated 4 months ago
37// });
38
39function parseResultSet<T>(row: ResultSet): T[] {
40 return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
41}
51};
52
53function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
54 const changes: Circle[] = [];
55
74
75 const drag = (() => {
76 function dragstarted() {
77 d3.select(this).attr("stroke", "black");
78 }
79
80 function dragged(event, d) {
81 d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
82 }
83
84 function dragended() {
85 const x = d3.select(this).attr("cx");
86 const y = d3.select(this).attr("cy");
105 .call(drag)
106 .on("click", clicked);
107 function clicked(event, d) {
108 if (event.defaultPrevented) return; // dragged
109

chatGPTClonemain.tsx3 matches

@Cpk•Updated 4 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [messages, setMessages] = useState([
7 { role: 'system', content: 'You are a helpful AI assistant.' }
82}
83
84function client() {
85 createRoot(document.getElementById("root")).render(<App />);
86}
87if (typeof document !== "undefined") { client(); }
88
89export default async function server(request: Request): Promise<Response> {
90 if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
91 const { OpenAI } = await import("https://esm.town/v/std/openai");

spectacularBlackParrotmain.tsx1 match

@charmaine•Updated 4 months ago
12});
13
14async function main() {
15 let session;
16 let browser;

rentalPodcastAppmain.tsx3 matches

@Dharana•Updated 4 months ago
21}
22
23function App() {
24 const [spaces, setSpaces] = useState<PodcastSpace[]>([]);
25 const [selectedSpace, setSelectedSpace] = useState<PodcastSpace | null>(null);
133}
134
135function client() {
136 createRoot(document.getElementById("root")).render(<App />);
137}
138if (typeof document !== "undefined") { client(); }
139
140export default async function server(request: Request): Promise<Response> {
141 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
142 const KEY = "rentalPodcastApp";

sendmain.tsx2 matches

@joseforonda•Updated 4 months ago
4import { dataToRSS } from "https://esm.town/v/stevekrouse/dataToRSS";
5
6function writeEmail(subject: string, html: string) {
7 return `
8 <center>
18}
19
20export async function sendEmail(outline: any, subject: string, since: Date) {
21 const html = writeEmailHTML(outline);
22 const title = writeTitle(subject, since);

HowtoearnmoneysedateSilverBuzzard1 match

@himanshu95422•Updated 4 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

HowtoearnmoneyamiableBrownSwordfish1 match

@himanshu95422•Updated 4 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

kmain.tsx1 match

@paras•Updated 4 months ago
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {
tuna

tuna9 file matches

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