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=83&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 20414 results for "function"(1543ms)

worldclockserver.js1 match

@evilmathwalnutsโ€ขUpdated 2 days ago
1import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";
2
3export default async function(req) {
4 const url = new URL(req.url);
5 const path = url.pathname;

spreadchatapp.js6 matches

@twitchardโ€ขUpdated 2 days ago
29 * Initialize the x-spreadsheet instance
30 */
31function initializeSpreadsheet() {
32 // Create spreadsheet with options
33 const spreadsheet = new window.xspreadsheet('#spreadsheet', {
103 * Set up all event listeners for the application
104 */
105function setupEventListeners(spreadsheet) {
106 // Cell selection event
107 spreadsheet.on('cell-selected', (cell, ri, ci) => {
171 * Update the selected cell information display
172 */
173function updateSelectedCellInfo(spreadsheet, cell, ri, ci) {
174 // Get cell reference (e.g., A1, B2)
175 const colLabel = String.fromCharCode(65 + ci); // A, B, C, ...
212 * This allows parent pages to listen for cell selection
213 */
214function emitCellSelectionEvent(cellRef, cellData) {
215 const event = new CustomEvent('val-spreadsheet-cell-selected', {
216 detail: {
231 * This allows external code to interact with the spreadsheet
232 */
233function exposeSpreadsheetAPI(spreadsheet) {
234 // Create API object
235 window.valSpreadsheet = {
274 * Parse cell reference (e.g., A1, B2) into column and row indices
275 */
276function parseCellReference(cellRef) {
277 const match = cellRef.match(/^([A-Z]+)(\d+)$/);
278 if (!match) return [null, null];

spreadchatsheets-import.ts4 matches

@twitchardโ€ขUpdated 2 days ago
1// This file would contain the actual Google Sheets import functionality
2// For a complete implementation, we would need to:
3// 1. Use the Google Sheets API to fetch sheet data
8// using the Google Sheets API and SheetJS for data conversion
9
10export async function importFromGoogleSheets(sheetUrl: string) {
11 try {
12 // Extract the sheet ID from the URL
51}
52
53// Helper function to extract sheet ID from Google Sheets URL
54function extractSheetId(url: string): string | null {
55 try {
56 // Google Sheets URLs are typically in the format:

spreadchatREADME.md4 matches

@twitchardโ€ขUpdated 2 days ago
3A fully featured spreadsheet application built for Val Town with the following capabilities:
4
5- Full spreadsheet functionality (cells, formulas, editing)
6- Events that emit selected cells and their data to the wider page
7- Import functionality from Google Sheets
8
9## Project Structure
12โ”œโ”€โ”€ backend/
13โ”‚ โ”œโ”€โ”€ index.ts # Main HTTP entry point
14โ”‚ โ””โ”€โ”€ sheets-import.ts # Google Sheets import functionality
15โ”œโ”€โ”€ frontend/
16โ”‚ โ”œโ”€โ”€ index.html # Main HTML template
31This project uses:
32- [x-spreadsheet](https://github.com/myliang/x-spreadsheet) for the spreadsheet UI
33- [SheetJS](https://sheetjs.com/) for Google Sheets import functionality
34- Custom event handling to expose spreadsheet state to the parent page

worldclockserver-backup.js1 match

@evilmathwalnutsโ€ขUpdated 2 days ago
1import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";
2
3export default async function(req) {
4 const url = new URL(req.url);
5 const path = url.pathname;

worldclockREADME.md1 match

@evilmathwalnutsโ€ขUpdated 2 days ago
24
25- `index.html` - Main HTML file with the clock display and timezone selector
26- `script.js` - JavaScript to handle the clock functionality and timezone selection
27- `style.css` - Additional CSS styles beyond Tailwind
28- `server.js` - Server-side code to handle HTTP requests and serve the static files

worldclockMAP-FEATURE-README.md3 matches

@evilmathwalnutsโ€ขUpdated 2 days ago
8- Visual representation of the current timezone location
9- Responsive design that works on both mobile and desktop
10- Feature flag to enable/disable the map functionality
11
12## Implementation Details
20
21- `index-with-map.html` - HTML file with map component added
22- `script-with-map.js` - JavaScript file with map functionality
23- `server-with-map.js` - Updated server file with feature flag support
24
44- Add day/night visualization overlay
45- Allow clicking on the map to select the nearest timezone
46- Add search functionality for locations

worldclockscript-with-map.js5 matches

@evilmathwalnutsโ€ขUpdated 2 days ago
10
11 // Initialize the map
12 function initMap() {
13 // Create the map with a default view
14 map = L.map('map').setView([0, 0], 2);
21
22 // Prevent scrolling the page when scrolling the map
23 map.getContainer().addEventListener('wheel', function(e) {
24 e.stopPropagation();
25 });
84
85 // Update the map based on selected timezone
86 function updateMap(timezone) {
87 if (!map) return;
88
205
206 // Populate timezone dropdown with optgroups
207 function populateTimezoneSelect() {
208 // Clear existing options
209 timezoneSelect.innerHTML = '';
245
246 // Update the clock display
247 function updateClock() {
248 const selectedTimezone = timezoneSelect.value;
249 const now = new Date();

UnescapeJsonindex.js2 matches

@wolfโ€ขUpdated 2 days ago
13 * Handles common escape sequences without requiring JSON validity
14 */
15 function unescapeString(str) {
16 return str
17 .replace(/\\n/g, '\n') // newline
29 }
30
31 function updateOutput() {
32 // Get input and unescape it
33 const input = inputArea.value;

UnescapeJsonutils.ts1 match

@wolfโ€ขUpdated 2 days ago
1/**
2 * Shared utility functions and types for the Escape Sequence Visualizer
3 */
4

getFileEmail4 file matches

@shouserโ€ขUpdated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkโ€ขUpdated 3 weeks 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.