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/$%7Burl%7D?q=function&page=12&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 31513 results for "function"(5689ms)

TownieuseScrollToBottom.tsx3 matches

@ianmenethil•Updated 1 day 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

Townieuser-summary.ts1 match

@ianmenethil•Updated 1 day 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 = `

Townieuser-detail.ts1 match

@ianmenethil•Updated 1 day 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] || {

TownieuseProject.tsx1 match

@ianmenethil•Updated 1 day 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);

TownieuseProjects.tsx1 match

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

TownieuseLoadingFavicon.ts3 matches

@ianmenethil•Updated 1 day 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();

TownieuseCreditBalance.tsx1 match

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

TownieuseCreateProject.tsx1 match

@ianmenethil•Updated 1 day ago
3const ENDPOINT = "/api/create-project";
4
5export function useCreateProject() {
6 const [data, setData] = useState<any>(null);
7 const [loading, setLoading] = useState(false);

TownieuseCreateBranch.tsx1 match

@ianmenethil•Updated 1 day ago
3const ENDPOINT = "/api/create-branch";
4
5export function useCreateBranch(projectId: string) {
6 const [data, setData] = useState<any>(null);
7 const [loading, setLoading] = useState(false);

TownieuseChatLogic.ts1 match

@ianmenethil•Updated 1 day ago
14const LIMIT_RE = /You have reached/;
15
16export function useChatLogic({
17 project,
18 branchId,
tuna

tuna9 file matches

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