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=2&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 30159 results for "function"(2153ms)

townie-126val-detail.ts1 match

@dinavinter•Updated 1 hour ago
36}
37
38export function renderValDetail(valId: string, summary: ValSummary, requests: UsageRequest[] = []): string {
39 // Generate the content
40 const content = `

townie-126useUser.tsx1 match

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

townie-126useUsageStats.ts1 match

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

townie-126useScrollToBottom.tsx3 matches

@dinavinter•Updated 1 hour ago
7 *
8 * @param {Array} dependencies - Array of dependencies that trigger scrolling when changed
9 * @returns {Object} An object containing containerRef and scrollToBottom function
10 */
11export function useScrollToBottomContainer(dependencies = []) {
12 const containerRef = useRef(null);
13
28
29// body scroll version
30export function useScrollToBottom(dependencies = []) {
31 const bottomRef = useRef(null);
32

townie-126user-summary.ts1 match

@dinavinter•Updated 1 hour ago
6 * This includes a fallback to inference calls data when usage data is missing
7 */
8export async function getUserSummary(userId?: string) {
9 // First, get the standard grouped data from the usage table
10 let query = `

townie-126user-detail.ts1 match

@dinavinter•Updated 1 hour ago
36}
37
38export function renderUserDetail(data: UserSummaryRow[], userId: string, requests: UsageRequest[] = [], creditAdditions: CreditAddition[] = []): string {
39 // User data should only have one row if we're filtering by user ID
40 const userData = data[0] || {

townie-126useProject.tsx1 match

@dinavinter•Updated 1 hour ago
4const FILES_ENDPOINT = "/api/project-files";
5
6export function useProject(projectId: string, branchId?: string) {
7 const [data, setData] = useState<any>(null);
8 const [loading, setLoading] = useState(true);

townie-126useProjects.tsx1 match

@dinavinter•Updated 1 hour ago
3const ENDPOINT = "/api/projects-loader";
4
5export function useProjects() {
6 const [data, setData] = useState<any>(null);
7 const [loading, setLoading] = useState(true);

townie-126useLoadingFavicon.ts3 matches

@dinavinter•Updated 1 hour ago
1import { useEffect } from "react";
2
3function setLoadingFavicon() {
4 document.querySelector('link[rel="icon"]').href = "/favicon-loading.svg";
5}
6function resetFavicon() {
7 document.querySelector('link[rel="icon"]').href = "/favicon.svg";
8}
9
10export function useLoadingFavicon(loading: boolean) {
11 useEffect(() => {
12 if (loading) setLoadingFavicon();

townie-126useCreditBalance.tsx1 match

@dinavinter•Updated 1 hour ago
2import { useState, useEffect } from "react";
3
4export function useCreditBalance() {
5 const [balance, setBalance] = useState<number | null>(null);
6 const [loading, setLoading] = useState(true);
tuna

tuna9 file matches

@jxnblk•Updated 5 days 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.