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=2012&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 31299 results for "function"(14531ms)

vt-blogHead.tsx1 match

@stevekrouse•Updated 2 months ago
7const HLJS_CSS_URL = "https://cdn.jsdelivr.net/npm/highlight.js@11.8.0/styles/base16/solar-flare-light.css";
8
9export default function Head({ title, post }: {
10 title: string;
11 post?: BlogPost;

vt-blogget-new-posts.ts2 matches

@stevekrouse•Updated 2 months ago
5
6// Get all blog posts from the file system
7export async function getNewPosts(): Promise<BlogPost[]> {
8 const files = await listFiles(import.meta.url);
9 const blogPostFiles = files.filter(
42
43// Get a single blog post by slug
44export async function getBlogPostBySlug(slug: string): Promise<BlogPost | null> {
45 const post = posts.find(post => post.slug.includes(slug));
46 return post;

vt-blogBlogPost.tsx1 match

@stevekrouse•Updated 2 months ago
10}
11
12export function BlogPostComponent({ post, content }: BlogPostProps) {
13 return (
14 <Layout title={post.title}>

showbotmain.tsx1 match

@mvaodhan•Updated 2 months ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export default async function(email: Email) {
4 console.log(JSON.stringify(email));
5

FarcasterMiniAppStoreneynar.ts8 matches

@moe•Updated 2 months ago
2// const baseUrl = "https://api.neynar.com/v2/farcaster/";
3
4export async function fetchNeynarGet(path: string) {
5 const res = await fetch(baseUrl + encodeURIComponent(path), {
6 method: "GET",
15}
16
17export async function fetchNeynarGetPages(path: string, pages: number, dataKey: string) {
18 let data: any = [];
19 let cursor = "";
35//////////
36
37export function fetchUser(username: string) {
38 return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
39}
40export function fetchUsersById(fids: string) {
41 return fetchNeynarGet(`user/bulk?fids=${fids}`).then(r => r.users);
42}
43
44export function fetchUserFeed(fid: number) {
45 return fetchNeynarGet(
46 `feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
48}
49
50export function fetchChannel(channelId: string) {
51 return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
52}
53
54export function fetchChannelFeed(channelId: string) {
55 return fetchNeynarGet(
56 `feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`,
58}
59
60export function fetchChannelsFeed(channelIds: array) {
61 return fetchNeynarGet(
62 `feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&limit=100`,
ValTownForNotion

ValTownForNotionwebhookBuildClientPages8 matches

@bradnoble•Updated 2 months ago
20 let status = [] as any;
21
22 // check payload here so that each function that follows doesn't have to
23 // if the webhook doesn't have statuses, for example, both of the functions that follow
24 // will call to Notion to get the full payload, which is unnecessary to do twice
25
50 const logs = [];
51
52 // check payload here so that each function that follows doesn't have to
53 // if the webhook doesn't have statuses, for example, both of the functions that follow
54 // will call to Notion to get the full payload, which is unnecessary to do twice
55
71 const logs = [];
72
73 // check payload here so that each function that follows doesn't have to
74 // if the webhook doesn't have statuses, for example, both of the functions that follow
75 // will call to Notion to get the full payload, which is unnecessary to do twice
76
86
87// this endpoint is really just for testing purposes
88// the helper function it calls is the one that other endpoints will use
89app.post("/updatePageStatus", async (c) => {
90 const payload = await c.req.json();
112// test API with a simple GET
113app.get("/asdf", async (c) => {
114 // call helper function from utils folder with pageId as argument
115 const testImport = await notionHelpers.foo("123");
116 return c.text(testImport);

reactHonoStarterDupeApp.tsx3 matches

@charmaine•Updated 2 months ago
13
14// --- Helper Components ---
15function SimpleCodeBlock({ code }: { code: string }) {
16 const lines = code.split('\n');
17 return (
27}
28
29function ChecklistItem({ id, text, isCompleted, children, gifPlaceholder }: {
30 id: string;
31 text: string;
61
62// --- Main App Component ---
63export function App() {
64 // --- State ---
65 const [title, setTitle] = useState(initialData.title);

reactRouter7ExampleTopicList.tsx1 match

@stevekrouse•Updated 2 months ago
15}
16
17export function TopicList() {
18 const navigation = useNavigation();
19 const { topics } = useLoaderData<TopicListProps>();

reactRouter7ExampleTopics.action.ts2 matches

@stevekrouse•Updated 2 months ago
1import { ActionFunctionArgs, redirect } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { createTopic } from "../backend/database/queries.ts";
3
4export async function action({ request }: ActionFunctionArgs) {
5 const formData = await request.formData();
6 const title = formData.get("title") as string;

reactRouter7ExampleTopic.action.ts2 matches

@stevekrouse•Updated 2 months ago
1import { ActionFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { createMessage } from "../backend/database/queries.ts";
3
4export async function action({ request }: ActionFunctionArgs) {
5 console.log("HERE!");
6 const formData = await request.formData();
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.