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%22Optional%20title%22?q=function&page=2436&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 28553 results for "function"(1830ms)

looseTomatoCougarmain.tsx1 match

@willthereader•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [links, setLinks] = useState([]);
7 const [error, setError] = useState(null);

datetimeFormatterToolmain.tsx3 matches

@maxencelav•Updated 8 months ago
15];
16
17function App() {
18 const [dateTime, setDateTime] = useState("2023-06-15T14:30:00");
19 const [selectedFormat, setSelectedFormat] = useState("MM/dd/yyyy");
92}
93
94function client() {
95 createRoot(document.getElementById("root")).render(<App />);
96}
100}
101
102export default async function server(request: Request): Promise<Response> {
103 return new Response(
104 `

drumMachinemain.tsx6 matches

@sedson•Updated 8 months ago
14const searchUrl = "https://sedson-freesoundsearch.web.val.run";
15
16function WaveformPreview({ buffer, start, end }) {
17 const canvasRef = useRef(null);
18 useEffect(() => {
55}
56
57function trimAudioBuffer(originalBuffer, maxDurationInSeconds = 1) {
58 const sampleRate = originalBuffer.sampleRate;
59 const numberOfChannels = originalBuffer.numberOfChannels;
79}
80
81function ControlRow({ track, onVolumeChange, onSpeedChange, onStartChange, onEndChange, onSearchChange }) {
82 const [searchInput, setSearchInput] = useState(track.search);
83
172}
173
174function App() {
175 const [sequence, setSequence] = useState(Array(TRACKS).fill().map(() => Array(STEPS).fill(false)));
176 const [isPlaying, setIsPlaying] = useState(false);
362}
363
364function client() {
365 createRoot(document.getElementById("root")).render(<App />);
366}
368if (typeof document !== "undefined") { client(); }
369
370async function server(request: Request): Promise<Response> {
371 return new Response(
372 `

broadRedMarmosetmain.tsx6 matches

@willthereader•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4// first stable version is v22
5function App() {
6 const [url, setUrl] = useState("");
7 const [result, setResult] = useState(null);
66}
67
68function client() {
69 console.log("Initializing client-side React application");
70 createRoot(document.getElementById("root")).render(<App />);
75}
76
77async function scrapePage(url) {
78 console.log(`Starting to scrape page: ${url}`);
79 const apiKey = Deno.env.get("ScrapingBeeAPIkey");
108 }));
109
110 // The rest of the function remains the same
111 const extractRules = {
112 title: "h1",
190}
191
192async function getApiKey() {
193 const apiKey = Deno.env.get("ScrapingBeeAPIkey");
194 if (!apiKey) {
199}
200
201async function server(request) {
202 console.log(`Received ${request.method} request for path: ${new URL(request.url).pathname}`);
203 if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {

juicyBowTiemain.tsx4 matches

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

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.