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=946&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 20202 results for "function"(1847ms)

Open-Toownieapi.ts1 match

@toowired•Updated 1 month ago
1// Fetch project files from the backend
2export async function fetchProjectFiles(
3 { bearerToken, projectId, branchId }: { bearerToken: string; projectId: string; branchId?: string },
4) {

Open-ToownieApiKeyWarning.tsx1 match

@toowired•Updated 1 month ago
6}
7
8export function ApiKeyWarning({ show }: ApiKeyWarningProps) {
9 if (!show) return null;
10

FarcasterGalleryfarcaster.ts3 matches

@onchaindom•Updated 1 month ago
5export const ogImageUrl = "https://i.imgur.com/5XiH5Vc.png";
6
7export function embedMetadata(baseUrl: string, path: string = "/") {
8 return {
9 version: "next",
22}
23
24export function handleFarcasterEndpoints(app: Hono) {
25 app.get("/.well-known/farcaster.json", (c) => {
26 const baseUrl = c.req.url.replace(c.req.path, "");
81const decodeBase64Json = (str: string) => JSON.parse(Buffer.from(str, "base64").toString("utf-8"));
82
83async function sendFarcasterNotification(payload: any) {
84 return await fetch("https://api.warpcast.com/v1/frame-notifications", {
85 method: "POST",

FarcasterGalleryApp.tsx3 matches

@onchaindom•Updated 1 month ago
8import { useQuery } from "./util/useQuery.ts";
9
10export function App() {
11 const [context, setContext] = useState<any>();
12
26}
27
28function Home({ context }) {
29 const channelId = "higher";
30 const [sortBy, setSortBy] = useState<'recent' | 'trending'>('recent');
84}
85
86function User({ context }) {
87 let { username } = useParams();
88 const { data: user } = useQuery(["user", username], () => fetchUser(username));

FarcasterGallerygallery.tsx3 matches

@onchaindom•Updated 1 month ago
3import { Button, ShareButton } from "./ui.tsx";
4
5export function Header({ image }) {
6 return (
7 <div className="relative w-full">
13}
14
15export function Feed({ casts }) {
16 return (
17 <div className="grid grid-cols-3 gap-[1px] ">
21}
22
23export function Cast({ cast }) {
24 const [isFullscreen, setIsFullscreen] = useState(false);
25 const images = cast?.embeds?.filter((embed) => !!embed?.metadata?.image);

FarcasterGalleryindex.ts1 match

@onchaindom•Updated 1 month ago
26});
27
28function generateHtml(baseUrl: string, path: string = "/") {
29 return `<!DOCTYPE html>
30 <html>

FarcasterGalleryneynar.ts6 matches

@onchaindom•Updated 1 month ago
1const baseUrl = "https://api.neynar.com/v2/farcaster/";
2
3export async function fetchNeynarGet(path: string) {
4 console.log('Fetching Neynar API:', path);
5 const res = await fetch(baseUrl + path, {
24}
25
26export function fetchUser(username: string) {
27 return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
28}
29
30export function fetchUserFeed(fid: number) {
31 return fetchNeynarGet(
32 `feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
34}
35
36export function fetchChannel(channelId: string) {
37 return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
38}
39
40export function fetchChannelFeed(channelId: string, sortBy: 'recent' | 'trending' = 'recent') {
41 console.log('Fetching channel feed with sort:', sortBy);
42 const url = `feed/channels?channel_ids=${channelId}&with_recasts=false&with_replies=false&limit=100`;
51}
52
53export function fetchChannelsFeed(channelIds: Array<string>, sortBy: 'recent' | 'trending' = 'recent') {
54 console.log('Fetching channels feed with sort:', sortBy);
55 const url = `feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&with_replies=false&limit=100`;

FarcasterGalleryui.tsx6 matches

@onchaindom•Updated 1 month ago
3import { useEffect, useState } from "https://esm.sh/react@19";
4
5export function Section({ children }: any) {
6 const sectionClass = "my-3 bg-neutral-400 bg-opacity-10 p-5 rounded-xl ";
7 return <div class={sectionClass}>{children}</div>;
8}
9
10export function Button(props: any) {
11 const buttonClass = "rounded-full px-6 py-2.5 font-medium transition-all duration-200 ease-in-out hover:scale-105";
12 return <button {...props} class={buttonClass + props.className} />;
13}
14
15export function MonoButton(props: any) {
16 return (
17 <Button {...props}>
21}
22
23export function MonoButtonWithStatus(props: any) {
24 const [status, setStatus] = useState<any>();
25 const handleClick = async () => {
42}
43
44export function BackButton({}) {
45 return <ArrowLeft className="w-6 h-6 m-2 cursor-pointer opacity-50" onClick={() => window.location.href = "/"} />;
46}
47
48export function ShareButton({ onClick }) {
49 return <Share className="w-6 h-6 m-2 cursor-pointer opacity-50" onClick={onClick} />;
50}

cwruBusesrefresh.ts2 matches

@wolf•Updated 1 month ago
2import refresh from "./backend/refresh.ts";
3
4export default async function(req: Request): Promise<Response> {
5 const LAST_RUN_KEY = "refresh_last_run";
6 const REFRESH_INTERVAL = 5000; // 5 seconds
13 if (!lastRun || now - lastRun >= REFRESH_INTERVAL) {
14 try {
15 // Execute the refresh function
16 await refresh();
17 console.log("Refresh completed");

cwruBusesBusMap.tsx1 match

@wolf•Updated 1 month ago
18}
19
20export function BusMap({ positions }: BusMapProps) {
21 const mapRef = useRef<any>(null);
22 const markersRef = useRef<Record<string, any>>({});

getFileEmail4 file matches

@shouser•Updated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 weeks 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.