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/$2?q=function&page=3&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 23725 results for "function"(947ms)

datemefaq1 match

@stevekrouse•Updated 3 hours ago
4let linkClass = "text-sky-600 hover:text-sky-500";
5
6export default function FAQ(c) {
7 return c.html(
8 <Layout activeTab={new URL(c.req.url).pathname}>

datemefaq1 match

@omikron•Updated 3 hours ago
4let linkClass = "text-sky-600 hover:text-sky-500";
5
6export default function FAQ(c) {
7 return c.html(
8 <Layout activeTab={new URL(c.req.url).pathname}>

datemerss1 match

@omikron•Updated 3 hours ago
3import { zip } from "npm:lodash-es";
4
5export async function rss(req: Request) {
6 let { columns, rows } = await sqlite.execute(`select * from datemedocs order by LastUpdated desc limit 20`);
7 const profiles = rows.map(row =>

datemelayout1 match

@omikron•Updated 3 hours ago
6const thisURL = parseProject(import.meta.url).links.self.project;
7
8export default function({ activeTab, children }: PropsWithChildren<{ activeTab: string }>) {
9 return (
10 <html>

datemehome1 match

@omikron•Updated 3 hours ago
3import Layout from "./layout";
4
5export default function Home(c) {
6 return c.html(
7 <Layout activeTab={new URL(c.req.url).pathname}>

datemebrowse4 matches

@omikron•Updated 3 hours ago
4import Layout from "./layout";
5
6function absoluteURL(url) {
7 if (url.startsWith("http://") || url.startsWith("https://"))
8 return url;
24let linkClass = "text-sky-600 hover:text-sky-500";
25
26function httpsIfy(url: string) {
27 if (!url.startsWith("http://") && !url.startsWith("https://")) {
28 return `https://${url}`;
31}
32
33function renderCell(header, row) {
34 let data = row[header];
35 if (header === "Name") {
45}
46
47export default async function Browse(c) {
48 const url = new URL(c.req.url);
49 const search = {

cerebras_coderindex.ts7 matches

@Downchuck•Updated 3 hours ago
23);
24
25function Hero({
26 prompt,
27 setPrompt,
44
45 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
46 Turn your ideas into fully functional apps in{" "}
47 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
48 less than a second
83}
84
85function App() {
86 const previewRef = React.useRef<HTMLDivElement>(null);
87 const [prompt, setPrompt] = useState("");
137 });
138
139 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
140 setLoading(true);
141 setTimeout(() => handleSubmit(promptItem.prompt), 0);
142 }
143
144 async function handleSubmit(e: React.FormEvent | string) {
145 if (typeof e !== "string") {
146 e.preventDefault();
193 }
194
195 function handleVersionChange(direction: "back" | "forward") {
196 const { currentVersionIndex, versions } = versionHistory;
197 if (direction === "back" && currentVersionIndex > 0) {
712);
713
714function client() {
715 const path = window.location.pathname;
716 const root = createRoot(document.getElementById("root")!);

cerebras_codergenerate-code.ts2 matches

@Downchuck•Updated 3 hours ago
2import STARTER_PROMPTS from "../public/starter-prompts.js";
3
4function extractCodeFromFence(text: string): string {
5 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
6 return htmlMatch ? htmlMatch[1].trim() : text;
7}
8
9export async function generateCode(prompt: string, currentCode: string) {
10 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
11 if (starterPrompt) {

untitled-4952rfindex.ts8 matches

@nhh•Updated 4 hours ago
1export default async function(req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html lang="en" dir="ltr">
268 <p>Phonetic disparities further compound the linguistic challenges faced by Arabic speakers. The English sound system includes a broader range of consonants and vowels than Arabic, which has only three primary vowel sounds and lacks certain consonants like /p/, /v/, /tʃ/, and /dʒ/. Consequently, Arabic learners frequently encounter difficulties pronouncing these unfamiliar sounds.</p>
269
270 <p>For example, the absence of /p/ in Arabic often results in its substitution with /b/, leading to mispronunciations such as "bark" instead of "park." Similarly, the voiced /v/ sound may be replaced with its voiceless counterpart /f/, causing errors like "ferry" instead of "very". To compensate for these gaps, learners often resort to repair strategies, such as substituting similar-sounding letters or omitting challenging sounds altogether. For instance, the /tʃ/ sound in "church" might be reduced to /ʃ/, resulting in "shurch". These adaptations, while functional, can hinder intelligibility and necessitate targeted phonetic training.</p>
271 </section>
272
455
456 <script>
457 function showEnglish() {
458 document.getElementById('english-content').classList.remove('hidden');
459 document.getElementById('arabic-content').classList.add('hidden');
464 }
465
466 function showArabic() {
467 document.getElementById('arabic-content').classList.remove('hidden');
468 document.getElementById('english-content').classList.add('hidden');
474
475 // Add smooth scrolling and interactive elements
476 document.addEventListener('DOMContentLoaded', function() {
477 // Add hover effects to content sections
478 const sections = document.querySelectorAll('.content-section');
479 sections.forEach(section => {
480 section.addEventListener('mouseenter', function() {
481 this.style.transform = 'translateY(-5px)';
482 });
483
484 section.addEventListener('mouseleave', function() {
485 this.style.transform = 'translateY(0)';
486 });
490 const toggleBtns = document.querySelectorAll('.toggle-btn');
491 toggleBtns.forEach(btn => {
492 btn.addEventListener('click', function() {
493 this.style.transform = 'scale(0.95)';
494 setTimeout(() => {

untitled-4952rfpage3.ts2 matches

@nhh•Updated 4 hours ago
1export default async function(req: Request): Promise<Response> {
2 const html = `<!DOCTYPE html>
3<html lang="en">
137 <h2 style="color: #2c3e50; margin-bottom: 20px;">Page 3 Content</h2>
138 <p class="placeholder-text">
139 This page is ready for your content. Please provide the information you'd like to include here, and I'll implement it with the same professional design and functionality.
140 </p>
141 <p class="placeholder-text" style="margin-top: 15px; font-style: italic; color: #7f8c8d;">

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.