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=36&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 24514 results for "function"(931ms)

Interfacemigrations.ts1 match

@izake_aaâ€ĸUpdated 1 day ago
3const TABLE_NAME = 'fueling_station_expenses_v1';
4
5export async function createTables() {
6 await sqlite.execute(`
7 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (

untitled-4435main.tsx17 matches

@Cfvvvvvâ€ĸUpdated 1 day ago
165
166// āύāϤ⧁āύ NoInternetPage āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ (āϏāĻ‚āĻœā§āĻžāĻž āϰāĻžāĻ–āĻž āĻšāϝāĻŧ⧇āϛ⧇, āĻ•āĻŋāĻ¨ā§āϤ⧁ DashboardPage āĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āĻšāĻšā§āϛ⧇ āύāĻž)
167function NoInternetPage() {
168 return (
169 <div className="no-internet-container">
181}
182
183function Slideshow({ images }) {
184 useEffect(() => {
185 let currentSlideIndex = 0;
189 const transitionDuration = 800; // 0.8 seconds (must match CSS)
190
191 function showNextSlide() {
192 if (totalSlides <= 1) return;
193
242}
243
244function Card({ title, subtitle, amount, steps, footerSlides, buttonText, modalTitle, modalContent }) {
245 const [isModalActive, setIsModalActive] = useState(false);
246
255 let footerSlideInterval = null;
256
257 function showNextFooterSlide() {
258 const slides = cardSpecificFooterSlideContainer.querySelectorAll(".footer-slide");
259 if (slides.length <= 1) return;
359}
360
361function Modal({ isActive, onClose, title, content }) {
362 if (!isActive) return null;
363
378}
379
380function InviteCard() {
381 return (
382 <div className="card invite-card">
400}
401
402function BottomNavigation() { // Removed isBlurred prop
403 return (
404 <nav className="bottom-nav">
420
421// LoadingOverlay āϏāĻ‚āĻœā§āĻžāĻž āϰāĻžāĻ–āĻž āĻšāϝāĻŧ⧇āϛ⧇, āĻ•āĻŋāĻ¨ā§āϤ⧁ DashboardPage āĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āĻšāĻšā§āϛ⧇ āύāĻž
422function LoadingOverlay() {
423 const [loadingText, setLoadingText] = useState("Loading...");
424 const [isClickable, setIsClickable] = useState(true);
813
814// āύāϤ⧁āύ MessageUsersPage āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ
815function MessageUsersPage({ onBack }) {
816 const [users, setUsers] = useState([]);
817 const [loading, setLoading] = useState(true);
908}
909
910function DashboardPage({ onShowMessageUsers }) {
911 const [balance, setBalance] = useState(null);
912
1069 console.log("Telegram environment detected. Setting up auto-close timer for 3 seconds.");
1070 telegramCloseTimerId = setTimeout(() => {
1071 if (window.Telegram && window.Telegram.WebApp && typeof window.Telegram.WebApp.close === "function") {
1072 console.log("Closing Telegram WebApp now.");
1073 window.Telegram.WebApp.close();
1074 } else {
1075 console.warn("Telegram WebApp close function not available or WebApp object disappeared.");
1076 }
1077 }, 3000); // ā§§.ā§Ģ āϏ⧇āϕ⧇āĻ¨ā§āĻĄā§‡āϰ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤ⧇ ā§Š āϏ⧇āϕ⧇āĻ¨ā§āĻĄ
1200}
1201
1202function LoginPage({ setShowDashboard }) {
1203 const [formData, handleChange, setFormData] = useForm({ loginType: "email", email: "", phone: "", password: "" });
1204 const [error, setError] = useState("");
1388}
1389
1390function App() {
1391 const [showDashboard, setShowDashboard] = useState(false);
1392 const [showMessageUsers, setShowMessageUsers] = useState(false);
1399}
1400
1401function client() {
1402 createRoot(document.getElementById("root")).render(<App />);
1403}
1407}
1408
1409export default async function server(request: Request): Promise<Response> {
1410 const url = new URL(request.url);
1411

ChatApp.tsx1 match

@c15râ€ĸUpdated 1 day ago
41];
42
43export default function App() {
44 const [config, setConfig] = useState<AppConfig>({
45 anthropicApiKey: "",

KidsGameindex.ts1 match

@izake_aaâ€ĸUpdated 1 day ago
1import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 const path = url.pathname;

untitled-6400main.tsx27 matches

@wahobdâ€ĸUpdated 1 day ago
165
166// āύāϤ⧁āύ NoInternetPage āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ (āϏāĻ‚āĻœā§āĻžāĻž āϰāĻžāĻ–āĻž āĻšāϝāĻŧ⧇āϛ⧇, āĻ•āĻŋāĻ¨ā§āϤ⧁ DashboardPage āĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āĻšāĻšā§āϛ⧇ āύāĻž)
167function NoInternetPage() {
168 return (
169 <div className="no-internet-container">
181}
182
183function Slideshow({ images }) {
184 useEffect(() => {
185 let currentSlideIndex = 0;
189 const transitionDuration = 800; // 0.8 seconds (must match CSS)
190
191 function showNextSlide() {
192 if (totalSlides <= 1) return;
193
242}
243
244function Card({ title, subtitle, amount, steps, footerSlides, buttonText, modalTitle, modalContent }) {
245 const [isModalActive, setIsModalActive] = useState(false);
246
255 let footerSlideInterval = null;
256
257 function showNextFooterSlide() {
258 const slides = cardSpecificFooterSlideContainer.querySelectorAll(".footer-slide");
259 if (slides.length <= 1) return;
359}
360
361function Modal({ isActive, onClose, title, content }) {
362 if (!isActive) return null;
363
378}
379
380function InviteCard() {
381 return (
382 <div className="card invite-card">
400}
401
402function BottomNavigation() { // Removed isBlurred prop
403 return (
404 <nav className="bottom-nav">
420
421// LoadingOverlay āϏāĻ‚āĻœā§āĻžāĻž āϰāĻžāĻ–āĻž āĻšāϝāĻŧ⧇āϛ⧇, āĻ•āĻŋāĻ¨ā§āϤ⧁ DashboardPage āĻ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āĻšāĻšā§āϛ⧇ āύāĻž
422function LoadingOverlay() {
423 const [loadingText, setLoadingText] = useState("Loading...");
424 const [isClickable, setIsClickable] = useState(true);
597}
598
599function DashboardPage() {
600 const [balance, setBalance] = useState(null);
601
750 console.log("Telegram environment detected. Setting up auto-close timer for 3 seconds.");
751 telegramCloseTimerId = setTimeout(() => {
752 if (window.Telegram && window.Telegram.WebApp && typeof window.Telegram.WebApp.close === "function") {
753 console.log("Closing Telegram WebApp now.");
754 window.Telegram.WebApp.close();
755 } else {
756 console.warn("Telegram WebApp close function not available or WebApp object disappeared.");
757 }
758 }, 3000); // ā§§.ā§Ģ āϏ⧇āϕ⧇āĻ¨ā§āĻĄā§‡āϰ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤ⧇ ā§Š āϏ⧇āϕ⧇āĻ¨ā§āĻĄ
885}
886
887function LoginPage({ setShowDashboard }) {
888 const [formData, handleChange, setFormData] = useForm({ loginType: "email", email: "", phone: "", password: "" });
889 const [error, setError] = useState("");
1073}
1074
1075function App() {
1076 const [showDashboard, setShowDashboard] = useState(false);
1077
1079}
1080
1081function client() {
1082 createRoot(document.getElementById("root")).render(<App />);
1083}
1087}
1088
1089// Telegram Bot Rate Limiting Functions
1090const BOT_TOKEN = Deno.env.get("TELEGRAM_BOT_TOKEN");
1091
1100}
1101
1102// Helper function to check if it's a new day
1103function isNewDay(lastReset: string): boolean {
1104 const lastResetDate = new Date(lastReset);
1105 const today = new Date();
1112}
1113
1114// Helper function to check if user is currently blocked
1115function isUserBlocked(userData: UserMessageCount): boolean {
1116 if (!userData.blockedUntil) return false;
1117
1122}
1123
1124// Helper function to send message to Telegram
1125async function sendTelegramMessage(chatId: string, text: string, parseMode: string = "HTML") {
1126 if (!BOT_TOKEN) {
1127 console.error("TELEGRAM_BOT_TOKEN not found");
1151}
1152
1153// Main function to handle incoming Telegram messages
1154async function handleTelegramMessage(chatId: string, userId: string, messageText: string) {
1155 try {
1156 const { blob } = await import("https://esm.town/v/std/blob");
1225}
1226
1227// Function to process user message (customize this based on your bot's functionality)
1228async function processTelegramUserMessage(chatId: string, userId: string, messageText: string, dailyCount: number) {
1229 // Example responses - customize based on your bot's purpose
1230 let response = "";
1244}
1245
1246export default async function server(request: Request): Promise<Response> {
1247 const url = new URL(request.url);
1248

untitled-6400dashboard.tsx3 matches

@wahobdâ€ĸUpdated 1 day ago
22}
23
24function Dashboard() {
25 const [users, setUsers] = useState<UserInfo[]>([]);
26 const [loading, setLoading] = useState(true);
207}
208
209function client() {
210 createRoot(document.getElementById("root")!).render(<Dashboard />);
211}
215}
216
217export default async function server(request: Request): Promise<Response> {
218 const url = new URL(request.url);
219

untitled-6400telegram-bot.ts11 matches

@wahobdâ€ĸUpdated 1 day ago
13}
14
15// Helper function to check if it's a new day
16function isNewDay(lastReset: string): boolean {
17 const lastResetDate = new Date(lastReset);
18 const today = new Date();
25}
26
27// Helper function to check if user is currently blocked
28function isUserBlocked(userData: UserMessageCount): boolean {
29 if (!userData.blockedUntil) return false;
30
35}
36
37// Helper function to send message to Telegram
38async function sendTelegramMessage(chatId: string, text: string, parseMode: string = "HTML") {
39 const url = `https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`;
40
59}
60
61// Main function to handle incoming messages
62async function handleMessage(chatId: string, userId: string, messageText: string) {
63 try {
64 // Get user message data from blob storage
131}
132
133// Function to process user message (customize this based on your bot's functionality)
134async function processUserMessage(chatId: string, userId: string, messageText: string, dailyCount: number) {
135 // Example responses - customize based on your bot's purpose
136 let response = "";
151
152// Main webhook handler
153export default async function(request: Request): Promise<Response> {
154 if (request.method !== "POST") {
155 return new Response("Method not allowed", { status: 405 });

FarcasterGalleryApp.tsx4 matches

@moeâ€ĸUpdated 1 day ago
12import { useQuery } from "./util/useQuery.ts";
13
14export function App() {
15 const [context, setContext] = useState<any>();
16
31}
32
33function Home({ context }) {
34 const channelId = [
35 "photography",
75}
76
77function User({ context }) {
78 let { username } = useParams();
79 const { data: user } = useQuery(["user", username], () => fetchUser(username));
98}
99
100function Channel({ context }) {
101 let { channelId } = useParams();
102 const { data: channel } = useQuery(["channel", channelId], () => fetchChannel(channelId));

new-landing-pageindex.html2 matches

@charmaineâ€ĸUpdated 1 day ago
112 </div>
113 <div class="code-line">
114 <span class="keyword">export</span> <span class="keyword">default</span> <span class="keyword">async</span> <span class="keyword">function</span><span class="punctuation">(</span><span class="variable">req</span><span class="punctuation">)</span> <span class="punctuation">{</span>
115 </div>
116 <div class="code-line">
117 &nbsp;&nbsp;<span class="keyword">return</span> <span class="keyword">new</span> <span class="function">Response</span><span class="punctuation">(</span><span class="string">"Hello Y2K World!"</span><span class="punctuation">);</span>
118 </div>
119 <div class="code-line">

new-landing-pagescript.js15 matches

@charmaineâ€ĸUpdated 1 day ago
1// Y2K Val Town Interactive Elements
2
3document.addEventListener('DOMContentLoaded', function() {
4 // Y2K Counter - Days since January 1, 2000
5 function updateY2KCounter() {
6 const y2k = new Date('2000-01-01');
7 const now = new Date();
16 }
17
18 function animateCounter(element, targetValue) {
19 let currentValue = 0;
20 const increment = Math.ceil(targetValue / 50);
30
31 // Matrix rain effect enhancement
32 function createMatrixRain() {
33 const matrixContainer = document.querySelector('.matrix-rain');
34 if (!matrixContainer) return;
51
52 // Glitch effect for navigation links
53 function addGlitchEffect() {
54 const navLinks = document.querySelectorAll('.nav-link');
55 navLinks.forEach(link => {
56 link.addEventListener('mouseenter', function() {
57 this.style.animation = 'glitch-1 0.3s ease-in-out';
58 setTimeout(() => {
64
65 // Retro sound effects (using Web Audio API)
66 function createRetroSounds() {
67 const audioContext = new (window.AudioContext || window.webkitAudioContext)();
68
69 function playBeep(frequency = 800, duration = 100) {
70 const oscillator = audioContext.createOscillator();
71 const gainNode = audioContext.createGain();
102
103 // Konami Code Easter Egg
104 function setupKonamiCode() {
105 const konamiCode = [
106 'ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown',
110 let userInput = [];
111
112 document.addEventListener('keydown', function(e) {
113 userInput.push(e.code);
114
125 }
126
127 function activateY2KMode() {
128 // Create a special Y2K celebration
129 const celebration = document.createElement('div');
163 }
164
165 function createSparkle() {
166 const sparkle = document.createElement('div');
167 sparkle.style.position = 'fixed';
200
201 // Retro cursor trail effect
202 function createCursorTrail() {
203 const trail = [];
204 const trailLength = 10;
205
206 document.addEventListener('mousemove', function(e) {
207 trail.push({ x: e.clientX, y: e.clientY, time: Date.now() });
208
262
263 // Try to create retro sounds (will fail silently if user hasn't interacted)
264 document.addEventListener('click', function() {
265 try {
266 createRetroSounds();

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.