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=2435&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 28554 results for "function"(2916ms)

weirdOneUptimemain.tsx3 matches

@zicklag•Updated 8 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

dependentHarlequinTigermain.tsx6 matches

@willthereader•Updated 8 months ago
1import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts";
2
3async function scrapeForumThread(url) {
4 try {
5 const browser = await puppeteer.connect({
14 // Reveal hidden content and load tabs
15 await page.evaluate(() => {
16 // Threadmark Revealer function
17 async function clickThreadmarkButtons() {
18 let clickedButtons = new Set();
19 let totalClicked = 0;
59 }
60
61 // Tab Loader function
62 function clickTabsAndLoadContent() {
63 console.log("Starting to click tabs...");
64
85 }
86
87 // Run both functions
88 return Promise.all([clickThreadmarkButtons(), clickTabsAndLoadContent()]);
89 });

growingFuchsiaFleamain.tsx2 matches

@blindmansion•Updated 8 months ago
2 "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII=";
3
4function base64ToUint8Array(base64: string): Uint8Array {
5 const binaryString = atob(base64.split(",")[1]);
6 const len = binaryString.length;
12}
13
14export default async function(req: Request): Promise<Response> {
15 const imageData = base64ToUint8Array(image);
16 return new Response(imageData, {

Badge_Generatormain.tsx3 matches

@muhammad_owais_warsi•Updated 8 months ago
4import { renderToString } from "https://esm.sh/react-dom/server";
5
6function Badge({ username, title }) {
7 return (
8 <div style={{ display: "inline-block", fontFamily: "Inter, sans-serif" }}>
38}
39
40function App() {
41 const [username, setUsername] = React.useState("");
42 const [title, setTitle] = React.useState("");
128}
129
130export default async function server(request: Request): Promise<Response> {
131 return new Response(
132 `

Whatsapp_Sendmain.tsx3 matches

@muhammad_owais_warsi•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [title, setTitle] = useState("");
7 const [embedCode, setEmbedCode] = useState("");
60}
61
62function client() {
63 createRoot(document.getElementById("root")).render(<App />);
64}
68}
69
70export default async function server(request: Request): Promise<Response> {
71 return new Response(
72 `

freesoundSearchmain.tsx2 matches

@sedson•Updated 8 months ago
25 * Get the nth sound for a search string.
26 */
27async function search(query: string, nth: number = 0): Promise<Sound> {
28 const queryString = qs.stringify({
29 query: query,
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { pathname, searchParams } = new URL(req.url);
48 let index = parseInt(searchParams.get("i"));

aqimain.tsx1 match

@phyllislim•Updated 8 months ago
7const cacheKey = location => "easyAQI_locationID_cache_" + encodeURIComponent(location);
8
9export async function easyAQI({ location }: {
10 location: string;
11}) {

iframeGridInfinitemain.tsx7 matches

@maxm•Updated 8 months ago
8import { createRoot } from "https://esm.sh/react-dom/client";
9
10function Modal({ onClose }) {
11 return (
12 <div style={{
28}
29
30function IframeCell({ cellKey, url, onUrlSubmit, isLoading }) {
31 const [inputUrl, setInputUrl] = useState(url || '');
32
59}
60
61function App() {
62 const [position, setPosition] = useState({ x: 0, y: 0 });
63 const [isDragging, setIsDragging] = useState(false);
206}
207
208function client() {
209 createRoot(document.getElementById("root")).render(<App />);
210}
212if (typeof document !== "undefined") { client(); }
213
214async function handleSubmitUrl(request: Request): Promise<Response> {
215 const { cellKey, url } = await request.json();
216 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
236}
237
238async function handleLoadUrls(): Promise<Response> {
239 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
240 const KEY = "iframeGridInfinite";
255}
256
257async function server(request: Request): Promise<Response> {
258 if (request.method === 'POST' && new URL(request.url).pathname === '/api/submit-url') {
259 return handleSubmitUrl(request);

drumMachinemain.tsx8 matches

@mo3ly•Updated 8 months ago
9const searchUrl = "https://sedson-freesoundsearch.web.val.run";
10
11function WaveformPreview({ buffer, start, end }) {
12 const canvasRef = useRef(null);
13
56}
57
58function trimAudioBuffer(originalBuffer, maxDurationInSeconds = 1) {
59 const sampleRate = originalBuffer.sampleRate;
60 const numberOfChannels = originalBuffer.numberOfChannels;
78}
79
80function ControlRow({ track, onVolumeChange, onSpeedChange, onStartChange, onEndChange, onSearchChange }) {
81 return (
82 <div className="control-row">
152}
153
154function MelodySequencer({ melodySequence, setMelodySequence, currentStep }) {
155 const noteNames = ['C', 'D', 'E', 'F', 'G', 'A', 'B', 'C'];
156
182}
183
184function BeatSequencer({ beatSequence, setBeatSequence, currentStep }) {
185 const patternNames = ['Kick', 'Snare', 'Hi-hat', 'Clap'];
186
212}
213
214function App() {
215 const [sequence, setSequence] = useState(Array(TRACKS).fill().map(() => Array(STEPS).fill(false)));
216 const [melodySequence, setMelodySequence] = useState(Array(STEPS).fill(null));
459}
460
461function client() {
462 createRoot(document.getElementById("root")).render(<App />);
463}
465if (typeof document !== "undefined") { client(); }
466
467async function server(request: Request): Promise<Response> {
468 return new Response(
469 `

saveAsPDFmain.tsx2 matches

@all•Updated 8 months ago
1function applyPDFStyles() {
2 const style = document.createElement("style");
3 style.textContent = `
77}
78
79export function saveAsPDF() {
80 const saveButton = document.getElementById("saveAsPDFButton");
81 if (saveButton) {

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.