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%22Optional%20title%22?q=function&page=2311&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 33110 results for "function"(12138ms)

1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function FeaturesPage() {
4 return (
5 <div className="primary-bg">

reactHonoStarter_1742759574740PageNav.tsx1 match

@charmaine•Updated 3 months ago
6}
7
8export function PageNav({ currentPage, onChangePage }: PageNavProps) {
9 return (
10 <div className="page-nav">

reactHonoStarter_1742759574740Header.tsx1 match

@charmaine•Updated 3 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function Header() {
4 return (
5 <header>

reactHonoStarter_1742759574740App.tsx1 match

@charmaine•Updated 3 months ago
6import { PageNav } from "./PageNav.tsx";
7
8export function App() {
9 const [currentPage, setCurrentPage] = useState<'features' | 'details'>('features');
10

reactHonoStarter_1742759574740index.html2 matches

@charmaine•Updated 3 months ago
412 <script>
413 // Simple page navigation
414 document.getElementById('page1-btn').addEventListener('click', function() {
415 document.getElementById('page1').classList.add('active');
416 document.getElementById('page2').classList.remove('active');
417 });
418
419 document.getElementById('page2-btn').addEventListener('click', function() {
420 document.getElementById('page1').classList.remove('active');
421 document.getElementById('page2').classList.add('active');

newjxnblkstyle.css1 match

@charmaine•Updated 3 months ago
27.string { color: #a5b4fc; } /* light indigo */
28.comment { color: #6b7280; } /* gray */
29.function { color: #d1d5db; } /* light gray */
30.variable { color: #e5e7eb; } /* lighter gray */
31.number { color: #fbbf24; } /* amber */

newjxnblkscript.js3 matches

@charmaine•Updated 3 months ago
8
9 // Highlight keywords
10 const keywords = ['import', 'from', 'const', 'let', 'var', 'function', 'return', 'if', 'else', 'for', 'while'];
11 keywords.forEach(keyword => {
12 const regex = new RegExp(`\\b${keyword}\\b`, 'g');
41});
42
43// Toggle theme function (for future use)
44function toggleTheme() {
45 const body = document.body;
46 body.classList.toggle('light-theme');

openTownieMadeThis5App.tsx1 match

@charmaine•Updated 3 months ago
2import { useState, useEffect } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [mood, setMood] = useState("✨ feeling cute ✨");
6 const [count, setCount] = useState(0);

trAIderAgentsearchFinancialInfo.ts3 matches

@kamalnrf•Updated 3 months ago
4const endpoint = "https://serpapi.com/search.json";
5
6async function processResult(result) {
7 try {
8 // Try to fetch the actual webpage content
67
68const MAX_RESULTS = 20;
69async function googleIt(query: string) {
70 const results = (await search({ query })) ?? [];
71 const finalResults = results.slice(0, MAX_RESULTS);
85}
86
87export async function searchFinancialInfo(query: string) {
88 console.log("Doing web search =>", {
89 query,

import_from_githubindex.ts7 matches

@charmaine•Updated 3 months ago
94
95// Parse GitHub repo URL to extract owner and repo name
96function parseGitHubRepoURL(url: string): { owner: string; repo: string } {
97 try {
98 // Use the URL constructor to parse the URL
123
124// Fetch all files and their content from a GitHub repository
125async function fetchGitHubRepoContents(owner: string, repo: string, path: string = "") {
126 const files: Array<{
127 path: string;
192
193// Map GitHub file extension to Val.town file type
194function mapFileTypeForValTown(filePath: string): string | null {
195 const extension = filePath.split(".").pop()?.toLowerCase();
196
243}
244
245function transformHtmlContent(htmlContent: string): string {
246 return `export default function server(request: Request): Response {
247 return new Response(
248 \`${htmlContent}\`,
258// TODO could be doing this with a library
259// Check if file is likely binary based on extension
260function isProbablyBinaryFile(filePath: string): boolean {
261 const binaryExtensions = [
262 "png",
301
302// Create files in the Val.town project
303async function createFilesInValTown(authenticatedVT: any, files: any[], newProjectId: string) {
304 console.log(`Processing ${files.length} files`);
305

discordWebhook2 file matches

@stevekrouse•Updated 3 days ago
Helper function to send Discord messages
tuna

tuna9 file matches

@jxnblk•Updated 4 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.