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=1408&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 23926 results for "function"(2084ms)

reactHonoExample_toowiredApp.tsx1 match

@toowired•Updated 2 months ago
8}
9
10export function App() {
11 const [messages, setMessages] = useState<Message[]>([]);
12 const [isLoading, setIsLoading] = useState(false);

linkInBioTemplatemain.tsx3 matches

@Blakekug13•Updated 2 months ago
25];
26
27function App() {
28 const [activeTab, setActiveTab] = useState("games");
29 const [selectedWallpaper, setSelectedWallpaper] = useState("/wallpapers/4.svg");
139}
140
141function client() {
142 createRoot(document.getElementById("root")).render(<App />);
143}
145if (typeof document !== "undefined") { client(); }
146
147export default async function server(request: Request): Promise<Response> {
148 return new Response(`
149 <html>

poorvis885main.tsx6 matches

@poorvis885•Updated 2 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function WeatherDashboard() {
6 const [location, setLocation] = useState({ latitude: 40.7128, longitude: -74.0060, name: 'New York City' });
7 const [weatherData, setWeatherData] = useState(null);
11
12 // Generate random light color scheme for dynamic visual appeal
13 function getRandomColorScheme() {
14 const colorSchemes = [
15 {
42
43 useEffect(() => {
44 async function fetchWeatherAndAI() {
45 try {
46 setLoading(true);
181}
182
183function LocationSearch({ onLocationChange, accentColor, textColor }) {
184 const [input, setInput] = useState('');
185 const [error, setError] = useState('');
234}
235
236function client() {
237 createRoot(document.getElementById("root")).render(<WeatherDashboard />);
238}
239if (typeof document !== "undefined") { client(); }
240
241export default async function server(request: Request): Promise<Response> {
242 return new Response(`
243 <html>

weatherDashboardmain.tsx6 matches

@poorvis885•Updated 2 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function WeatherDashboard() {
6 const [location, setLocation] = useState({ latitude: 40.7128, longitude: -74.0060, name: 'New York City' });
7 const [weatherData, setWeatherData] = useState(null);
11
12 // Generate random light color scheme for dynamic visual appeal
13 function getRandomColorScheme() {
14 const colorSchemes = [
15 {
42
43 useEffect(() => {
44 async function fetchWeatherAndAI() {
45 try {
46 setLoading(true);
181}
182
183function LocationSearch({ onLocationChange, accentColor, textColor }) {
184 const [input, setInput] = useState('');
185 const [error, setError] = useState('');
234}
235
236function client() {
237 createRoot(document.getElementById("root")).render(<WeatherDashboard />);
238}
239if (typeof document !== "undefined") { client(); }
240
241export default async function server(request: Request): Promise<Response> {
242 return new Response(`
243 <html>

companymain.tsx1 match

@dhashnamoorthy•Updated 2 months ago
22];
23
24export default async function(e: Email) {
25 console.log(JSON.stringify(e, null, 2));
26

valentinemain.tsx3 matches

@dhashnamoorthy•Updated 2 months ago
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
98}
99
100function client() {
101 createRoot(document.getElementById("root")).render(<App />);
102}
103if (typeof document !== "undefined") { client(); }
104
105export default async function server(request: Request): Promise<Response> {
106 return new Response(
107 `

weatherDashboardmain.tsx4 matches

@dhashnamoorthy•Updated 2 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function WeatherDashboard() {
6 const [location, setLocation] = useState({ lat: 40.7128, lon: -74.0060 }); // Default to New York
7 const [weather, setWeather] = useState(null);
9
10 useEffect(() => {
11 async function fetchWeather() {
12 try {
13 const response = await fetch(
75}
76
77function client() {
78 createRoot(document.getElementById("root")).render(<WeatherDashboard />);
79}
80if (typeof document !== "undefined") { client(); }
81
82export default async function server(request: Request): Promise<Response> {
83 return new Response(
84 `

kanbanTestmain.tsx16 matches

@arfan•Updated 2 months ago
37};
38
39// Utility functions
40const utils = {
41 loadFromStorage: (key, defaultValue) => {
53
54// Main TaskBoard component
55function TaskBoard() {
56 const [taskLists, setTaskLists] = useState({
57 [config.columns.todo]: [],
76 }, []);
77
78 function loadUserPreferences() {
79 const savedDarkMode = utils.loadFromStorage(config.storage.theme, false);
80 setIsDarkMode(savedDarkMode);
91 }
92
93 function saveUserPreferences() {
94 utils.saveToStorage(config.storage.font, chosenFont);
95 utils.saveToStorage(config.storage.fontSize, fontSize);
99 }
100
101 async function fetchTasks() {
102 try {
103 const response = await fetch("/get-tasks");
109 }
110
111 async function addNewTask() {
112 if (!newTaskText.trim()) return;
113
129 }
130
131 async function handleTaskMove(result) {
132 const { destination, source, draggableId } = result;
133 if (!destination) return;
150 }
151
152 async function removeTask(taskId, column) {
153 try {
154 const response = await fetch("/delete-task", {
164 }
165
166 async function moveTaskForward(task, currentColumn) {
167 const currentIndex = listProgression.indexOf(currentColumn);
168 const nextColumn = listProgression[currentIndex + 1];
185 }
186
187 function toggleDarkMode() {
188 const newDarkMode = !isDarkMode;
189 setIsDarkMode(newDarkMode);
192 }
193
194 function openEditModal(task) {
195 setTaskBeingEdited(task);
196 setEditedTaskText(task.title);
198 }
199
200 async function saveEditedTask() {
201 if (!editedTaskText.trim() || !taskBeingEdited) return;
202 try {
218 }
219
220 function handleTaskInteraction(e, task, column) {
221 if (e.button === 1) {
222 e.preventDefault();
455}
456
457export default async function server(request: Request): Promise<Response> {
458 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
459 const tableName = config.database.getTableName();
531 const TaskBoard = ${TaskBoard.toString()};
532
533 function client() {
534 const root = document.getElementById("root");
535 if (root) {
549}
550
551async function getAllTasks(sqlite, tableName) {
552 const columns = Object.values(config.columns);
553 const tasks = await Promise.all(

todoAppmain.tsx8 matches

@arfan•Updated 2 months ago
33}
34
35// Utility functions
36const storage = {
37 get: (key: string) => JSON.parse(localStorage.getItem(key) || "null"),
71
72// Components
73function AddTodoForm({ onAdd }: { onAdd: (text: string) => void }) {
74 const [text, setText] = useState("");
75
96}
97
98function TodoItem(
99 { todo, onEdit, onDelete, visibleFields }: {
100 todo: Todo;
133}
134
135function EditOverlay({ todo, onSave, onCancel }: { todo: Todo; onSave: (todo: Todo) => void; onCancel: () => void }) {
136 const [editedTodo, setEditedTodo] = useState(todo);
137
181}
182
183function SettingsOverlay(
184 { visibleFields, onToggle, onClose }: {
185 visibleFields: VisibleFields;
211}
212
213function TodoApp(): JSX.Element {
214 const [todos, setTodos] = useState<Todo[]>([]);
215 const [isDarkMode, setIsDarkMode] = useState(false);
357}
358
359function mountClient() {
360 const rootElement = document.getElementById("root");
361 if (rootElement) {
368}
369
370export default async function server(request: Request): Promise<Response> {
371 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
372 const dbName = config.dbName();

WebGLTestmain.tsx1 match

@stwind•Updated 2 months ago
1export async function WebGLTest(request: Request): Promise<Response> {
2 const vs = `#version 300 es
3precision highp float;

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.