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=23&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 19140 results for "function"(975ms)

blog-cloneutil.tsx2 matches

@jamiesinclair•Updated 2 days ago
1export function formatDate(dateString: string): string {
2 try {
3 const date = new Date(dateString);
12}
13
14export function dayOfWeek(dateString: string): string {
15 try {
16 return new Date(dateString).toLocaleDateString("en-US", {

blog-cloneSocialLinks.tsx1 match

@jamiesinclair•Updated 2 days ago
2import { BlueskyIcon, DiscordIcon, GitHubIcon, RSSIcon, TwitterIcon } from "./icons.tsx";
3
4export default function SocialLinks() {
5 return (
6 <div className="social-links">

blog-clonerender-markdown.ts1 match

@jamiesinclair•Updated 2 days ago
10
11// Process markdown content
12export async function processMarkdown(content: string): Promise<string> {
13 const result = await unified()
14 .use(remarkParse)

blog-cloneREADME.md1 match

@jamiesinclair•Updated 2 days ago
31 - **`rss.ts`**: RSS feed generation
32 - **`favicon.ts`** & **`og-image.ts`**: Asset routes
33- **`/utils/`**: Utility functions for post processing, caching, etc.
34- **`/posts/`**: Markdown files for blog posts
35- **`/styles/`**: CSS styling

blog-cloneproxy.ts1 match

@jamiesinclair•Updated 2 days ago
5const OLD_BLOG_URL = "https://val-town-blog.pages.dev/";
6
7export async function proxyHonoRequest(c: any) {
8 const url = new URL(c.req.url);
9

blog-cloneOGImage.tsx1 match

@jamiesinclair•Updated 2 days ago
4const LINE_HEIGHT = 72;
5
6export default function OGImage({
7 title = "Val Town Blog",
8 ...props

blog-cloneLogo.tsx1 match

@jamiesinclair•Updated 2 days ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export default function (props: React.SVGProps<SVGSVGElement>) {
4 return (
5 <svg

blog-cloneLogoMark.tsx2 matches

@jamiesinclair•Updated 2 days ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export default function(props: React.SVGProps<SVGSVGElement>) {
4 return (
5 <svg
18}
19
20export function Favicon(props: React.SVGProps<SVGSVGElement>) {
21 return (
22 <svg

blog-clonelive-reload.ts8 matches

@jamiesinclair•Updated 2 days ago
4const client = new ValTown({ bearerToken: "" });
5
6async function getProjectAndBranchIds(importMetaUrl: string) {
7 // imported dynamically because this is server-only but this file is also imported on the client
8 const { parseProject } = await import("https://esm.town/v/std/utils@85-main/index.ts");
23}
24
25async function projectLastUpdatedAt({ project_id, branch_id }: { project_id: string; branch_id: string }) {
26 const { updatedAt } = await client.vals.branches.retrieve(
27 project_id,
34 * Creates a wrapper around a fetch handler that injects a script tag into HTML responses
35 *
36 * @param handler The original fetch handler function
37 * @param scriptContent The HTML content to inject
38 * @returns A new fetch handler with HTML rewriting capability
39 */
40export function injectHTML(
41 handler: (request: Request) => Promise<Response>,
42 html: string,
43): (request: Request) => Promise<Response> {
44 let HTMLRewriter: typeof import("https://ghuc.cc/worker-tools/html-rewriter/index.ts").HTMLRewriter | undefined;
45 // Return the new handler function
46 return async (request: Request) => {
47 if (!HTMLRewriter) {
69}
70
71export function liveReload(
72 handler: (request: Request) => Promise<Response>,
73 importMetaUrl: string,
99 * ------------------------------ */
100
101async function registerNextCheck(
102 { pageLoad, project_id, branch_id }: { pageLoad: number; project_id: string; branch_id: string },
103) {
126}
127
128export async function main(ids: { project_id: string; branch_id: string }) {
129 // don't run this on custom domains, ie not on blog.val.run
130 if (!window.location.hostname.endsWith(".val.run")) {

blog-cloneLayout.tsx1 match

@jamiesinclair•Updated 2 days ago
14}
15
16export function Layout({ title, post, children }: LayoutProps) {
17 return (
18 <html lang="en">

getFileEmail4 file matches

@shouser•Updated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 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": "*",