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=8&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 31478 results for "function"(1297ms)

stravachatApp.tsx2 matches

@katzenj•Updated 18 hours ago
62};
63
64export function App() {
65 const [memories, setMemories] = useState<Memory[]>([]);
66 const [loading, setLoading] = useState(true);
139 const data = await response.json();
140
141 // Change the sorting function to show memories in chronological order
142 const sortedMemories = [...data].sort((a, b) => {
143 const dateA = a.createdDate || 0;

ChatEnhancedCommandPalette.tsx2 matches

@c15r•Updated 19 hours ago
60}
61
62// Helper functions for JSON Schema handling
63const getDefaultValue = (schema: any): any => {
64 if (schema.default !== undefined) return schema.default;
140};
141
142export default function EnhancedCommandPalette({
143 servers,
144 query,

TownieValTownLogo.tsx1 match

@ianmenethil•Updated 20 hours ago
1/** @jsxImportSource https://esm.sh/react@18.2.0?dev */
2
3export function ValTownLogo () {
4 return (
5 <svg

Townieval-summary.ts1 match

@ianmenethil•Updated 20 hours ago
5 * Get usage data for a specific val
6 */
7export async function getValSummary(valId: string) {
8 // Get summary data for the val from the usage table
9 const usageSummaryResult = await sqlite.execute(`

Townieval-detail.ts1 match

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

TownieuseUser.tsx1 match

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

TownieuseUsageStats.ts1 match

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

TownieuseScrollToBottom.tsx3 matches

@ianmenethil•Updated 20 hours 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 20 hours 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 20 hours 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] || {
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.