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=9&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 18191 results for "function"(783ms)

testProj2testroot.ts1 match

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

markdownBlogStarterLayout.tsx1 match

@Abdikeni•Updated 1 day 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 1 day 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(
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 1 day 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 1 day 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);
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 1 day 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

hellooooooomarkdown-tips.md1 match

@charmaine•Updated 1 day ago
15
16```javascript
17function hello() {
18 console.log("Hello, world!");
19}

blogggggindex.ts6 matches

@charmaine•Updated 1 day ago
82});
83
84// Helper function to list blog posts
85async function listBlogPosts() {
86 try {
87 const posts = [];
106}
107
108// Helper function to get a blog post by slug
109async function getBlogPost(slug: string) {
110 try {
111 const filePath = `/content/posts/${slug}.md`;
133}
134
135// Helper function to parse frontmatter
136function parseFrontmatter(content: string) {
137 const frontmatterRegex = /^---\s*([\s\S]*?)\s*---\s*([\s\S]*)$/;
138 const match = content.match(frontmatterRegex);

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": "*",