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=1584&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 19769 results for "function"(3103ms)

serveGithubRepomain.tsx1 match

@pomdtr•Updated 8 months ago
3import { extname, join } from "jsr:@std/path@0.225.2";
4
5export function serveGithubRepo(params: {
6 owner: string;
7 repo: string;

perlinNoiseFabricMousemain.tsx2 matches

@yawnxyz•Updated 8 months ago
1export default async function (req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html>
12 float w = 400;
13
14 // Function to calculate the vertex positions
15 float[] a(float x, float y) {
16 float k = mouseX - x;

perlinNoiseFabricColormain.tsx3 matches

@yawnxyz•Updated 8 months ago
1export default async function (req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html>
13 float w = 400;
14
15 // Function to calculate the vertex positions
16 float[] a(float x, float y) {
17 float k = w * noise(t) - x;
31 for (float y = 0; y < w; y += s) {
32 for (float x = 0; x < w; x += s) {
33 // Set the stroke color based on sine functions
34 stroke(
35 128 + 128 * sin(x * 0.01 + t),

perlinNoiseFabricmain.tsx2 matches

@yawnxyz•Updated 8 months ago
1export default async function (req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html>
13 float w = 400;
14
15 // Function to calculate the vertex positions
16 float[] a(float x, float y) {
17 float k = w * noise(t) - x;

sqliteExplorerAppREADME.md1 match

@wxw•Updated 8 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

closedChocolateMarmosetmain.tsx7 matches

@jdan•Updated 8 months ago
11const MAX_SELECTIONS = 2;
12
13function labelPredicate(label) {
14 return label === "Father" || label === "Mother" || /^Parent/.test(label);
15}
16
17async function* crawlWikipedia(
18 url: string,
19 generation: number = 0,
50}
51
52function App() {
53 const [url, setUrl] = useState("");
54 const [nodes, setNodes] = useState([]);
139 });
140
141 cyRef.current.on("tap", "node", function(evt) {
142 if (isCytoscapeDisabled) return;
143 const node = evt.target;
163 });
164
165 cyRef.current.on("layoutstop", function() {
166 cyRef.current.center();
167 cyRef.current.fit();
378}
379
380function client() {
381 createRoot(document.getElementById("root")).render(<App />);
382}
386}
387
388async function server(req: Request): Promise<Response> {
389 const url = new URL(req.url);
390

sqliteExplorerAppREADME.md1 match

@jpaulgale•Updated 8 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

lucia_middleware_vanillamain.tsx3 matches

@yawnxyz•Updated 8 months ago
1// This approach uses the Lucia authentication library with a custom ValTownAdapter.
2// It provides signup, login, and logout functionality with session management.
3// The main tradeoff is the complexity of setting up Lucia, but it offers robust auth features.
4
34}
35
36// Helper function for redirects
37function redirect(url: string, status = 302): Response {
38 return new Response(null, {
39 status,

lucia_adapter_basemain.tsx3 matches

@yawnxyz•Updated 8 months ago
127}
128
129function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
130 const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
131 return {
137}
138
139function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
140 const { id, ...attributes } = raw;
141 return {
145}
146
147function escapeName(val: string): string {
148 return "`" + val + "`";
149}

hackerNewsDigestmain.tsx4 matches

@mihai•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 20);

getFileEmail4 file matches

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

tuna8 file matches

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