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/$%7Bsuccess?q=function&page=29&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 18516 results for "function"(787ms)

bloglive-reload.ts8 matches

@fil•Updated 1 day 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")) {

blogLayout.tsx1 match

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

blogindex.css1 match

@fil•Updated 1 day ago
303 border-radius: 9999px;
304 transition-property: color, background-color;
305 transition-timing-function: ease-in-out;
306 transition-duration: 200ms;
307}

blogicons.tsx5 matches

@fil•Updated 1 day ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function RSSIcon (props: React.SVGProps<SVGSVGElement>) {
4 return (
5 <svg
24}
25
26export function TwitterIcon (props: React.SVGProps<SVGSVGElement>) {
27 return (
28 <svg
41}
42
43export function GitHubIcon (props: React.SVGProps<SVGSVGElement>) {
44 return (
45 <svg
59}
60
61export function BlueskyIcon (props: React.SVGProps<SVGSVGElement>) {
62 return (
63 <svg
75}
76
77export function DiscordIcon (props: React.SVGProps<SVGSVGElement>) {
78 return (
79 <svg

blogHomePage.tsx1 match

@fil•Updated 1 day ago
5import Byline from "./Byline.tsx";
6
7export function HomePage({ posts }: { posts: BlogPost[] }) {
8 const latest = posts.at(0);
9 const top = posts.slice(1, 3);

blogHead.tsx1 match

@fil•Updated 1 day ago
7const HLJS_CSS_URL = "https://cdn.jsdelivr.net/npm/highlight.js@11.8.0/styles/base16/solar-flare-light.css";
8
9export default function Head({ title, post }: {
10 title: string;
11 post?: BlogPost;

blogget-posts.ts1 match

@fil•Updated 1 day ago
4
5// Get all blog posts (local + RSS)
6export async function getAllBlogPosts(): Promise<BlogPost[]> {
7 return (await Promise.all([
8 getNewPosts(),

blogget-old-posts.ts2 matches

@fil•Updated 1 day ago
4const OLD_BLOG_RSS = "https://val-town-blog.pages.dev/rss.xml";
5// Get blog posts from RSS feed
6async function getOldPosts(): Promise<BlogPost[]> {
7 const parser = new RssParser();
8 const feed = await parser.parseURL(OLD_BLOG_RSS);
289 "slug": "deprecating-the-run-api",
290 "link": "/blog/deprecating-the-run-api",
291 "description": "Not every function should be an API",
292 "pubDate": "Wed, 07 Feb 2024 00:00:00 GMT",
293 "author": "André Terron",

blogget-new-posts.ts2 matches

@fil•Updated 1 day ago
5
6// Get all blog posts from the file system
7export async function getNewPosts(): Promise<BlogPost[]> {
8 const files = await listFiles(import.meta.url);
9 const blogPostFiles = files.filter(
42
43// Get a single blog post by slug
44export async function getBlogPostBySlug(slug: string): Promise<BlogPost | null> {
45 const post = posts.find(post => post.slug.includes(slug));
46 return post;

blogFooter.tsx1 match

@fil•Updated 1 day ago
5const year = new Date().getFullYear();
6
7export default function Footer () {
8 return (
9 <footer className="container">

getFileEmail4 file matches

@shouser•Updated 2 weeks 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
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.