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/image-url.jpg%20%22Image%20title%22?q=function&page=84&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 19901 results for "function"(1473ms)

MiniAppStarterneynar.ts7 matches

@kashi•Updated 3 days 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`,

MiniAppStarterindex.tsx1 match

@kashi•Updated 3 days ago
35});
36
37function generateHtml(baseUrl: string, path: string = "/"): any {
38 return (
39 <html>

MiniAppStarterimage.tsx4 matches

@kashi•Updated 3 days ago
5import satori from "npm:satori";
6
7export function handleImageEndpoints(app: Hono) {
8 const headers = {
9 "Content-Type": "image/png",
18}
19
20export async function homeImage() {
21 return await ogImage(
22 <div tw="w-full h-full flex justify-start items-end text-[100px] bg-black text-white p-[50px]">
31}
32
33export async function iconImage() {
34 return await ogImage(
35 <div tw="w-full h-full flex justify-center items-center text-[100px] bg-black text-white p-[50px]">
45//////////
46
47export async function ogImage(body, options = {}) {
48 const svg = await satori(
49 body,

MiniAppStarterHome.tsx1 match

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

MiniAppStarterfarcaster.ts3 matches

@kashi•Updated 3 days 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!",

MiniAppStarterfarcaster-notifications.ts5 matches

@kashi•Updated 3 days ago
3const dbKey = "fc-notification-details-by-fid";
4
5export async function saveUserNotificationsDetails(fid: number, notificationDetails: any) {
6 let notificationDetailsByFid: any = await db.get(dbKey) || {};
7 notificationDetailsByFid[fid] = notificationDetails;
10}
11
12export async function getUserNotificationsDetails(fid: number) {
13 let notificationDetailsByFid: any = await db.get(dbKey) || {};
14 return notificationDetailsByFid[fid];
15}
16
17export async function sendNotificationToUser(fid: number, payload: any) {
18 const notificationDetails = await getUserNotificationsDetails(fid);
19 if (!notificationDetails) {
26}
27
28export async function sendNotificationToAllUsers(payload: any) {
29 let notificationDetailsByFid: any = await db.get(dbKey) || {};
30
40}
41
42async function sendNotification(notificationDetails: any, payload: any) {
43 return await fetch(notificationDetails.url, {
44 method: "POST",

MiniAppStarterFarcasterMiniApp.tsx1 match

@kashi•Updated 3 days 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>();

MiniAppStarterExample.tsx1 match

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

MiniAppStarterdb.ts2 matches

@kashi•Updated 3 days ago
3const projectPrefix = "miniapp-starter";
4
5export async function get(key: string) {
6 return await blob.getJSON(`${projectPrefix}::${key}`);
7}
8export async function set(key: string, value: any) {
9 return await blob.setJSON(`${projectPrefix}::${key}`, value);
10}

MiniAppStarterdaily-notification.ts1 match

@kashi•Updated 3 days ago
3const baseUrl = "https://miniapp-starter.val.run";
4
5export default async function(interval: Interval) {
6 // await sendNotificationToAllUsers({
7 // title: "Example daily notification",

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.