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=2522&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 36430 results for "function"(15388ms)

blog2025-04-08-migration.md2 matches

@cdignam•Updated 3 months ago
83We didn't. We left them where they are, and proxy to them.
84
85Writing a proxy in Val Town (or any functions platform with the ['fetch handler' interface](https://blog.val.town/blog/the-api-we-forgot-to-name/)) is a delight:
86
87```ts
88const OLD_BLOG_HOST = "https://val-town-blog.pages.dev/";
89export async function proxy(req: Request): Promise<Response> {
90 const url = new URL(req.url);
91 return fetch(OLD_BLOG_HOST + url.pathname + url.search, {

cs1200main.tsx1 match

@jamesugk•Updated 3 months ago
4
5// Fetches a random joke.
6async function fetchRandomJoke() {
7 const response = await fetch(
8 "https://official-joke-api.appspot.com/random_joke",

sqliteExplorerAppREADME.md1 match

@charmaine•Updated 3 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

chatApp.tsx1 match

@loading•Updated 3 months ago
47 }, [messages]);
48
49 // Function to send a message to the API
50 const sendMessage = async (userMessage: string) => {
51 // Add user message to state

chatChatInput.tsx1 match

@loading•Updated 3 months ago
34 };
35
36 // Function to create ripple effect on button click
37 const createRippleEffect = (e: MouseEvent<HTMLButtonElement>) => {
38 const button = e.currentTarget;

newestCard.tsx2 matches

@loading•Updated 3 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function ValCard({ val }) {
4 const createdAt = new Date(val.createdAt).toLocaleDateString("en-US", {
5 year: "numeric",
62}
63
64export function ValList({ vals }) {
65 if (vals.length === 0) {
66 return (

blogBlogPost.tsx1 match

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

vt-blogREADME.md1 match

@stevekrouse•Updated 3 months ago
31 - **`rss.ts`**: RSS feed generation
32 - **`favicon.ts`** & **`og-image.ts`**: Asset routes
33- **`/utils/`**: Utility functions for post processing, caching, etc.
34- **`/posts/`**: Markdown files for blog posts
35- **`/styles/`**: CSS styling

vt-blogutil.tsx2 matches

@stevekrouse•Updated 3 months ago
1export function formatDate(dateString: string): string {
2 try {
3 const date = new Date(dateString);
12}
13
14export function dayOfWeek(dateString: string): string {
15 try {
16 return new Date(dateString).toLocaleDateString("en-US", {

vt-blogSocialLinks.tsx1 match

@stevekrouse•Updated 3 months ago
2import { BlueskyIcon, DiscordIcon, GitHubIcon, RSSIcon, TwitterIcon } from "./icons.tsx";
3
4export default function SocialLinks() {
5 return (
6 <div className="social-links">

ratelimit4 file matches

@unkey•Updated 2 days ago
Rate limit your serverless functions

discordWebhook2 file matches

@stevekrouse•Updated 1 month ago
Helper function to send Discord messages
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.