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/$%7Burl%7D?q=function&page=104&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 29291 results for "function"(4706ms)

FarcasterSpacesui.tsx9 matches

@moe•Updated 4 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 <>

FarcasterSpacesHome.tsx4 matches

@moe•Updated 4 days ago
10import { supabase } from '../util/db.ts'
11
12export function Home() {
13 const [context, setContext] = useState<any>()
14 useEffect(() => {
37}
38
39function Spaces() {
40 const queryFn = async () => {
41 const agoraChannels = await fetch(`/api/channels`)
79}
80
81function Space({ space }: any) {
82 const navigate = useNavigate()
83
97}
98
99function CreateForm({}) {
100 const [context, setContext] = useState<any>()
101 useEffect(() => {

voicemessagesVoiceRecorder.tsx1 match

@cameronpak•Updated 4 days ago
16}
17
18export default function VoiceRecorder({ onVoiceNoteCreated }: VoiceRecorderProps) {
19 const [recordingState, setRecordingState] = useState<RecordingState>({
20 isRecording: false,

voicemessagesVoicePlayer.tsx1 match

@cameronpak•Updated 4 days ago
7}
8
9export default function VoicePlayer({ voiceNoteId }: VoicePlayerProps) {
10 const [voiceNote, setVoiceNote] = useState<VoiceNote | null>(null);
11 const [loading, setLoading] = useState(true);

voicemessagesDashboard.tsx1 match

@cameronpak•Updated 4 days ago
3import type { VoiceNote } from "../../shared/types.ts";
4
5export default function Dashboard() {
6 const [voiceNotes, setVoiceNotes] = useState<VoiceNote[]>([]);
7 const [loading, setLoading] = useState(true);

voicemessagesApp.tsx1 match

@cameronpak•Updated 4 days ago
11}
12
13export default function App() {
14 const [currentView, setCurrentView] = useState<"recorder" | "player" | "dashboard">("recorder");
15 const voiceNoteId = window.__VOICE_NOTE_ID__;

voicemessagesvoicenotes.ts2 matches

@cameronpak•Updated 4 days ago
150 apiKey: Deno.env.get("GROQ_API_KEY") || "",
151});
152// Background transcription function
153async function transcribeAudio(voiceNoteId: string, audioBuffer: ArrayBuffer) {
154 try {
155 // Convert ArrayBuffer to File for OpenAI

nelsongptuseChat.ts1 match

@zee1205•Updated 4 days ago
17}
18
19export function useChat(): ChatState & ChatActions {
20 const [messages, setMessages] = useState<Message[]>([]);
21 const [isLoading, setIsLoading] = useState(false);

nelsongptSidebar.tsx1 match

@zee1205•Updated 4 days ago
301 <li className="flex items-center">
302 <span className="w-2 h-2 bg-green-500 rounded-full mr-3"></span>
303 Offline functionality
304 </li>
305 <li className="flex items-center">

nelsongptsw.js8 matches

@zee1205•Updated 4 days ago
89
90// Check if request is for a static file
91function isStaticFile(request) {
92 const url = new URL(request.url);
93 return url.pathname.startsWith('/frontend/') ||
98
99// Check if request is for API
100function isAPIRequest(request) {
101 const url = new URL(request.url);
102 return url.pathname.startsWith('/api/');
104
105// Check if request is navigation
106function isNavigationRequest(request) {
107 return request.mode === 'navigate';
108}
109
110// Handle static files with cache-first strategy
111async function handleStaticFile(request) {
112 try {
113 const cachedResponse = await caches.match(request);
144
145// Handle API requests with network-first strategy
146async function handleAPIRequest(request) {
147 try {
148 const networkResponse = await fetch(request);
185
186// Handle navigation requests
187async function handleNavigationRequest(request) {
188 try {
189 const networkResponse = await fetch(request);
226
227// Handle other dynamic requests
228async function handleDynamicRequest(request) {
229 try {
230 const networkResponse = await fetch(request);
258
259// Sync offline messages when connection is restored
260async function syncOfflineMessages() {
261 try {
262 // This would integrate with IndexedDB to sync offline messages
tuna

tuna9 file matches

@jxnblk•Updated 1 day ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.