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=69&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 19439 results for "function"(1336ms)

TownieChatRoute.tsx3 matches

@jxnblk•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

@jxnblk•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

@jxnblk•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

@jxnblk•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

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

forwarderforwarder1 match

@gwoods22•Updated 5 days ago
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {

CareerCoach20DayweeklyEmail.ts1 match

@prashamtrivedi•Updated 5 days ago
8 * Generates comprehensive weekly analysis and strategy
9 */
10export default async function handler() {
11 try {
12 console.log("Starting weekly analysis process")

CareerCoach20DaymodelSelection.ts3 matches

@prashamtrivedi•Updated 5 days ago
13 * @returns Object with model selection and reasoning parameters
14 */
15export async function selectAppropriateModel(content: string) {
16 try {
17 // If content is empty or very short, use a simpler model
45 * @returns Object with complexity and reasoning_required assessments
46 */
47async function evaluateWithAI(content: string) {
48 const systemPrompt = `
49 You are an AI model selector. Evaluate the following input and determine:
93 * @returns AI response
94 */
95export async function processWithAI(
96 content: string,
97 modelConfig: {model: string; reasoning_efforts?: string},

CareerCoach20DaydailyEmail.ts1 match

@prashamtrivedi•Updated 5 days ago
8 * Analyzes progress, generates tasks, and sends daily email
9 */
10export default async function handler() {
11 try {
12 console.log("Starting daily email process")

CareerCoach20Dayemail.ts8 matches

@prashamtrivedi•Updated 5 days ago
2
3/**
4 * Email utility functions for the Career Coach application
5 * Handles sending daily and weekly emails with analytics and tasks
6 */
11 * @returns Formatted date string
12 */
13export function formatDate(date: Date): string {
14 return date.toISOString().split('T')[0];
15}
20 * @returns Result of the email sending operation
21 */
22export async function sendDailyEmail(data: {
23 analysis: any;
24 tasks: any[];
51 * @returns Result of the email sending operation
52 */
53export async function sendWeeklyEmail(data: {
54 weeklyAnalysis: any;
55 strategy: any;
83 * @returns HTML content for the email
84 */
85async function generateDailyEmailContent(data: {
86 analysis: any;
87 tasks: any[];
139 * @returns HTML content for the email
140 */
141async function generateWeeklyEmailContent(data: {
142 weeklyAnalysis: any;
143 strategy: any;
238 * @returns Plain text version of the email
239 */
240function generatePlainTextVersion(htmlContent: string): string {
241 // This is a very basic HTML to plain text conversion
242 // In a production environment, you might want to use a dedicated library
277 * @returns Formatted priority string
278 */
279function renderPriority(priority: number): string {
280 switch (priority) {
281 case 1: return "🔥 CRITICAL";

getFileEmail4 file matches

@shouser•Updated 3 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
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.