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=fetch&page=8&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 14007 results for "fetch"(2037ms)

FarcasterSpacesSpace.tsx7 matches

@moeUpdated 13 hours ago
7
8import { Button, Input, Section, ShareButton, Sheet } from '../components/ui.tsx'
9import { fetchUsersById } from '../util/neynar.ts'
10import { supabase, fetchSpace } from '../util/supabase.ts'
11
12import {
44 const { id } = useParams()
45
46 const { data: space, isLoading } = useQuery({ queryKey: ['space', id], queryFn: () => fetchSpace(id) })
47
48 const [calling, setCalling] = useState(false)
139
140 const queryFn = () =>
141 fetch(`/api/channels`)
142 .then((r) => r.json())
143 .then((r) => r?.data?.channels?.find((c) => c.channel_name == channel))
146
147 const join = async () => {
148 const response = await fetch(`/api/token?channel=${channel}&uid=${uid}`).then((r) => r.json())
149 console.log('response', response)
150 setToken(response.token)
408 if (!uid) return null
409 if (uid > 2_000_000) return null
410 return await fetchUsersById(`${uid}`).then((users) => users?.[0])
411}
412
439
440 useEffect(() => {
441 fetchSpace(id).then(setSpace)
442
443 const changes = supabase

FarcasterSpacesindex.tsx4 matches

@moeUpdated 13 hours ago
7import { embedMetadata, handleFarcasterEndpoints, name } from './farcaster.ts'
8import { handleImageEndpoints } from './image.tsx'
9import { fetchNeynarGet } from './neynar.ts'
10
11const app = new Hono()
28 const url = new URL(c.req.url)
29 const path = url.searchParams.get('path')
30 const response = await fetchNeynarGet(path)
31 return c.json(response)
32})
73})
74
75// HTTP vals expect an exported "fetch handler"
76// This is how you "run the server" in Val Town with Hono
77export default app.fetch
78

FarcasterSpacesimage.tsx6 matches

@moeUpdated 13 hours ago
5import satori from 'npm:satori'
6
7import { fetchSpace } from '../frontend/util/supabase.ts'
8import { fetchUsersById } from './neynar.ts'
9
10export function handleImageEndpoints(app: Hono) {
38
39export async function spaceImage(channel: string) {
40 const space = await fetchSpace(channel)
41 if (!space) return await homeImage()
42
43 const users = await fetchUsersById([space.created_by, ...space.hosts, ...space.speakers].join(','))
44
45 const hostFids = [space.created_by, ...space.hosts]
126 const fontPromises = fontsConfig.map(async (font) => {
127 const fontUrl = 'https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/' + font.fontFile
128 const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer())
129 return { name: font.name, data: fontArrayBuf, weight: font.weight }
130 })
137 // const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
138 const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`
139 return fetch(api).then((r) => r.text())
140}
141

FarcasterSpacesHome.tsx2 matches

@moeUpdated 13 hours ago
7
8import { Button, Input, Section, ShareButton } from '../components/ui.tsx'
9import { fetchUsersById } from '../util/neynar.ts'
10import { supabase } from '../util/supabase.ts'
11
39function Spaces() {
40 const queryFn = async () => {
41 const agoraChannels = await fetch(`/api/channels`)
42 .then((r) => r.json())
43 .then((r) => r?.data?.channels)

FarcasterSpacesfarcaster-notifications.ts2 matches

@moeUpdated 13 hours ago
44 const { data, error } = await supabase.from(table).select()
45 if (error) {
46 console.error('🔔 sendNotificationToAllUsers: error fetching users', error)
47 return
48 }
60
61async function sendNotification(notificationDetails: any, payload: any) {
62 return await fetch(notificationDetails.url, {
63 method: 'POST',
64 headers: { 'Content-Type': 'application/json' },

FarcasterSpacessupabase.ts1 match

@moeUpdated 13 hours ago
22}
23
24export const fetchSpace = async (id: string) => {
25 const { data, error } = await supabase.from('spaces').select().eq('id', id).single()
26 // console.log('🗄️ space', data, error)

GlancergeneratePDF.ts1 match

@lightweightUpdated 14 hours ago
1// Convert image URL to base64
2async function getImageBase64(url: string): Promise<string> {
3 const res = await fetch(url);
4 const buffer = await res.arrayBuffer();
5 const base64 = btoa(String.fromCharCode(...new Uint8Array(buffer)));

untitled-9336main.tsx2 matches

@simplescraperUpdated 16 hours ago
25});
26
27fetch(`${url}?${searchParams.toString()}`, {
28 method: "GET",
29 headers: {
51 }
52 })
53 .catch(err => console.error("Fetch Error:", err));

MusicPracticeTodoApp.tsx3 matches

@buzdyganUpdated 17 hours ago
16
17 const load = async () => {
18 const res = await fetch("/api/todos");
19 const data: Todo[] = await res.json();
20 setTodos(data);
27 const add = async (e: React.FormEvent) => {
28 e.preventDefault();
29 await fetch("/api/todos", {
30 method: "POST",
31 headers: { "Content-Type": "application/json" },
37
38 const complete = async (id: number) => {
39 await fetch("/api/complete", {
40 method: "POST",
41 headers: { "Content-Type": "application/json" },

MusicPracticetodos.ts1 match

@buzdyganUpdated 17 hours ago
23}
24
25// Fetch handler
26export async function GET(): Promise<Response> {
27 const rows = [...db.query("SELECT id, text, last_completed_date FROM todos")]

FetchBasic2 file matches

@therUpdated 5 days ago

GithubPRFetcher

@andybakUpdated 1 week ago