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/$2?q=function&page=42&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 29308 results for "function"(2867ms)

SON-GOKUBulkResults.tsx1 match

@Itssongoku•Updated 1 day ago
11}
12
13export default function BulkResults({ cards, totalGenerated, generationTime, mode, onClose }: BulkResultsProps) {
14 const [selectedFormat, setSelectedFormat] = useState<'csv' | 'json' | 'text' | 'list'>('list');
15 const [currentPage, setCurrentPage] = useState(1);

min-md-blogutils.ts3 matches

@arfan•Updated 1 day ago
4 * Creates a preview of markdown content by taking first paragraph or truncating
5 */
6export function createPreview(content: string): string {
7 const firstParagraph = content.split("\n\n")[0];
8
17 * Extracts clean post title from filename
18 */
19export function getPostTitle(filename: string): string {
20 return filename.replace(".md", "");
21}
24 * Creates HTML response with proper content type
25 */
26export function createHtmlResponse(html: string): Response {
27 return new Response(html, {
28 headers: { "content-type": "text/html;" },

min-md-blogroutes.ts3 matches

@arfan•Updated 1 day ago
12 * Loads all blog posts from the posts directory
13 */
14async function loadPosts(): Promise<PostData[]> {
15 const files = await listFiles(import.meta.url);
16 const postFiles = files.filter(file => file.path.startsWith("posts/"));
27 * Renders React component to complete HTML document
28 */
29function renderPage(children: React.ReactNode): Response {
30 const bodyContent = renderToString(<Layout>{children}</Layout>);
31 const html = createHtmlDocument(bodyContent);
36 * Main request handler with routing logic
37 */
38export async function handleRequest(req: Request): Promise<Response> {
39 const { pathname } = new URL(req.url);
40

min-md-blogApp.tsx1 match

@arfan•Updated 1 day ago
11 * Homepage component displaying blog header and post previews
12 */
13export function App({ posts }: AppProps) {
14 return (
15 <>

min-md-blogcomponents.tsx3 matches

@arfan•Updated 1 day ago
5 * Theme selector dropdown
6 */
7export function ThemeSelector() {
8 return (
9 <select id="theme" className="select select-bordered w-full max-w-xs">
20 * Blog header with title, description and theme selector
21 */
22export function BlogHeader() {
23 return (
24 <div className="text-center space-y-4">
38 * Simple back navigation
39 */
40export function Breadcrumbs() {
41 return (
42 <div className="breadcrumbs text-sm">

min-md-blogtest.md1 match

@arfan•Updated 1 day ago
105
106```javascript
107function hello() {
108 console.log("Hello, world!");
109}

min-md-blogmain.tsx1 match

@arfan•Updated 1 day ago
5 * Main HTTP handler - entry point for all requests
6 */
7export default async function(req: Request): Promise<Response> {
8 return handleRequest(req);
9}

TownValTownLogo.tsx1 match

@loading•Updated 1 day ago
1/** @jsxImportSource https://esm.sh/react@18.2.0?dev */
2
3export function ValTownLogo () {
4 return (
5 <svg

TownuseUser.tsx1 match

@loading•Updated 1 day ago
3const USER_ENDPOINT = "/api/user";
4
5export function useUser() {
6 const [data, setData] = useState<any>(null);
7 const [loading, setLoading] = useState(true);

TownuseUsageStats.ts1 match

@loading•Updated 1 day ago
1import { useEffect } from "react";
2
3export function useUsageStats(messages: any[], usages: any[]) {
4 useEffect(() => {
5 if (!messages?.length) return;
tuna

tuna9 file matches

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