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/$2?q=function&page=23&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 28757 results for "function"(627ms)

markdownBlogStarterindex.tsx3 matches

@cosmopaolo•Updated 1 day ago
5import { Layout } from "./Layout.tsx";
6
7function PostComponent({ markdown, link }: { markdown: string; link?: string }) {
8 return (
9 <div style={{ border: "1px solid gray", padding: "10px", marginBottom: "20px", borderRadius: "5px" }}>
14}
15
16export default async function(req: Request): Promise<Response> {
17 const url = new URL(req.url);
18 if (url.pathname === "/") {
44}
45
46function html(children: React.ReactNode) {
47 return new Response(
48 renderToString(
Holifant-Links

Holifant-Linksmain.tsx1 match

@tofo•Updated 1 day ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

notesjsonblob.tsx2 matches

@cosmopaolo•Updated 1 day ago
1import { blob } from "https://esm.town/v/std/blob";
2
3async function getRoom(roomName: string) {
4 try {
5 return await blob.getJSON(`room_${roomName}.json`);
9}
10
11async function saveRoom(roomName: string, data: any) {
12 await blob.setJSON(`room_${roomName}.json`, data);
13}

Glancerform.tsx2 matches

@lightweight•Updated 1 day ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function FormContent({ data, content }) {
5 // const { content, contentURL, docsURL } = config;
6 // console.log("content: ", content);
29 <h2>Cobrowse & mask fields on forms</h2>
30 <p>
31 Glance cobrowse provides a “hook” function to allow customers to
32 customize page and element masking during a cobrowse session.
33 </p>

my-first-valindex.tsx1 match

@Onujules•Updated 1 day ago
1export default function handler(req: Request): Response {
2 const html = `<!DOCTYPE html>
3 <html lang="en">

notessqlite.tsx3 matches

@cosmopaolo•Updated 1 day ago
1import { sqlite } from "https://esm.town/v/std/sqlite";
2
3async function getRoom(roomName: string) {
4 const result = await sqlite.execute(
5 "SELECT content, lastModified FROM rooms WHERE name = ?",
14}
15
16async function saveRoom(roomName: string, data: RoomData) {
17 await sqlite.execute(
18 `
24}
25
26async function initDb() {
27 await sqlite.execute(`
28 CREATE TABLE IF NOT EXISTS rooms(

Glanceriframe.tsx1 match

@lightweight•Updated 1 day ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function IframeContent({ data, content }) {
4 // const { content, contentURL, docsURL } = config;
5 // console.log("content: ", content);
Gardenon

Gardenonindex.html13 matches

@Llad•Updated 1 day ago
239
240 // Fetch all plants
241 async function fetchPlants() {
242 try {
243 const response = await fetch('/api/plants');
251
252 // Render plants on the map and in the list
253 function renderPlants() {
254 // Clear existing plants (but preserve placeholder)
255 gardenMap.querySelectorAll('.plant:not(.placeholder)').forEach(el => el.remove());
331
332 // Create a placeholder plant on the map
333 function createPlaceholderPlant(x, y) {
334 // Remove existing placeholder if any
335 removePlaceholderPlant();
364
365 // Remove placeholder plant from the map
366 function removePlaceholderPlant() {
367 if (placeholderPlant && placeholderPlant.element) {
368 placeholderPlant.element.remove();
372
373 // Select a plant to edit
374 function selectPlant(plant) {
375 // Cancel move mode if active
376 if (isMovingPlant) {
405
406 // Clear the form
407 function clearForm() {
408 // Remove placeholder plant if it exists
409 removePlaceholderPlant();
431
432 // Start move mode
433 function startMoveMode() {
434 if (!selectedPlant) {
435 alert('Please select a plant to move.');
445
446 // Cancel move mode
447 function cancelMoveMode() {
448 isMovingPlant = false;
449 mapInstructions.textContent = 'Tap anywhere on the map to add a plant';
454
455 // Move plant to new position
456 function movePlantTo(x, y) {
457 if (!selectedPlant) return;
458
478
479 // Add a new plant at the clicked position
480 function addPlantAt(x, y) {
481 // Cancel move mode if active
482 if (isMovingPlant) {
504
505 // Save plant data
506 async function savePlant(plantData) {
507 try {
508 let response;
543
544 // Update placeholder plant when diameter changes
545 function updatePlaceholderPlant() {
546 if (placeholderPlant && placeholderPlant.element) {
547 const newDiameter = parseFloat(plantDiameterInput.value) || 50;
553
554 // Delete a plant
555 async function deletePlant(id) {
556 if (!confirm('Are you sure you want to delete this plant?')) {
557 return;

fotmobexport.ts5 matches

@cemugur70•Updated 1 day ago
10}
11
12export function createFullExcelData(data: ExportData): any[][] {
13 const { rankings, formatDetected, selectedWeek } = data;
14
79}
80
81export function createIddaaOnlyExcelData(data: ExportData): any[][] {
82 const { rankings } = data;
83
137}
138
139export function createPoissonOnlyExcelData(data: ExportData): any[][] {
140 const { rankings } = data;
141
191}
192
193export function createAccuracyReportExcelData(data: ExportData): any[][] {
194 const { accuracyStats, allWeeksData } = data;
195
219}
220
221export function createMultiWeekExcelData(data: ExportData): { [sheetName: string]: any[][] } {
222 const { allWeeksData, formatDetected } = data;
223 const sheets: { [sheetName: string]: any[][] } = {};

fotmobindex.html13 matches

@cemugur70•Updated 1 day ago
441 let currentWeek = 6;
442
443 async function processFile() {
444 const fileInput = document.getElementById('fileInput');
445 const file = fileInput.files[0];
510 }
511
512 function createWeekSelector() {
513 const weekButtons = document.getElementById('weekButtons');
514 weekButtons.innerHTML = '';
552 }
553
554 async function analyzeWeek(selectedWeek) {
555 currentWeek = selectedWeek;
556
585 }
586
587 function displayResults(rankings, week) {
588 const tbody = document.getElementById('rankingsBody');
589 tbody.innerHTML = '';
648 }
649
650 function updateAccuracyStats() {
651 if (!analysisData || !analysisData.accuracyStats) return;
652
665 }
666
667 async function exportToExcel() {
668 if (!analysisData) {
669 showStatus('Önce analiz yapılmalı!', 'error');
692 }
693
694 async function exportIddaaOnly() {
695 if (!analysisData) {
696 showStatus('Önce analiz yapılmalı!', 'error');
719 }
720
721 async function exportPoissonOnly() {
722 if (!analysisData) {
723 showStatus('Önce analiz yapılmalı!', 'error');
746 }
747
748 async function testBettingAccuracy() {
749 if (!analysisData) {
750 showStatus('Önce analiz yapılmalı!', 'error');
780 }
781
782 function downloadExcel(data, filename, sheetName = 'Sheet1') {
783 // Create workbook and worksheet
784 const wb = XLSX.utils.book_new();
806 }
807
808 function downloadMultiSheetExcel(sheetsData, filename) {
809 // Create workbook
810 const wb = XLSX.utils.book_new();
838 }
839
840 function updateProgress(percentage, text) {
841 document.getElementById('progressFill').style.width = percentage + '%';
842 document.getElementById('statusText').textContent = text;
843 }
844
845 function showStatus(message, type = 'info') {
846 const statusDiv = document.getElementById('statusText');
847 statusDiv.textContent = message;

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.