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%20%22Image%20title%22?q=function&page=61&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 19304 results for "function"(1315ms)

Towniefavicon.http.tsx1 match

@pomdtr•Updated 5 days ago
3import { TownieIcon } from "./components/icons.tsx";
4
5export default async function (loading: boolean) {
6 const svg = renderToString(
7 <TownieIcon

TownieDebugStyles.tsx1 match

@pomdtr•Updated 5 days ago
4import { Messages } from "./Messages.tsx";
5
6export function DebugStyles () {
7 const [ pathname, setPathname ] = useState("");
8 return (

Towniedashboard.ts1 match

@pomdtr•Updated 5 days ago
15}
16
17export function renderDashboard(data: UserSummaryRow[]): string {
18 // Calculate totals
19 const totalUsers = data.length;

TownieChatRoute.tsx3 matches

@pomdtr•Updated 5 days ago
15import { Loading } from "./Loading.tsx";
16
17export function ChatRoute () {
18 const { projectId, branchId } = useParams() as {
19 projectId: string;
52}
53
54function Conversation ({
55 project,
56 files,
177}
178
179function shouldRefetch (message) {
180 for (let i = 0; i < message?.parts?.length; i++) {
181 let part = message.parts[i];

TowniecalculateCost.tsx1 match

@pomdtr•Updated 5 days ago
5const CACHE_WRITE_RATE = 3.75; // $3.75 per M cache-write tokens
6
7export function calculateCost({
8 input_tokens,
9 output_tokens,

TownieBranchSelect.tsx1 match

@pomdtr•Updated 5 days ago
7const NEW_BRANCH_VAL = "__NEW_BRANCH__";
8
9export function BranchSelect () {
10 const { projectId, branchId } = useParams() as {
11 projectId: string;

Townieauth.ts1 match

@pomdtr•Updated 5 days ago
5 * Returns null if authentication is successful, or a Response if it fails
6 */
7export async function basicAuthMiddleware(req: Request): Promise<Response | null> {
8 const realm = "Usage Dashboard";
9 const unauthorizedResponse = new Response("Unauthorized", {

TownieApp.tsx1 match

@pomdtr•Updated 5 days ago
26});
27
28export function App() {
29 const [audio, setAudio] = useLocalStorage("AUDIO", false);
30 return (

EEPMOnitoringlogin.tsx1 match

@solomonferede•Updated 5 days ago
8};
9
10export function LoginForm({ onLogin }) {
11 const [username, setUsername] = useState("");
12 const [password, setPassword] = useState("");

social_data_api_projectx_posts_search.tsx4 matches

@tsuchi_ya•Updated 5 days ago
6 * The main App component is rendered on the client.
7 */
8function App() {
9 // --- State declarations ---
10 const [query, setQuery] = React.useState("");
25 const sourceUrl = import.meta.url.replace("esm.town", "val.town");
26
27 // --- Helper Functions ---
28 const buildQuery = React.useCallback((keywords, account, since, until) => {
29 let finalQuery = keywords.trim();
580 * Client-only code
581 */
582function client() {
583 const root = document.getElementById("root");
584 if (root) {
595 * Server-only code
596 */
597export default async function server(request: Request): Promise<Response> {
598 const url = new URL(request.url);
599

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks 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": "*",