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/?q=function&page=1412&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 18323 results for "function"(1696ms)

juicyBowTiemain.tsx4 matches

@all•Updated 7 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [mainColor, setMainColor] = useState("#666666");
8 const [patternColor, setPatternColor] = useState("#FFFFFF");
253}
254
255function client() {
256 createRoot(document.getElementById("root")).render(<App />);
257}
261}
262
263export default async function server(request: Request): Promise<Response> {
264 return new Response(
265 `
284 <script type="module">
285 import { default as mod } from "${import.meta.url}";
286 if (mod && typeof mod === "function") mod();
287 </script>
288 </body>

Chatprincipalmain.tsx5 matches

@arthrod•Updated 7 months ago
219`;
220
221function AnimatedHeadline() {
222 const [animationStarted, setAnimationStarted] = useState(false);
223 const contentRef = useRef(null);
295`;
296
297function SubheadlineAnimation() {
298 const [animationStarted, setAnimationStarted] = useState(false);
299 const contentRef = useRef(null);
422`;
423
424function App() {
425 const [isNavOpen, setIsNavOpen] = React.useState(false);
426 const toggleNav = () => {
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 <html>

hiddenVioletMockingbirdmain.tsx10 matches

@all•Updated 7 months ago
1import { blob } from "https://esm.town/v/std/blob";
2
3export default async function main(req: Request): Promise<Response> {
4 const html = `
5 <!DOCTYPE html>
149 synth.connect(analyser);
150
151 function drawOscilloscope() {
152 requestAnimationFrame(drawOscilloscope);
153 const bufferLength = analyser.size;
216
217 // Resize oscilloscope canvas
218 function resizeCanvas() {
219 oscilloscope.width = oscilloscope.clientWidth;
220 oscilloscope.height = oscilloscope.clientHeight;
251
252 // Load configuration list
253 async function loadConfigList() {
254 const response = await fetch('/config-list');
255 const configs = await response.json();
302 const eurorack = d3.select("#eurorack");
303
304 function createSlider(parent, label, min, max, value, callback, icon) {
305 const container = parent.append("div")
306 .attr("class", "slider-container");
318 .attr("class", "slider")
319 .style("background", generateGradient(min, max))
320 .on("input", function() {
321 callback(this.value);
322 this.style.background = generateGradient(min, max, this.value);
326 }
327
328 function generateGradient(min, max, value = null) {
329 const percentage = value ? (value - min) / (max - min) * 100 : 50;
330 return \`linear-gradient(to right, #4CAF50 0%, #4CAF50 \${percentage}%, #ddd \${percentage}%, #ddd 100%)\`;
422 .attr("class", "arpeggio-pill")
423 .text(pattern)
424 .on("click", function() {
425 d3.selectAll(".arpeggio-pill").classed("active", false);
426 d3.select(this).classed("active", true);
429 });
430
431 function updateArpeggio(pattern) {
432 const notes = document.getElementById("sequence").value.split(",").map(note => note.trim());
433 let arpNotes;
475 }
476
477 function updateSliders() {
478 oscTypeSlider.property("value", ["sawtooth", "square", "triangle", "sine"].indexOf(synth.oscillator.type) / 3);
479 cutoffSlider.property("value", synth.filter.frequency.value);

laserSimmain.tsx3 matches

@all•Updated 7 months ago
76};
77
78function App() {
79 const [position, setPosition] = useState({ x: 0, y: 0 });
80 const [isLaserOn, setIsLaserOn] = useState(false);
199}
200
201function client() {
202 createRoot(document.getElementById("root")).render(<App />);
203}
205if (typeof document !== "undefined") { client(); }
206
207async function server(request: Request): Promise<Response> {
208 return new Response(`
209 <html>

BalanceCapMonstermain.tsx1 match

@augustohp•Updated 7 months ago
1import fetchBalanceFromCaptchaProvider from "https://esm.town/v/augustohp/CaptchaGetBalance";
2
3export default async function fetchAntiCaptchaBalance(
4 token: string,
5): Promise<number> {

BalanceAntiCaptchamain.tsx1 match

@augustohp•Updated 7 months ago
1import fetchBalanceFromCaptchaProvider from "https://esm.town/v/augustohp/CaptchaGetBalance";
2
3export default async function fetchAntiCaptchaBalance(
4 token: string,
5): Promise<number> {

whoIsHiringAboutmain.tsx1 match

@vawogbemi•Updated 7 months ago
1/** @jsxImportSource https://esm.sh/react */
2
3export default function About() {
4 const linkClass = "text-sky-600 hover:text-sky-500";
5

CaptchaGetBalancemain.tsx1 match

@augustohp•Updated 7 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function fetchBalanceFromCaptchaProvider(
4 token: string,
5 provider: "capmonster" | "anticaptcha" | "nextcaptcha",

v3FanFicScrapermain.tsx7 matches

@willthereader•Updated 7 months ago
5console.log("Script started");
6
7function App() {
8 const [url, setUrl] = useState("");
9 const [scrapedData, setScrapedData] = useState("");
56}
57
58function client() {
59 console.log("Client function called");
60 const rootElement = document.getElementById("root");
61 if (rootElement) {
67
68if (typeof document !== "undefined") {
69 console.log("Document is defined, calling client function");
70 client();
71} else {
72 console.log("Document is undefined, skipping client function");
73}
74
75async function server(request: Request): Promise<Response> {
76 console.log("Server function called");
77
78 if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {

XKCDComicOfTheDaymain.tsx1 match

@wolf•Updated 7 months ago
2import { load } from "npm:cheerio";
3
4export default async function(req: Request): Promise<Response> {
5 const response = await fetchText("https://xkcd.com/");
6 const $ = load(response);

getFileEmail4 file matches

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

tuna8 file matches

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