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=1439&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 18733 results for "function"(3412ms)

wordcountermain.tsx2 matches

@yawnxyz•Updated 7 months ago
112 const twitterCount = document.getElementById('twitterCount');
113
114 function updateCounts() {
115 const encoder = new TextEncoder();
116 const utf8 = new Uint8Array(inputText.value.length * 3);
150 }
151
152 function adjustTextareaHeight() {
153 inputText.style.height = 'auto';
154 inputText.style.height = inputText.scrollHeight + 10 + 'px';

allSplatmain.tsx4 matches

@all•Updated 7 months ago
4import * as SPLAT from "https://cdn.jsdelivr.net/npm/gsplat@latest";
5
6function App() {
7 const canvasRef = useRef(null);
8 const progressDialogRef = useRef(null);
19 const controls = new SPLAT.OrbitControls(camera, canvas);
20
21 async function main() {
22 const url = "https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/bonsai/bonsai-7k-mini.splat";
23
122}
123
124function client() {
125 createRoot(document.getElementById("root")).render(<App />);
126}
128if (typeof document !== "undefined") { client(); }
129
130export default async function server(request: Request): Promise<Response> {
131 return new Response(`
132 <!DOCTYPE html>

sunnyAmberCraneREADME.md1 match

@jamisonl•Updated 7 months ago
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality

argsummain.tsx7 matches

@martinbowling•Updated 7 months ago
58 submitBtn.parentNode.insertBefore(errorContainer, submitBtn.nextSibling);
59
60 function showError(message) {
61 errorContainer.textContent = message;
62 errorContainer.classList.remove('hidden');
63 }
64
65 function hideError() {
66 errorContainer.textContent = '';
67 errorContainer.classList.add('hidden');
71 let timerInterval;
72
73 function startTimer() {
74 startTime = Date.now();
75 timerInterval = setInterval(updateTimer, 10);
76 }
77
78 function stopTimer() {
79 clearInterval(timerInterval);
80 const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
83 }
84
85 function updateTimer() {
86 const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
87 timerDisplay.textContent = elapsedTime + 's ${model}';
88 }
89
90 async function submitForm() {
91 hideError();
92 const input = inputText.value.trim();
190 }
191 }
192 function updateResultText(data, summary) {
193 // Display JSON
194 const jsonPre = document.createElement('pre');

getGoogleCalendarEventsmain.tsx2 matches

@geoffreylitt•Updated 7 months ago
4// const accountId = "apn_nphbDaP";
5
6export async function getCalendars(accountId: string) {
7 const calendarAPI = await pipeDreamGoogle("calendar", accountId);
8 const calendars = await calendarAPI.calendarList.list();
11
12// list out the events on a calendar
13export async function getEvents(accountId: string, calendarId: string) {
14 const calendar = await pipeDreamGoogle("calendar", accountId);
15

sqliteExplorerAppREADME.md1 match

@molefrog•Updated 7 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

schedulermain.tsx13 matches

@elliotbraem•Updated 7 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3export default async function server(request: Request): Promise<Response> {
4 const SCHEMA_VERSION = 15; // Increment this to create new tables
5 const KEY = "scheduler";
304 let currentCalendarEndTime = null;
305
306 function initializeDayDropdowns() {
307 const startDaySelect = document.getElementById('startDay');
308 const endDaySelect = document.getElementById('endDay');
313 }
314
315 async function loadCalendars() {
316 const response = await fetch('/calendars');
317 const calendars = await response.json();
333 }
334
335 async function createCalendar() {
336 if (!userId) {
337 alert('Please enter a name');
355
356
357 async function deleteCalendar(id) {
358 await fetch('/calendars', {
359 method: 'DELETE',
368 }
369
370 async function viewCalendar(id) {
371 currentCalendarId = id;
372 const response = await fetch('/calendars');
387 }
388
389 function createCalendarGrid() {
390 const calendar = document.getElementById('calendar');
391 calendar.innerHTML = '';
437 }
438
439 async function loadAvailability() {
440 userAvailability.clear();
441 overallAvailability = {};
460 }
461
462 async function toggleAvailability(day, time) {
463 if (!userId || !currentCalendarId) {
464 alert('Please enter your name and select a calendar first.');
491 }
492
493 function updateCalendarDisplay() {
494 for (let day = 0; day < 7; day++) {
495 for (let time = 0; time < 24 * 60; time += 30) {
516 }
517
518 function updateDebugInfo() {
519 const debugInfo = document.getElementById('debugInfo');
520 debugInfo.innerHTML = '<h3>Debug Info:</h3>';
525 }
526
527 function toggleDebugInfo() {
528 const debugInfo = document.getElementById('debugInfo');
529 const debugToggle = document.getElementById('debugToggle');
537 }
538
539 function updateDebugInfo() {
540 const debugInfo = document.getElementById('debugInfo');
541 debugInfo.innerHTML = '<h3>Debug Info:</h3>';

whatsThatAgainInHotDogsmain.tsx3 matches

@dthyresson•Updated 7 months ago
116 </table>
117 <script>
118 function calculateHotdogs() {
119 const playerName = document.getElementById('playerSelect').value;
120 fetch('/calculate?player=' + encodeURIComponent(playerName))
136 }
137
138 function highlightRow(row) {
139 // Clear previous highlights
140 const table = document.getElementById('playerInfo');
174})
175
176export default async function handler(request: Request): Promise<Response> {
177 return app.fetch(request)
178}

excaliValmain.tsx4 matches

@all•Updated 7 months ago
15};
16
17function App() {
18 const [createdValUrl, setCreatedValUrl] = useState(null);
19 const [selectedOptions, setSelectedOptions] = useState([]);
128
129const { name } = extractValInfo(import.meta.url);
130export default async function server(request: Request): Promise<Response> {
131 const excalidraw = createExcalidraw({
132 store: {
232}
233
234function client() {
235 createRoot(document.getElementById("root")).render(<App />);
236}
240}
241
242export default async function server(request: Request): Promise<Response> {
243 if (request.method === "POST" && new URL(request.url).pathname === "/create-val") {
244 const { code, name } = await request.json();

excaliValmain.tsx4 matches

@stevekrouse•Updated 7 months ago
15};
16
17function App() {
18 const [createdValUrl, setCreatedValUrl] = useState(null);
19 const [selectedOptions, setSelectedOptions] = useState([]);
128
129const { name } = extractValInfo(import.meta.url);
130export default async function server(request: Request): Promise<Response> {
131 const excalidraw = createExcalidraw({
132 store: {
232}
233
234function client() {
235 createRoot(document.getElementById("root")).render(<App />);
236}
240}
241
242export default async function server(request: Request): Promise<Response> {
243 if (request.method === "POST" && new URL(request.url).pathname === "/create-val") {
244 const { code, name } = await request.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": "*",