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=1385&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 18949 results for "function"(1936ms)

curiousMoccasinWeaselmain.tsx3 matches

@all•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [step, setStep] = useState(0);
7 const [isPlaying, setIsPlaying] = useState(false);
120}
121
122function client() {
123 createRoot(document.getElementById("root")).render(<App />);
124}
128}
129
130export default async function server(request: Request): Promise<Response> {
131 return new Response(`
132 <html>

diacomDemomain.tsx4 matches

@vawogbemi•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [imageId, setImageId] = useState(null);
7 const [file, setFile] = useState(null);
12 let cornerstone, cornerstoneWADOImageLoader, dicomParser;
13
14 async function loadLibraries() {
15 cornerstone = (await import("https://esm.sh/cornerstone-core")).default;
16 cornerstoneWADOImageLoader = (await import("https://esm.sh/cornerstone-wado-image-loader")).default;
80}
81
82function client() {
83 createRoot(document.getElementById("root")).render(<App />);
84}
86if (typeof document !== "undefined") { client(); }
87
88export default async function server(request: Request): Promise<Response> {
89 return new Response(`
90 <html>

cheerfulTanDeermain.tsx1 match

@alexab123•Updated 6 months ago
7
8// Fetches a random joke.
9async function fetchRandomJoke() {
10 const response = await fetch(
11 "https://official-joke-api.appspot.com/random_joke",

bricklesGamemain.tsx10 matches

@jamiedubs•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const canvasRef = useRef(null);
7 const [score, setScore] = useState(0);
36 document.addEventListener('keyup', (e) => keys[e.key] = false);
37
38 function drawBall() {
39 ctx.beginPath();
40 ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2);
44 }
45
46 function drawPaddle() {
47 ctx.beginPath();
48 ctx.rect(paddle.x, paddle.y, paddle.width, paddle.height);
52 }
53
54 function drawBricks() {
55 for (let c = 0; c < brickColumnCount; c++) {
56 for (let r = 0; r < brickRowCount; r++) {
70 }
71
72 function drawParticles() {
73 particles.forEach((particle, index) => {
74 particle.life--;
87 }
88
89 function createParticles(x, y) {
90 for (let i = 0; i < 10; i++) {
91 particles.push({
100 }
101
102 function collisionDetection() {
103 for (let c = 0; c < brickColumnCount; c++) {
104 for (let r = 0; r < brickRowCount; r++) {
118 }
119
120 function draw() {
121 ctx.clearRect(0, 0, canvas.width, canvas.height);
122 drawBricks();
187}
188
189function client() {
190 createRoot(document.getElementById("root")).render(<App />);
191}
192if (typeof document !== "undefined") { client(); }
193
194export default async function server(request: Request): Promise<Response> {
195 return new Response(`
196 <html>

StripeDemomain.tsx4 matches

@vawogbemi•Updated 6 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [tipAmount, setTipAmount] = useState(5);
8 const paymentLinks = {
63}
64
65function Success() {
66 useEffect(() => {
67 confetti({
81}
82
83function client() {
84 const root = document.getElementById("root");
85 if (root) {
94if (typeof document !== "undefined") { client(); }
95
96export default async function server(request: Request): Promise<Response> {
97 const url = new URL(request.url);
98

handleDiscordNewUsermain.tsx1 match

@stevekrouse•Updated 6 months ago
3// # New Val Town User (on Clerk) -> Val Town Discord notification
4// Translates one kind of webhook (Clerk) into another (Discord)
5export async function handleDiscordNewUser(req: Request): Promise<Response> {
6 // check custom auth secret sent from clerk
7 if (req.headers.get("auth") !== Deno.env.get("clerkNonSensitive"))

industriousEmeraldWhippetmain.tsx1 match

@sheepish•Updated 6 months ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

jokeGeneratorValmain.tsx1 match

@naomizhang•Updated 6 months ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

harmoniousBlackStoatmain.tsx1 match

@eddietheegg2•Updated 6 months ago
2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 const response = fetch(
6 "https://official-joke-api.appspot.com/random_joke",

labLoginUpdateStatusmain.tsx1 match

@gaimeri17•Updated 6 months ago
3import { sqlite } from "https://esm.town/v/std/sqlite";
4
5export default async function(req: Request): Promise<Response> {
6 const TABLE_NAME = "lab_login_users_with_times";
7 const body = await req.json();

getFileEmail4 file matches

@shouser•Updated 2 weeks 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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",