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/$%7Bart_info.art.src%7D?q=function&page=21&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 22409 results for "function"(2254ms)

reactHonoExampleMessageInput.tsx1 match

@johnroyallโ€ขUpdated 18 hours ago
3import type { Message } from "../shared/types.ts";
4
5export function MessageInput({ onSubmit }: { onSubmit: () => void }) {
6 const [message, setMessage] = React.useState("");
7

reactHonoExampleApp.tsx3 matches

@johnroyallโ€ขUpdated 18 hours ago
4import { MessageInput } from "./MessageInput.tsx";
5
6export function App(
7 { initialMessages = [], thisProjectURL }: { initialMessages?: Message[]; thisProjectURL?: string },
8) {
41}
42
43function MessageList({ messages }: { messages: Message[] }) {
44 const displayedMessages = messages.slice(0, MESSAGE_LIMIT);
45 return (
50}
51
52function MessageItem({ message }) {
53 const formattedDate = new Date(message.timestamp).toLocaleString();
54

reactHonoStarterApp.tsx1 match

@johnroyallโ€ขUpdated 19 hours ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (

NTFYweight.tsx1 match

@flymasterโ€ขUpdated 19 hours ago
1export default async function(interval: Interval) {
2 const ntfyChannel = Deno.env.get("CLEANUP_NTFY");
3 const formUrl = Deno.env.get("WEIGHT_FORM");

untitled-5856new-file-4245.tsx1 match

@willthereaderโ€ขUpdated 19 hours ago
1async function fetchWebsite() {
2 try {
3 const response = await fetch("https://willkrouse.com");

subcurrentShufflerandom-subcurrent-post.ts7 matches

@ashryanioโ€ขUpdated 20 hours ago
16}
17
18export default async function (req: Request): Promise<Response> {
19 try {
20 // Fetch the RSS feed
195}
196
197// Helper function to extract content from XML tags
198function extractTag(content: string, tagName: string): string | null {
199 const regex = new RegExp(`<${tagName}[^>]*>(.*?)<\/${tagName}>`, "s");
200 const match = content.match(regex);
202}
203
204// Helper function to format date
205function formatDate(dateStr: string): string {
206 try {
207 const date = new Date(dateStr);
219}
220
221// Helper function to sanitize HTML content
222function sanitizeHtml(html: string): string {
223 // This is a very basic sanitization
224 // In a production environment, you'd want to use a proper HTML sanitizer

a_new_websitetest.tsx1 match

@wolfโ€ขUpdated 20 hours ago
6 * @returns The sum of the two numbers
7 */
8export function add(
9 a: number,
10 b: number,
1// Helper function to extract text from title or rich_text property
2export const extractTextValue = (property: any): string => {
3 if (!property) return "";

ai-target-account-researchcompany_endpoint.tsx4 matches

@wadeโ€ขUpdated 20 hours ago
26
27// โ”€โ”€ helpers โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
28function json(body: unknown, status = 200) {
29 return new Response(JSON.stringify(body), {
30 status,
32 });
33}
34function rowToObj(res: { columns: string[]; rows: any[][] }) {
35 return Object.fromEntries(res.columns.map((c, i) => [c, res.rows[0][i]]));
36}
37
38// NEW: recursively remove every property called "encrypted_content"
39function stripEncrypted<T>(input: T): T {
40 if (Array.isArray(input)) {
41 return input.map(stripEncrypted) as unknown as T;
53
54// โ”€โ”€ HTTP handler โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
55export default async function handler(req: Request): Promise<Response> {
56 try {
57 const method = req.method.toUpperCase();
35
36// โ”€โ”€ cron entry โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
37export default async function cron(_: Interval) {
38 log("cron start");
39
94
95// โ”€โ”€ prompt builder โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
96function buildPrompt(name: string, url: string, industry: string): string {
97 return `
98## Research Objective

getFileEmail4 file matches

@shouserโ€ขUpdated 4 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkโ€ขUpdated 1 month 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.