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=73&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 17277 results for "function"(990ms)

OpenTownieChatInput.tsx2 matches

@yakuzadave•Updated 5 days ago
13}
14
15export function ChatInput({
16 input,
17 handleInputChange,
128 onClick={() => {
129 const customStop = (window as any).customStopRef?.current;
130 if (typeof customStop === "function") {
131 customStop();
132 }

OpenTownieChatHeader.tsx1 match

@yakuzadave•Updated 5 days ago
17}
18
19export function ChatHeader({
20 project,
21 bearerToken,

OpenTownieBranchControl.tsx1 match

@yakuzadave•Updated 5 days ago
17}
18
19export function BranchControl({
20 projectId,
21 projectName,

OpenTownieApp.tsx4 matches

@yakuzadave•Updated 5 days ago
7import { Home } from "./Home.tsx";
8
9function safeParse(s: string) {
10 try {
11 return JSON.parse(s);
15}
16
17export function App() {
18 const [bearerToken, setBearerToken] = useLocalStorage("bearer", "");
19 const [anthropicApiKey, setAnthropicApiKey] = useLocalStorage("anthropic_api_key", "");
22 const [showLogin, setShowLogin] = useState(false);
23
24 function setProject(p: any) {
25 setProject_(p);
26 setProjectJSON(JSON.stringify(p));
27 }
28
29 function handleLogout() {
30 setBearerToken("");
31 setShowLogin(false);

OpenTownieapi.ts1 match

@yakuzadave•Updated 5 days ago
1// Fetch project files from the backend
2export async function fetchProjectFiles(
3 { bearerToken, projectId, branchId }: { bearerToken: string; projectId: string; branchId?: string },
4) {

OpenTownieApiKeyWarning.tsx1 match

@yakuzadave•Updated 5 days ago
6}
7
8export function ApiKeyWarning({ show }: ApiKeyWarningProps) {
9 if (!show) return null;
10

blob_adminapp.tsx7 matches

@yakuzadave•Updated 5 days ago
10}
11
12function Tooltip({ children, content }: TooltipProps) {
13 const [isVisible, setIsVisible] = useState(false);
14 const tooltipRef = useRef<HTMLDivElement>(null);
49}
50
51function formatBytes(bytes: number, decimals = 2) {
52 if (bytes === 0) return "0 Bytes";
53 const k = 1024;
58}
59
60function copyToClipboard(text: string) {
61 navigator.clipboard.writeText(text).then(() => {
62 console.log("Text copied to clipboard");
66}
67
68function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
69 const [isOpen, setIsOpen] = useState(false);
70 const menuRef = useRef(null);
73
74 useEffect(() => {
75 function handleClickOutside(event) {
76 if (menuRef.current && !menuRef.current.contains(event.target)) {
77 event.stopPropagation();
155}
156
157function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
158 const [isLoading, setIsLoading] = useState(false);
159 const decodedKey = decodeURIComponent(blob.key);
216}
217
218function App({ initialEmail, initialProfile, sourceURL }) {
219 const encodeKey = (key: string) => encodeURIComponent(key);
220 const decodeKey = (key: string) => decodeURIComponent(key);

cameraAppmain.tsx3 matches

@Parvezalm6•Updated 5 days ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function MiCameraApp() {
6 const [imageSource, setImageSource] = useState<string | null>(null);
7 const [cameraMode, setCameraMode] = useState<'user' | 'environment'>('environment');
226}
227
228function client() {
229 createRoot(document.getElementById("root")).render(<MiCameraApp />);
230}
231if (typeof document !== "undefined") { client(); }
232
233export default async function server(request: Request): Promise<Response> {
234 return new Response(`
235 <html>

linkInBioTemplatemain.tsx1 match

@Justine16•Updated 5 days ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

Jobs_aboard2main.tsx5 matches

@De_wise123•Updated 5 days ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5// Utility function for generating unique IDs
6const generateId = () => Math.random().toString(36).substr(2, 9);
7
64};
65
66function JobBoardChatApp() {
67 const [activeTab, setActiveTab] = useState('jobs');
68 const [jobs, setJobs] = useState([]);
99 // Load existing jobs from server
100 useEffect(() => {
101 async function fetchJobs() {
102 try {
103 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
284}
285
286function client() {
287 createRoot(document.getElementById("root")).render(<JobBoardChatApp />);
288}
289if (typeof document !== "undefined") { client(); }
290
291export default async function server(request: Request): Promise<Response> {
292 return new Response(`
293 <html>

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
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",