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=4&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 18147 results for "function"(1081ms)

slack-prgithub-slack-pr-approvals.ts7 matches

@charmaineโ€ขUpdated 5 hours ago
41
42// Main handler for HTTP requests
43export default async function(req: Request): Promise<Response> {
44 console.log("\n๐Ÿ”„ ========== NEW REQUEST ==========");
45 console.log("๐Ÿ” Request received:", req.method, "URL:", req.url);
172
173// Handle GitHub PR review events
174async function handlePullRequestReview(req: Request): Promise<Response> {
175 try {
176 console.log("๐Ÿ” Starting PR review handler");
262
263// Handle Slack interactive button clicks
264async function handleSlackInteraction(req: Request): Promise<Response> {
265 try {
266 console.log("๐Ÿ” Starting Slack interaction handler");
327
328 // Perform the merge operation
329 console.log("๐Ÿ” Calling mergePR function");
330 try {
331 const mergeResult = await mergePR(repository, parseInt(pr_number, 10));
361
362// Fetch detailed PR information including checks status
363async function fetchPRDetails(repo: string, prNumber: number) {
364 console.log(`๐Ÿ” Starting fetchPRDetails for PR #${prNumber} in ${repo}`);
365
447
448// Merge a PR via GitHub API
449async function mergePR(repo: string, prNumber: number) {
450 console.log(`๐Ÿ” Starting mergePR for PR #${prNumber} in ${repo}`);
451
567
568// Send notification to Slack
569async function sendSlackNotification(data: {
570 reviewer: string;
571 prNumber: number;

TownieuseAuth.tsx1 match

@valdottownโ€ขUpdated 5 hours ago
5const ANTHROPIC_KEY = "anthropic_api_key";
6
7export function useAuth() {
8 const [token, setToken, removeToken] = useLocalStorage(TOKEN_KEY, "");
9 const [anthropicApiKey, setAnthropicApiKey, removeAnthropicApiKey] = useLocalStorage(ANTHROPIC_KEY, "");

testProj2testroot.ts1 match

@vtTestLocalโ€ขUpdated 5 hours ago
1export default async function (req: Request): Promise<Response> {
2 console.log("test");
3 return new Response(

markdownBlogStarterLayout.tsx1 match

@Abdikeniโ€ขUpdated 6 hours ago
2import type { ReactNode } from "npm:react@18.2.0";
3
4export function Layout({ children }: { children: ReactNode }) {
5 return (
6 <html lang="en">

markdownBlogStarterindex.tsx3 matches

@Abdikeniโ€ขUpdated 6 hours ago
5import { Layout } from "./Layout.tsx";
6
7function PostComponent({ markdown, link }: { markdown: string; link?: string }) {
8 return (
9 <div style={{ border: "1px solid gray", padding: "10px", marginBottom: "20px", borderRadius: "5px" }}>
14}
15
16export default async function(req: Request): Promise<Response> {
17 const url = new URL(req.url);
18 if (url.pathname === "/") {
44}
45
46function html(children: React.ReactNode) {
47 return new Response(
48 renderToString(

laicalasse-mail-servernew-file-8516.tsx1 match

@kucukkanatโ€ขUpdated 7 hours ago
10});
11
12export default async function(req: Request): Promise<Response> {
13 const searchParams = new URL(req.url).searchParams;
14 const to = searchParams.get("to");

helloooooooindex.ts3 matches

@charmaineโ€ขUpdated 7 hours ago
13
14// Parse frontmatter from markdown content
15function parseFrontmatter(content: string) {
16 const frontmatterRegex = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/;
17 const match = content.match(frontmatterRegex);
43
44// Get all blog posts
45async function getAllPosts() {
46 const files = await listFiles(import.meta.url);
47 const postFiles = files.filter(file => file.startsWith('/posts/') && file.endsWith('.md'));
65
66// Get a single blog post by slug
67async function getPost(slug: string) {
68 try {
69 const content = await readFile(`/posts/${slug}.md`, import.meta.url);

helloooooooindex.html6 matches

@charmaineโ€ขUpdated 7 hours ago
72
73 // Parse the current route
74 function parseRoute() {
75 const path = window.location.pathname;
76
109
110 // Show the list of posts
111 async function showPostList() {
112 const appElement = document.getElementById('app');
113
143
144 // Show a single post
145 async function showPost(params) {
146 const appElement = document.getElementById('app');
147 appElement.innerHTML = `
201
202 // Add event listeners to internal links
203 function addLinkEventListeners() {
204 document.querySelectorAll('a').forEach(link => {
205 const href = link.getAttribute('href');
216
217 // Navigate to a new route
218 function navigateTo(path) {
219 window.history.pushState({}, '', path);
220 handleRouteChange();
222
223 // Handle route changes
224 function handleRouteChange() {
225 const { handler, params } = parseRoute();
226 handler(params);

untitled-8809disc-receive-message.tsx1 match

@simdlauperโ€ขUpdated 7 hours ago
2import process from "node:process";
3
4export default async function server(request: Request): Promise<Response> {
5 await sodium.ready;
6

sqliteExplorerApp2README.md1 match

@shouserโ€ขUpdated 7 hours ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
37

getFileEmail4 file matches

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

tuna8 file matches

@jxnblkโ€ขUpdated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",