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/$%7Bsuccess?q=function&page=5&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 31553 results for "function"(2724ms)

basic_siteREADME.md1 match

@Koolala•Updated 18 hours ago
6import { serveDir } from "https://deno.land/std@0.224.0/http/file_server.ts";
7
8export default function httpHandler(req: Request): Promise<Response> {
9 return serveDir(req, {
10 fsRoot: "", // Serve from the current directory

stardewCloneindex.ts4 matches

@dcm31•Updated 19 hours ago
14}
15
16function App() {
17 const canvasRef = React.useRef<HTMLCanvasElement>(null);
18 const [player, setPlayer] = React.useState({ x: 200, y: 168 });
75 ctx.imageSmoothingEnabled = false;
76
77 // Drawing functions
78 const drawCharacter = (x: number, y: number, shirtColor: string, hairColor: string) => {
79 ctx.fillStyle = 'rgba(0,0,0,0.2)';
475}
476
477function client() {
478 createRoot(document.getElementById("root")!).render(<App />);
479}
483}
484
485export default async function server(request: Request): Promise<Response> {
486 if (request.method === 'POST') {
487 try {

statusstatus.tsx3 matches

@helge•Updated 20 hours ago
9const thisURL = parseProject(import.meta.url).links.self.project;
10
11function StatusRow({ rows }) {
12 return (
13 <div className="w-full flex flex-col space-y-2">
31}
32
33function StatusSection({ url, rows }) {
34 const sectionRows = rows.filter(row => row[0] === url);
35 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
56}
57
58export default async function(req: Request): Promise<Response> {
59 const { rows } = await sqlite.execute(
60 "select url, ok, duration, timestamp from uptime order by timestamp asc limit 200",

reactHonoStarterkkApp.tsx1 match

@tengis•Updated 20 hours ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (

reactHonoStarteApp.tsx1 match

@tengis•Updated 20 hours ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (

reactHonoStarterApp.tsx1 match

@tengis•Updated 20 hours ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (

factoid-triviaGameRound.tsx1 match

@bmitchinson•Updated 20 hours ago
13}
14
15export function GameRoundComponent({
16 round,
17 users,

factoid-triviaindex.ts2 matches

@bmitchinson•Updated 20 hours ago
38setInterval(cleanupInactiveUsers, 60000); // Every minute
39
40// Helper function to determine game status
41async function getGameState(): Promise<GameState> {
42 const users = await getActiveUsers();
43 const currentRound = await getCurrentRound();

baseballindex.ts7 matches

@bmitchinson•Updated 21 hours ago
1export default async function(req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html lang="en">
230 }
231
232 function addPlayer() {
233 playerCount++;
234 const tbody = document.getElementById('scorecard-body');
253 }
254
255 function toggleCell(cell) {
256 if (cell.classList.contains('hit')) {
257 cell.classList.remove('hit');
268 }
269
270 function updateTotals() {
271 const rows = document.querySelectorAll('#scorecard-body tr');
272 let totalRuns = 0;
305 }
306
307 function clearScorecard() {
308 if (confirm('Are you sure you want to clear the entire scorecard?')) {
309 const cells = document.querySelectorAll('.scorecard-cell');
316 }
317
318 function printScorecard() {
319 window.print();
320 }
322 // Add some Cubs spirit with occasional cheers
323 let cheerCount = 0;
324 document.addEventListener('click', function() {
325 cheerCount++;
326 if (cheerCount % 20 === 0) {

baseballindex.html6 matches

@bmitchinson•Updated 21 hours ago
177 }
178
179 function addPlayer() {
180 playerCount++;
181 const tbody = document.getElementById('scorecard-body');
199 }
200
201 function toggleCell(cell) {
202 if (cell.classList.contains('hit')) {
203 cell.classList.remove('hit');
214 }
215
216 function updateTotals() {
217 const rows = document.querySelectorAll('#scorecard-body tr');
218 let totalRuns = 0;
251 }
252
253 function clearScorecard() {
254 if (confirm('Are you sure you want to clear the entire scorecard?')) {
255 const cells = document.querySelectorAll('.scorecard-cell');
262 }
263
264 function printScorecard() {
265 window.print();
266 }
268 // Add some Cubs spirit with occasional cheers
269 let cheerCount = 0;
270 document.addEventListener('click', function() {
271 cheerCount++;
272 if (cheerCount % 20 === 0) {
tuna

tuna9 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

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