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/$1?q=function&page=1&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 23460 results for "function"(1002ms)

untitled-923Footer.tsx1 match

@Piyush1234•Updated 1 hour ago
3import React from "https://esm.sh/react@18.2.0";
4
5export default function Footer() {
6 return (
7 <footer id="contact" className="bg-gray-900 text-white">

untitled-923Campus.tsx1 match

@Piyush1234•Updated 1 hour ago
3import React from "https://esm.sh/react@18.2.0";
4
5export default function Campus() {
6 const facilities = [
7 {

untitled-923Admissions.tsx1 match

@Piyush1234•Updated 1 hour ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5export default function Admissions() {
6 const [selectedProgram, setSelectedProgram] = useState("undergraduate");
7

untitled-923Programs.tsx1 match

@Piyush1234•Updated 1 hour ago
3import React from "https://esm.sh/react@18.2.0";
4
5export default function Programs() {
6 const programs = [
7 {

untitled-923About.tsx1 match

@Piyush1234•Updated 1 hour ago
3import React from "https://esm.sh/react@18.2.0";
4
5export default function About() {
6 return (
7 <section id="about" className="section-padding bg-gray-50">

untitled-923Hero.tsx1 match

@Piyush1234•Updated 1 hour ago
3import React from "https://esm.sh/react@18.2.0";
4
5export default function Hero() {
6 return (
7 <section id="home" className="hero-gradient text-white section-padding">

untitled-923Header.tsx1 match

@Piyush1234•Updated 1 hour ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5export default function Header() {
6 const [isMenuOpen, setIsMenuOpen] = useState(false);
7

untitled-923App.tsx1 match

@Piyush1234•Updated 1 hour ago
10import Footer from "./Footer.tsx";
11
12export default function App() {
13 return (
14 <div className="min-h-screen bg-white">

MiniAppStarterFarcasterMiniApp.tsx2 matches

@moe•Updated 1 hour ago
4import { formatAddress, formatJSON, MonoButtonWithStatus, Section } from './ui.tsx'
5
6export function FarcasterMiniApp() {
7 const [context, setContext] = useState<any>()
8 const [walletAddresses, setWalletAddresses] = useState<any>()
159}
160
161function ExpandableSection({ title, children }: { title: string; children: React.ReactNode }) {
162 const [expanded, setExpanded] = useState(false)
163

charmaineValSearchcomponents.tsx25 matches

@charmaine•Updated 1 hour ago
19
20// Define the Activity Heatmap component
21export function ActivityHeatmap({ activityData }: { activityData: { date: string; count: number }[] }) {
22 // Convert activity data to a map for easier lookup
23 const activityMap = new Map(activityData.map(item => [item.date, item.count]));
159
160// Helper to highlight the search terms in the code
161export function highlightText(text: string, searchTerm: string): JSX.Element {
162 if (!searchTerm) return <>{text}</>;
163
180
181// CodeBlock component for displaying code with line numbers
182export function CodeBlock(
183 { matchedLines, searchTerm, totalMatches: _totalMatches }: {
184 matchedLines: EnhancedSearchResult["matchedLines"];
206
207// File search result component
208export function FileSearchResultComponent(
209 { result, searchTerm }: { result: EnhancedSearchResult; searchTerm: string },
210) {
270
271// Project search result component
272export function ProjectSearchResultComponent(
273 { result, searchTerm }: { result: ProjectSearchResult; searchTerm: string },
274) {
336
337// User search result component
338export function UserSearchResultComponent(
339 { result, searchTerm }: { result: UserSearchResult; searchTerm: string },
340) {
395
396// Sub-section result for docs
397export function SubDocResultComponent(
398 { result, _searchTerm }: { result: SubDocResult; _searchTerm: string },
399) {
416
417// Doc search result component
418export function DocSearchResultComponent(
419 { result, searchTerm }: { result: DocSearchResult; searchTerm: string },
420) {
471
472// Result count tabs component
473export function ResultTypeTabs({
474 totalFileResults,
475 totalProjectResults,
519
520// Pagination component
521export function Pagination({
522 currentPage,
523 totalPages,
624
625// Sample results component for preview of other result types
626export function SampleResultsSection({
627 title,
628 linkText,
661
662// Main search page component
663export function SearchPage({
664 fileResults,
665 projectResults,
1225 <a href="?q=database" className="example-link">database</a>
1226 <a href="?q=image" className="example-link">image</a>
1227 <a href="?q=function" className="example-link">function</a>
1228 <a href="?q=discord" className="example-link">discord</a>
1229 <a href="?q=openai" className="example-link">openai</a>
1379 <a href="?q=database" className="example-link">database</a>
1380 <a href="?q=image" className="example-link">image</a>
1381 <a href="?q=function" className="example-link">function</a>
1382 <a href="?q=discord" className="example-link">discord</a>
1383 <a href="?q=openai" className="example-link">openai</a>
1397
1398// Newsletter curation components
1399export function EditedValCard({ val }: {
1400 val: EditedValResult;
1401}) {
1448}
1449
1450export function NewsletterProjectCard({ project }: {
1451 project: NewsletterProjectResult;
1452}) {
1500}
1501
1502export function NewsletterCurationPage({
1503 activeProjects,
1504 daysBack,
2096 const SELECTED_PROJECTS_KEY = 'newsletter_selected_projects';
2097
2098 function getSelectedProjects() {
2099 try {
2100 return JSON.parse(localStorage.getItem(SELECTED_PROJECTS_KEY) || '[]');
2104 }
2105
2106 function setSelectedProjects(projects) {
2107 localStorage.setItem(SELECTED_PROJECTS_KEY, JSON.stringify(projects));
2108 }
2109
2110 function toggleSelectedProject(id) {
2111 const selected = getSelectedProjects();
2112 const index = selected.indexOf(id);
2122 }
2123
2124 function selectAllOnPage() {
2125 const projectButtons = document.querySelectorAll('.corner-select');
2126 const selected = getSelectedProjects();
2137 }
2138
2139 function clearSelection() {
2140 setSelectedProjects([]);
2141 updateSelectedUI();
2142 }
2143
2144 function exportSelectedToMarkdown() {
2145 const selected = getSelectedProjects();
2146 if (selected.length === 0) return;
2201 }
2202
2203 function updateSelectedUI() {
2204 const selectedProjects = getSelectedProjects();
2205
2234
2235 // Initialize on page load
2236 document.addEventListener('DOMContentLoaded', function() {
2237 // Add click handlers to select buttons
2238 document.querySelectorAll('.corner-select').forEach(button => {

getFileEmail4 file matches

@shouser•Updated 1 month 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.