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?q=function&page=11&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 28622 results for "function"(2519ms)

crm_OBUO_FARMSAdminDashboard.tsx1 match

@eddie_walkโ€ขUpdated 14 hours ago
9import type { Order } from '../../shared/types.ts';
10
11export default function AdminDashboard() {
12 const [orders, setOrders] = useState<Order[]>([]);
13 const [loading, setLoading] = useState(true);

untitled-3016README.md1 match

@Mouhakโ€ขUpdated 14 hours ago
15โ”‚ โ”œโ”€โ”€ database/
16โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Database schema setup
17โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database query functions
18โ”‚ โ”œโ”€โ”€ routes/
19โ”‚ โ”‚ โ”œโ”€โ”€ jobs.ts # Job posting API routes

crm_OBUO_FARMSLoginForm.tsx1 match

@eddie_walkโ€ขUpdated 14 hours ago
7}
8
9export default function LoginForm({ onLogin }: LoginFormProps) {
10 const [credentials, setCredentials] = useState({ username: '', password: '' });
11 const [error, setError] = useState('');

crm_OBUO_FARMSClientOrderForm.tsx1 match

@eddie_walkโ€ขUpdated 14 hours ago
3import type { CreateOrderRequest, ApiResponse, Order, Product } from '../../shared/types.ts';
4
5export default function ClientOrderForm() {
6 const [formData, setFormData] = useState<CreateOrderRequest>({
7 clientName: '',

markdownBlogStarterLayout.tsx1 match

@Gray_ciieโ€ขUpdated 14 hours ago
2import type { ReactNode } from "npm:react@18.2.0";
3
4export function Layout({ children }: { children: ReactNode }) {
5 return (
6 <html lang="en">

markdownBlogStarterindex.tsx3 matches

@Gray_ciieโ€ขUpdated 14 hours ago
5import { Layout } from "./Layout.tsx";
6
7function PostComponent({ markdown, link }: { markdown: string; link?: string }) {
8 return (
9 <div style={{ border: "1px solid gray", padding: "10px", marginBottom: "20px", borderRadius: "5px" }}>
14}
15
16export default async function(req: Request): Promise<Response> {
17 const url = new URL(req.url);
18 if (url.pathname === "/") {
44}
45
46function html(children: React.ReactNode) {
47 return new Response(
48 renderToString(

mcp-servermain.ts15 matches

@AIWBโ€ขUpdated 14 hours ago
28};
29
30function postFilter(post: Post) {
31 return post.type == "post" || post.type == "page";
32}
33
34function buildIndex(searchData: Record<string, Post>) {
35 lunr.tokenizer.separator = /[\s/]+/;
36 return lunr(function() {
37 this.ref("id");
38 this.field("title");
60}
61
62function buildTagsIndex(tags: Array<Tag>) {
63 lunr.tokenizer.separator = /[\s/]+/;
64 return lunr(function() {
65 this.ref("id");
66 this.field("name");
77 });
78}
79function search(input: string, index: lunr.Index, searchData: Record<string, Post>) {
80 let results = index.search(input);
81
82 if ((results.length == 0) && (input.length > 2)) {
83 let tokens = lunr.tokenizer(input).filter(function(token, i) {
84 return token.str.length < 20;
85 });
86
87 if (tokens.length > 0) {
88 results = index.query(function(query) {
89 query.term(tokens, {
90 editDistance: Math.round(Math.sqrt(input.length / 2 - 1)),
113}
114
115function searchTags(input: string, index: lunr.Index, tags: Array<Tag>) {
116 let results = index.search(input);
117
118 if ((results.length == 0) && (input.length > 2)) {
119 let tokens = lunr.tokenizer(input).filter(function(token, i) {
120 return token.str.length < 20;
121 });
122
123 if (tokens.length > 0) {
124 results = index.query(function(query) {
125 query.term(tokens, {
126 editDistance: Math.round(Math.sqrt(input.length / 2 - 1)),
139 });
140}
141function formatPage(page: Post) {
142 return [
143 `# [${page.title}](${page.url})`,
157}
158
159function extractPostCategory(post: Post) {
160 if (post.type == "page") {
161 return "page";
182 * Uses a cached instance if available
183 */
184async function setupMcpServer(): Promise<McpServer> {
185 // Return cached instance if available
186 if (mcpServerInstance) {
451
452/**
453 * Val.town handler function for HTTP requests
454 * This will be exposed as a Val.town HTTP endpoint
455 */

ChatuseAnthropicStream.tsx5 matches

@AIWBโ€ขUpdated 14 hours ago
13
14/** merge delta (unchanged) */
15function mergeDelta(block: any, delta: any) {
16 if (!delta) return;
17 switch (delta.type) {
29
30/** build request body helpers (unchanged) */
31function buildBody(config: AppConfig, history: Message[], userText: string) {
32 const mcp = config.mcpServers
33 .filter((s) => s.enabled && s.url)
54
55/** final assembly */
56function assembleMessage(blocks: Record<number, any>): AssistantMsg {
57 Object.values(blocks).forEach((b) => {
58 if (b._input_json_str !== undefined) {
79/* โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ useAnthropicStream โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
80
81export default function useAnthropicStream(config: AppConfig) {
82 const [status, setStatus] = React.useState<Status>("idle");
83 const [liveBlocks, setLiveBlocks] = React.useState<any[] | null>(null);
107 }, []);
108
109 /* Main send/stream function โ€“ identical public contract */
110 const send = React.useCallback(
111 async (history: Message[], userText: string): Promise<AssistantMsg> => {

ChatStreamingChat.tsx1 match

@AIWBโ€ขUpdated 14 hours ago
25const chatInputCacheKey = "chat_input";
26
27export default function StreamingChat({
28 config,
29 messages,

ChatSettings.tsx1 match

@AIWBโ€ขUpdated 14 hours ago
17}
18
19export default function Settings({ config, onUpdateConfig, onClose }: SettingsProps) {
20 const [apiKey, setApiKey] = useState(config.anthropicApiKey);
21 const [mcpServers, setMcpServers] = useState<MCPServer[]>(config.mcpServers);

getFileEmail4 file matches

@shouserโ€ขUpdated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkโ€ขUpdated 1 month 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.