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=1099&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 21204 results for "function"(1453ms)

OpenTownieMessageItem.tsx1 match

@maxm•Updated 1 month ago
24}
25
26export function MessageItem({ message, usages, messageEndTimes, running }: MessageItemProps) {
27 return (
28 <div

OpenTownieLogin.tsx1 match

@maxm•Updated 1 month 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", "");

OpenTownieImageUpload.tsx2 matches

@maxm•Updated 1 month ago
10}
11
12export function ImageUpload({ images, setImages }: ImageUploadProps) {
13 const fileInputRef = useRef<HTMLInputElement>(null);
14 const [isDragging, setIsDragging] = useState(false);
174
175// Component to display images in messages
176export function ImagePreview({ images }: { images: string[] }) {
177 const [expandedImage, setExpandedImage] = useState<string | null>(null);
178

OpenTowniefile-editing.ts6 matches

@maxm•Updated 1 month ago
2import { ValTown } from "npm:@valtown/sdk@0.37.0";
3
4async function view(
5 vt: ValTown,
6 project: any,
40}
41
42async function str_replace(
43 vt: ValTown,
44 project: any,
74}
75
76async function create(vt: ValTown, project: any, branch_id: string | undefined, path: string, file_text?: string) {
77 let type_: "file" | "http" | "script";
78 if (path.includes("backend/index.ts")) type_ = "http";
96}
97
98async function insert(
99 vt: ValTown,
100 project: any,
128 }
129}
130async function undo_edit(vt: ValTown, project: any, branch_id: string | undefined) {
131 return "Error: Command unimplemented";
132}
133
134export function getTextEditorTool(bearerToken: string, project: any, branch_id: string | undefined) {
135 const vt = new ValTown({ bearerToken });
136 return anthropic.tools.textEditor_20250124({

OpenTownieErrorDisplay.tsx1 match

@maxm•Updated 1 month ago
6}
7
8export function ErrorDisplay({ error }: ErrorDisplayProps) {
9 if (!error) return null;
10

OpenTownieDirectoryTree.tsx3 matches

@maxm•Updated 1 month ago
16}
17
18// Helper function to build a tree structure from flat file list
19const buildFileTree = (files: Array<{ path: string; type: string }>): FileNode[] => {
20 const root: FileNode[] = [];
209};
210
211export function DirectoryTree({ files, onSelectionChange }: DirectoryTreeProps) {
212 const [treeData, setTreeData] = useState<FileNode[]>([]);
213 const [checkedState, setCheckedState] = useState<Record<string, boolean>>({});
220 }, [files]);
221
222 // Helper function to convert numbers to words (for small numbers)
223 const numberToWords = (num: number): string => {
224 const words = [

OpenTownieCreateBranch.tsx1 match

@maxm•Updated 1 month ago
9}
10
11export function CreateBranch({
12 projectId,
13 bearerToken,

OpenTownieChat.tsx1 match

@maxm•Updated 1 month ago
10import { ApiKeyWarning } from "./ApiKeyWarning.tsx";
11
12export function Chat({
13 project,
14 bearerToken,

OpenTownieChatMessages.tsx1 match

@maxm•Updated 1 month ago
12}
13
14export function ChatMessages({
15 messages,
16 usages,

OpenTownieChatInput.tsx2 matches

@maxm•Updated 1 month ago
12}
13
14export function ChatInput({
15 input,
16 handleInputChange,
115 onClick={() => {
116 const customStop = (window as any).customStopRef?.current;
117 if (typeof customStop === "function") {
118 customStop();
119 }

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 4 weeks 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.