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=63&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 19320 results for "function"(1744ms)

TownieChatRoute.tsx3 matches

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

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

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

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

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

EEPMOnitoringlogin.tsx1 match

@solomonferede•Updated 5 days ago
8};
9
10export function LoginForm({ onLogin }) {
11 const [username, setUsername] = useState("");
12 const [password, setPassword] = useState("");

social_data_api_projectx_posts_search.tsx4 matches

@tsuchi_ya•Updated 5 days ago
6 * The main App component is rendered on the client.
7 */
8function App() {
9 // --- State declarations ---
10 const [query, setQuery] = React.useState("");
25 const sourceUrl = import.meta.url.replace("esm.town", "val.town");
26
27 // --- Helper Functions ---
28 const buildQuery = React.useCallback((keywords, account, since, until) => {
29 let finalQuery = keywords.trim();
580 * Client-only code
581 */
582function client() {
583 const root = document.getElementById("root");
584 if (root) {
595 * Server-only code
596 */
597export default async function server(request: Request): Promise<Response> {
598 const url = new URL(request.url);
599
32};
33
34// Main function
35async function registerToggleRoleCommand() {
36 console.log("🚀 Starting server-pings command registration process...");
37
103const result = await registerToggleRoleCommand();
104
105// Export the result and function for external use
106export default result;

Discord_Bot_Servicesinteraction-handler.tsx5 matches

@ktodaz•Updated 5 days ago
13} from "https://esm.town/v/ktodaz/Discord_Bot_Services/services/toggle-server-helper-pings-service.tsx"; // Fixed import path
14
15// Function to verify Discord request signature
16function verifyDiscordRequest(
17 body: string,
18 signature: string,
39
40// Handle Discord interactions
41export default async function(req: Request): Promise<Response> {
42 try {
43 const publicKey = Deno.env.get("DISCORD_PUBLIC_KEY");
128
129// Handle role autocomplete interaction
130async function handleRoleAutocomplete(interaction: any): Promise<Response> {
131 try {
132 const guildId = interaction.guild_id;
176
177// Handle toggle role command
178async function handleToggleRole(interaction: any): Promise<Response> {
179 const guildId = interaction.guild_id;
180 const userId = interaction.member.user.id;
12import { sqlite } from "https://esm.town/v/std/sqlite";
13
14// Function to convert hex string to Uint8Array (required for verification)
15function hexToUint8Array(hex: string): Uint8Array {
16 return new Uint8Array(
17 (hex.match(/.{1,2}/g) || []).map(byte => parseInt(byte, 16)),
19}
20
21// Function to verify Discord's signature
22function verifyDiscordRequest(
23 body: string,
24 signature: string,
43
44// Setup database for tracking command processing
45async function setupDatabase() {
46 await sqlite.execute(`
47 CREATE TABLE IF NOT EXISTS pending_commands (
61
62// Store command for later processing
63async function storeCommand(
64 interactionId: string,
65 guildId: string,
81
82// Main HTTP handler for Discord interactions
83export default async function(req: Request): Promise<Response> {
84 try {
85 console.log("📥 Received Discord interaction request");

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.