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=43&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 22846 results for "function"(1347ms)

screenScoreKeeper.tsx1 match

@max123Updated 2 days ago
14}
15
16export default function ScoreKeeper({
17 game,
18 onAddPoint,

petitionmain.tsx15 matches

@creativevoicesspeakingUpdated 2 days ago
16const ADMIN_PASSWORD = Deno.env.get("ADMIN_KEY") || "defaultkey123";
17
18export default async function(req: Request): Promise<Response> {
19 const url = new URL(req.url);
20
272
273 <script type="text/javascript">
274 // Form validation function to check if captcha is completed
275 function validateForm(event) {
276 // Get the captcha response
277 var captchaResponse = grecaptcha.getResponse();
491}
492
493// Helper function for common styles
494function getCommonStyles() {
495 return `
496 <style>
638}
639
640// Helper function to create error pages
641function createErrorPage(message, details = "") {
642 return new Response(
643 `
676
677// Admin page handler
678async function handleAdminPage(req: Request): Promise<Response> {
679 if (req.method === "GET") {
680 return new Response(
814}
815
816// Helper function for admin styles
817function getAdminStyles() {
818 return `
819 <style>
986
987// Admin delete handler
988async function handleAdminDelete(req: Request): Promise<Response> {
989 if (req.method !== "POST") {
990 return new Response("Method not allowed", { status: 405 });
1025
1026// Admin export handler
1027async function handleAdminExport(req: Request): Promise<Response> {
1028 if (req.method !== "POST") {
1029 return new Response("Method not allowed", { status: 405 });
1069
1070// Admin import handler
1071async function handleAdminImport(req: Request): Promise<Response> {
1072 const url = new URL(req.url);
1073 const password = url.searchParams.get("password");
1267}
1268
1269// Helper function to parse CSV line (handles quoted fields)
1270function parseCSVLine(line: string): string[] {
1271 const fields = [];
1272 let current = "";

screenGameBoard.tsx2 matches

@max123Updated 2 days ago
15}
16
17export default function GameBoard({
18 sites,
19 activeGames,
218}
219
220function CreateGameForm({ sites, selectedSiteId, onCreateGame, onClose, loading }: CreateGameFormProps) {
221 const [formData, setFormData] = useState({
222 siteId: selectedSiteId || (sites[0]?.id || ''),

screenApp.tsx1 match

@max123Updated 2 days ago
18}
19
20export default function App({ initialData }: AppProps) {
21 const [sites, setSites] = useState<Site[]>(initialData.sites || []);
22 const [activeGames, setActiveGames] = useState<Game[]>(initialData.activeGames || []);

FarcasterSpacesSpace.tsx14 matches

@moeUpdated 2 days ago
25// client.setClientRole("host");
26
27export function Space() {
28 return (
29 <div className="p-5 mb-8">
104}
105
106function SpaceHeader({ channel }: any) {
107 const navigate = useNavigate()
108
134}
135
136function Lobby({ channel, space, uid, setCalling, setToken }: any) {
137 // console.log("Lobby", channel);
138 const { data: creator } = useUser(space?.created_by)
181}
182
183function Room({ channel, token, uid, calling, setCalling }: any) {
184 // console.log("Room", channel, calling, setCalling);
185
279}
280
281function User({
282 uid,
283 muted,
410}
411
412function Indicator({ Icon, color }: any) {
413 return (
414 <div
419 )
420}
421function Emoji({ emoji, color }: any) {
422 return (
423 <div className={`flex items-center justify-center w-5 h-5 rounded-full bg-${color}-500 absolute bottom-0 left-0`}>
429//////////
430
431function useUser(uid: number) {
432 return useQuery({
433 queryKey: ['user', uid],
437}
438
439async function getUserByUid(uid?: number) {
440 if (!uid) return null
441 if (uid > 2_000_000) return null
443}
444
445function userImageUrl(address) {
446 if (!address) return null
447 return 'https://cdn.stamp.fyi/avatar/' + address + '?s=140'
448}
449
450function useActiveSpeakerUid({ isConnected }) {
451 const [activeSpeakerUid, setActiveSpeakerUid] = useState<any>()
452 useEffect(() => {
459}
460
461function getActiveSpeakerUid(volumes) {
462 if (!volumes || volumes.length === 0) return undefined
463 const topSpeaker = volumes?.reduce((prev, current) => (prev.level > current.level ? prev : current))
467}
468
469function useSpace(id: string) {
470 const [space, setSpace] = useState<any>()
471
513}
514
515function useEmojis(id: string) {
516 const [receivedEmojis, setEmojis] = useState<any[]>([])
517

FarcasterSpacesui.tsx9 matches

@moeUpdated 2 days ago
3import { useEffect, useState } from "https://esm.sh/react@19";
4
5export function Section({ children, ...props }: any) {
6 const sectionClass = `p-5 rounded-3xl bg-neutral-400/15 ${props.className || ""}`;
7 return <div class={sectionClass}>{children}</div>;
93};
94
95// export function Input(props: any) {
96// const inputClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
97// return <input class={inputClass} {...props} />;
98// }
99
100// export function Button(props: any) {
101// const buttonClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
102// return <button class={buttonClass} {...props} />;
103// }
104
105export function MonoButton(props: any) {
106 return (
107 <Button {...props}>
111}
112
113export function MonoButtonWithStatus(props: any) {
114 const [status, setStatus] = useState<any>();
115 const handleClick = async () => {
132}
133
134export function formatJSON(json: any) {
135 return JSON.stringify(json, null, 2);
136}
146};
147
148export function BackButton({}) {
149 return <ArrowLeft className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={() => window.location.href = "/"} />;
150}
151
152export function ShareButton({ onClick }) {
153 return <Share className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={onClick} />;
154}
155
156export function Sheet({ children, showSheet, setShowSheet }: any) {
157 return (
158 <>

screenqueries.ts11 matches

@max123Updated 2 days ago
3
4// Site and Court queries
5export async function getAllSites(): Promise<Site[]> {
6 const sites = await sqlite.execute("SELECT * FROM sites ORDER BY name");
7 const courts = await sqlite.execute("SELECT * FROM courts ORDER BY site_id, number");
21}
22
23export async function getCourtById(courtId: string): Promise<Court | null> {
24 const result = await sqlite.execute(
25 "SELECT * FROM courts WHERE id = ?",
39
40// Player queries
41export async function createOrGetPlayer(name: string): Promise<Player> {
42 // Check if player exists
43 const existing = await sqlite.execute(
68}
69
70export async function getPlayerById(playerId: string): Promise<Player | null> {
71 const result = await sqlite.execute(
72 "SELECT * FROM players WHERE id = ?",
84
85// Game queries
86export async function createGame(request: CreateGameRequest): Promise<Game> {
87 const gameId = `game-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
88
109}
110
111export async function getGameById(gameId: string): Promise<Game | null> {
112 const result = await sqlite.execute(`
113 SELECT g.*,
154}
155
156export async function getAllActiveGames(): Promise<Game[]> {
157 const result = await sqlite.execute(`
158 SELECT g.*,
196}
197
198export async function getGamesByCourt(courtId: string): Promise<Game[]> {
199 const result = await sqlite.execute(`
200 SELECT g.*,
239
240// Point logging
241export async function addPoint(request: AddPointRequest): Promise<PointLog> {
242 const game = await getGameById(request.gameId);
243 if (!game) throw new Error("Game not found");
319}
320
321export async function getPointHistory(gameId: string): Promise<PointLog[]> {
322 const result = await sqlite.execute(
323 "SELECT * FROM point_logs WHERE game_id = ? ORDER BY timestamp",
339}
340
341export async function completeGame(gameId: string): Promise<void> {
342 await sqlite.execute(`
343 UPDATE games SET

screenmigrations.ts2 matches

@max123Updated 2 days ago
2
3// Database schema for pickleball scoring app
4export async function runMigrations() {
5 console.log("Running database migrations...");
6
87}
88
89async function insertDefaultData() {
90 // Check if sites already exist
91 const existingSites = await sqlite.execute("SELECT COUNT(*) as count FROM sites");

alibimain.tsx1 match

@NullClockUpdated 2 days ago
2import { renderToString } from "npm:react-dom@18.2.0/server";
3
4export default function App() {
5 return <h1>Hello, world!</h1>;
6}

we-the-undersignedREADME.md2 matches

@palomakopUpdated 2 days ago
23← `server.js`: The Node.js server script for your new site. The JavaScript defines the endpoints in the site API. The API processes requests, connects to the database using the `sqlite` script in `src`, and sends info back to the client (the web pages that make up the app user interface, built using the Handlebars templates in `src/pages`).
24
25← `/src/sqlite.js`: The database script handles setting up and connecting to the SQLite database. The `server.js` API endpoints call the functions in the database script to manage the data.
26
27← `/src/data.json`: The data config file includes the database manager script–`server.js` reads the `database` property to import the correct script.
45## Try this next 🏗️
46
47Take a look in `TODO.md` for steps in setting up your admin key and adding to the site functionality.
48
49💡 __Want to use the server script as an API without using the front-end UI? No problem! Just send a query parameter `?raw=json` with your requests to return JSON, like this (replace the first part of the URL to match your remix): `glitch-hello-sqlite.glitch.me?raw=json`__

getFileEmail4 file matches

@shouserUpdated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 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.