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/?q=function&page=635&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 17296 results for "function"(1681ms)

OpenTownieLogin.tsx1 match

@loading•Updated 3 weeks ago
2import { useLocalStorage } from "https://esm.sh/react-use?dev&deps=react@18.2.0&react-dom@18.2.0";
3
4export function Login() {
5 const [bearerToken, setBearerToken] = useLocalStorage("bearer", "");
6 const [anthropicApiKey, setAnthropicApiKey] = useLocalStorage("anthropic_api_key", "");

OpenTownieProjects.tsx2 matches

@loading•Updated 3 weeks ago
9);
10
11async function loader({ bearerToken }: { bearerToken: string }) {
12 const data = await (await fetch("/api/projects-loader", {
13 headers: {
199};
200
201export function Projects({ bearerToken, setProject }: { bearerToken: string; setProject: any }) {
202 const [loaderData, setLoaderData] = useState<any>();
203 const [isLoading, setIsLoading] = useState<boolean>(true);

blogEXAMPLE.md1 match

@valdottown•Updated 3 weeks ago
21
22```typescript
23function hello() {
24 console.log("Hello, Val Town!");
25}

blog1EXAMPLE.md1 match

@charmaine•Updated 3 weeks ago
21
22```typescript
23function hello() {
24 console.log("Hello, Val Town!");
25}

blog2025-04-07-blog.md2 matches

@shouser•Updated 3 weeks ago
122We didn't. We left them where they are and proxy to them.
123
124Writing 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 always a delight:
125
126```ts
127const OLD_BLOG_HOST = "https://val-town-blog.pages.dev/";
128export async function proxy(req: Request): Promise<Response> {
129 const url = new URL(req.url);
130 return fetch(OLD_BLOG_URL + url.pathname + url.search, {

blogutil.tsx2 matches

@shouser•Updated 3 weeks 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", {

blogSocialLinks.tsx1 match

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

blogrender-markdown.ts1 match

@shouser•Updated 3 weeks ago
9
10// Process markdown content
11export async function processMarkdown(content: string): Promise<string> {
12 const result = await unified()
13 .use(remarkParse)

blogproxy.ts1 match

@shouser•Updated 3 weeks ago
5const OLD_BLOG_URL = "https://val-town-blog.pages.dev/";
6
7export async function proxyHonoRequest(c: any) {
8 const url = new URL(c.req.url);
9

blogOGImage.tsx1 match

@shouser•Updated 3 weeks ago
4const LINE_HEIGHT = 72;
5
6export default function OGImage({
7 title = "Val Town Blog",
8 ...props

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 1 week 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.