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/$%7Bsuccess?q=function&page=56&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 19621 results for "function"(1042ms)

MiniAppStarterHome.tsx1 match

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

MiniAppStarterdb.ts2 matches

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

MiniAppStarterApp.tsx4 matches

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

pollinaterpbldemo.tsx5 matches

@quartex•Updated 2 days ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function BeehiveMonitor() {
6 const [temperature, setTemperature] = useState(null);
7 const [humidity, setHumidity] = useState(null);
9
10 useEffect(() => {
11 async function fetchSensorData() {
12 try {
13 // Simulated sensor data with realistic bee habitat conditions
70}
71
72function App() {
73 return <BeehiveMonitor />;
74}
75
76function client() {
77 createRoot(document.getElementById("root")).render(<App />);
78}
79if (typeof document !== "undefined") { client(); }
80
81export default async function server(request: Request): Promise<Response> {
82 return new Response(
83 `

roseytestDailyBrief.ts1 match

@avni•Updated 3 days ago
4import { DateTime } from "https://esm.sh/luxon@3.4.4";
5
6export async function testDailyBrief() {
7 try {
8 const testChatId = Deno.env.get("TEST_TELEGRAM_CHAT_ID");

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.