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=19&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 19135 results for "function"(1102ms)

StarterPackFeedsfarcaster.ts3 matches

@moe•Updated 1 day ago
7// export const ogImageUrl = "https://imgur.com/xKVOVUE.png";
8
9export function embedMetadata(baseUrl: string, path: string = "/") {
10 return {
11 version: "next",
24}
25
26export function handleFarcasterEndpoints(app: Hono) {
27 app.get("/.well-known/farcaster.json", (c) => {
28 const baseUrl = c.req.url.replace(c.req.path, "");
90const decodeBase64Json = (str: string) => JSON.parse(Buffer.from(str, "base64").toString("utf-8"));
91
92async function sendWelcomeNotification(fid: number, baseUrl: string) {
93 return await sendNotificationToUser(fid, {
94 title: name + " installed!",

StarterPackFeedsui.tsx8 matches

@moe•Updated 1 day 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}

StarterPackFeedsFarcasterMiniApp.tsx1 match

@moe•Updated 1 day ago
4import { formatAddress, formatJSON, MonoButtonWithStatus, Section } from "./ui.tsx";
5
6export function FarcasterMiniApp() {
7 const [context, setContext] = useState<any>();
8 const [walletAddresses, setWalletAddresses] = useState<any>();

StarterPackFeedsExample.tsx1 match

@moe•Updated 1 day ago
5import { ShareButton } from "./ui.tsx";
6
7export function Example() {
8 const [context, setContext] = useState<any>();
9 useEffect(() => {

StarterPackFeedsHome.tsx1 match

@moe•Updated 1 day ago
9import { fetchUsersById } from "../util/neynar.ts";
10
11export function Home() {
12 return (
13 <div class="p-5 mb-8">

StarterPackFeedsneynar.ts7 matches

@moe•Updated 1 day ago
1const baseUrl = "https://api.neynar.com/v2/farcaster/";
2
3export async function fetchNeynarGet(path: string) {
4 const res = await fetch(baseUrl + path, {
5 method: "GET",
14}
15
16export function fetchUser(username: string) {
17 return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
18}
19export function fetchUsersById(fids: string) {
20 return fetchNeynarGet(`user/bulk?fids=${fids}`).then(r => r.users);
21}
22
23export function fetchUserFeed(fid: number) {
24 return fetchNeynarGet(
25 `feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
27}
28
29export function fetchChannel(channelId: string) {
30 return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
31}
32
33export function fetchChannelFeed(channelId: string) {
34 return fetchNeynarGet(
35 `feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`,
37}
38
39export function fetchChannelsFeed(channelIds: array) {
40 return fetchNeynarGet(
41 `feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&limit=100`,

StarterPackFeedsApp.tsx4 matches

@moe•Updated 1 day ago
10import { fetchNeynarGet } from "./util/neynar.ts";
11
12export function App() {
13 const navLinks = [
14 { name: "Farcaster SDK", path: "/" },
43}
44
45function About() {
46 return (
47 <Section className="flex flex-col items-start gap-3 m-5">
66}
67
68function Database() {
69 const queryFn = () => fetch("/api/counter/get").then((r) => r.json());
70 const { data, refetch } = useQuery({ queryKey: ["counter"], queryFn });
80}
81
82function Neynar() {
83 useEffect(() => {
84 fetchNeynarGet("user/by_username?username=moe").then(console.log).catch(console.error);

gordwameutils.ts1 match

@alexwein•Updated 1 day ago
5export const MESSAGE_LIMIT = 5;
6
7export function stringToBoard(str: string) {
8 // check if even length
9 if (str.length % 2 !== 0) {

informacao_lisboa_pt-agendamain.tsx1 match

@gmcabrita•Updated 1 day ago
55/* ------------------------------------------------------------------ */
56/* Utility: minimal XML escaping (only for text nodes) */
57function escapeXml(str: string = ""): string {
58 return str
59 .replace(/&/g, "&amp;")

Timenew-file-5970.html7 matches

@zuno•Updated 1 day ago
42 stopButton.addEventListener('click', stopSpeaking);
43
44 function startSpeaking() {
45 speaking = true;
46 startButton.disabled = true;
50 }
51
52 function stopSpeaking() {
53 speaking = false;
54 startButton.disabled = false;
57 }
58
59 function updateTimer() {
60 const currentTime = new Date();
61 const hours = currentTime.getHours();
69 }
70
71 function speakTime() {
72 const currentTime = new Date();
73 const hours = currentTime.getHours();
106 }
107
108 function getNumberWord(num) {
109 const numbers = {
110 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five',
121 }
122
123 function getTensNumberWord(num) {
124 const tens = Math.floor(num / 10) * 10;
125 const ones = num % 10;
131 }
132
133 function getSpecialNumberWord(num) {
134 const specialNumbers = {
135 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen',

getFileEmail4 file matches

@shouser•Updated 2 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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",