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/image-url.jpg%20%22Image%20title%22?q=function&page=2510&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 29319 results for "function"(4849ms)

digitalMemorialmain.tsx11 matches

@allUpdated 8 months ago
42const urnIcon = "⚱️";
43
44function App() {
45 const [tributeCount, setTributeCount] = useState(0);
46 const [eulogyMessage, setEulogyMessage] = useState("");
113 const end = Date.now() + (5 * 1000);
114
115 (function frame() {
116 confetti({
117 particleCount: 20,
143 const defaults = { startVelocity: 15, spread: 360, ticks: 60, zIndex: 0 };
144
145 function randomInRange(min: number, max: number) {
146 return Math.random() * (max - min) + min;
147 }
148
149 const interval = setInterval(function() {
150 const timeLeft = animationEnd - Date.now();
151
176 const animationEnd = Date.now() + duration;
177
178 function randomInRange(min: number, max: number) {
179 return Math.random() * (max - min) + min;
180 }
181
182 (function frame() {
183 const timeLeft = animationEnd - Date.now();
184
211 };
212
213 function fire(particleRatio: number, opts: any) {
214 confetti(Object.assign({}, defaults, opts, {
215 particleCount: Math.floor(count * particleRatio),
253 const smokeColors = ["#a0a0a0", "#b0b0b0", "#c0c0c0", "#d0d0d0"];
254
255 function randomInRange(min: number, max: number) {
256 return Math.random() * (max - min) + min;
257 }
258
259 (function frame() {
260 const timeLeft = animationEnd - Date.now();
261
482}
483
484function client() {
485 createRoot(document.getElementById("root")).render(<App />);
486}
488if (typeof document !== "undefined") { client(); }
489
490export default async function server(request: Request): Promise<Response> {
491 return new Response(
492 `

freshFettimain.tsx9 matches

@allUpdated 8 months ago
29];
30
31function App() {
32 const [clickCount, setClickCount] = useState(0);
33 const [splashMessage, setSplashMessage] = useState("");
89 const end = Date.now() + (5 * 1000);
90
91 (function frame() {
92 confetti({
93 particleCount: 50,
117 const defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 };
118
119 function randomInRange(min: number, max: number) {
120 return Math.random() * (max - min) + min;
121 }
122
123 const interval = setInterval(function() {
124 const timeLeft = animationEnd - Date.now();
125
150 const animationEnd = Date.now() + duration;
151
152 function randomInRange(min: number, max: number) {
153 return Math.random() * (max - min) + min;
154 }
155
156 (function frame() {
157 const timeLeft = animationEnd - Date.now();
158
186 };
187
188 function fire(particleRatio: number, opts: any) {
189 confetti(Object.assign({}, defaults, opts, {
190 particleCount: Math.floor(count * particleRatio),
440}
441
442function client() {
443 createRoot(document.getElementById("root")).render(<App />);
444}
446if (typeof document !== "undefined") { client(); }
447
448export default async function server(request: Request): Promise<Response> {
449 return new Response(
450 `

sqliteExplorerAppREADME.md1 match

@florian42Updated 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

tsParticlesValmain.tsx3 matches

@allUpdated 8 months ago
6import type { Engine } from "https://esm.sh/tsparticles-engine";
7
8function App() {
9 const [isAnimationPaused, setIsAnimationPaused] = useState(false);
10 const [particleColor, setParticleColor] = useState("#ffffff");
143}
144
145function client() {
146 createRoot(document.getElementById("root")).render(<App />);
147}
149if (typeof document !== "undefined") { client(); }
150
151export default async function server(request: Request): Promise<Response> {
152 return new Response(`
153 <html>

goodVibesmain.tsx4 matches

@allUpdated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const containerRef = useRef<HTMLDivElement>(null);
7 const textRef = useRef<HTMLHeadingElement>(null);
15 const distance = 30;
16
17 function setShadow(e: MouseEvent) {
18 const width = container.offsetWidth;
19 const height = container.offsetHeight;
68}
69
70function client() {
71 createRoot(document.getElementById("root")!).render(<App />);
72}
74if (typeof document !== "undefined") { client(); }
75
76export default async function server(request: Request): Promise<Response> {
77 return new Response(
78 `

excaliGridmain.tsx6 matches

@allUpdated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function ExcalidrawCanvas({ name, url, onRemove, onRename, onUrlChange }) {
6 return (
7 <div className="excalidraw-canvas">
35}
36
37function Card({ title, url, svgUrl }) {
38 const [svg, setSvg] = useState("");
39
61}
62
63function Console({ canvases }) {
64 return (
65 <div className="console">
70}
71
72function App() {
73 const [canvases, setCanvases] = useState([
74 {
166}
167
168function client() {
169 createRoot(document.getElementById("root")).render(<App />);
170}
174}
175
176export default async function server(request: Request): Promise<Response> {
177 return new Response(
178 `

chronospheremain.tsx8 matches

@allUpdated 8 months ago
88};
89
90function App() {
91 const canvasRef = useRef(null);
92 const [isLoaded, setIsLoaded] = useState(false);
168 const mouse = new THREE.Vector2();
169
170 function onMouseMove(event) {
171 mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
172 mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
187 window.addEventListener("mousemove", onMouseMove, false);
188
189 function animate(time) {
190 requestAnimationFrame(animate);
191
252}
253
254function client() {
255 console.log("Client function called");
256 const root = document.getElementById("root");
257 if (root) {
264
265if (typeof document !== "undefined") {
266 console.log("Document is defined, calling client function");
267 client();
268}
269
270export default async function server(request: Request): Promise<Response> {
271 console.log("Server function called");
272 return new Response(
273 `

chronoGenmain.tsx4 matches

@allUpdated 8 months ago
37};
38
39function App() {
40 const canvasRef = useRef(null);
41 const [renderer, setRenderer] = useState(null);
214 setOutput(''); // Clear previous output
215 try {
216 const safeEval = new Function('chs', 'data', 'setData', 'addChunkToScene', 'addModelToScene', `
217 ${code}
218 return { data, output: console.log };
321}
322
323function client() {
324 createRoot(document.getElementById("root")).render(<App />);
325}
327if (typeof document !== "undefined") { client(); }
328
329export default async function server(request: Request): Promise<Response> {
330 return new Response(`
331 <html>

getModelBuildermain.tsx2 matches

@lt_07Updated 8 months ago
1import process from "node:process";
2
3export async function getModelBuilder(spec: {
4 type?: "llm" | "chat" | "embedding";
5 provider?: "openai" | "huggingface";
65 ],
66 ]);
67 // Return function to prevent "Serialization Error"
68 return () => setup(spec);
69}

getModelBuilder_deleted_1727331494main.tsx2 matches

@lt_07Updated 8 months ago
1import process from "node:process";
2
3export async function getModelBuilder(spec: {
4 type?: "llm" | "chat" | "embedding";
5 provider?: "openai" | "huggingface";
65 ],
66 ]);
67 // Return function to prevent "Serialization Error"
68 return () => setup(spec);
69}
tuna

tuna9 file matches

@jxnblkUpdated 1 day ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouserUpdated 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.