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/?q=function&page=6&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 7144 results for "function"(559ms)

simple_moirkdown_blogmain.tsx6 matches

@dcm31•Updated 16 hours ago
7const app = new Hono();
8
9// Function to parse frontmatter from markdown
10function parseMarkdownWithFrontmatter(content: string) {
11 const frontmatterRegex = /^---\n([\s\S]*?)\n---\n/;
12 const match = content.match(frontmatterRegex);
57}
58
59// Function to render a blog post
60function BlogPost({ content, frontmatter }) {
61 // Default values if frontmatter is missing fields
62 const title = frontmatter.title || "Untitled Post";
166 plugins: [
167 tailwind.plugin.withOptions(
168 function (options = {}) {
169 return function ({ addBase, theme }) {
170 const rhythmBase = theme('typography.DEFAULT.css', {});
171 addBase({

atProtoLexiconThingApp.tsx1 match

@wilhelm•Updated 22 hours ago
4import { Agent } from "https://esm.sh/@atproto/api@0.15.5"
5
6export function App({ client, session }: { client: BrowserOAuthClient, session?: OAuthSession }) {
7 const [clicked, setClicked] = useState(0);
8 const [agent] = useState(new Agent(session))

pondiverseupdateTable1 match

@elouan•Updated 23 hours ago
2
3export const TABLE_NAME = "pondiverse_creations_v4";
4export default async function(req: Request): Promise<Response> {
5 await sqlite.execute(
6 `CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (

pondiversegetCreationImage1 match

@elouan•Updated 23 hours ago
1import { blob } from "https://esm.town/v/std/blob";
2
3export default async function(req: Request): Promise<Response> {
4 // url query
5 // ?c=id

pondiversefetchCreations1 match

@elouan•Updated 23 hours ago
3import { TABLE_NAME } from "./updateTable";
4
5export default async function(req: Request): Promise<Response> {
6 // First, get the row IDs of all rows that are older than 25 hours old
7 const res = await sqlite.execute(`

pondiverseaddCreation1 match

@elouan•Updated 23 hours ago
4import { TABLE_NAME } from "./updateTable";
5
6export default async function(req: Request): Promise<Response> {
7 // body contains:
8 // - title (string)

valProfilePageindex.tsx1 match

@dcm31•Updated 1 day ago
10}
11
12function initApp() {
13 const root = document.getElementById("root");
14 if (!root) {

valProfilePageApp.tsx2 matches

@dcm31•Updated 1 day ago
4import { HomePage } from "./HomePage.tsx";
5
6export function App() {
7 const [path, setPath] = useState(window.location.pathname);
8
18 }, []);
19
20 // Navigate function for client-side routing
21 const navigate = (to: string) => {
22 window.history.pushState({}, '', to);

valProfilePageValGrid.tsx1 match

@dcm31•Updated 1 day ago
19}
20
21export function ValGrid({ vals }: ValGridProps) {
22 if (!vals || vals.length === 0) {
23 return (

valProfilePageValGridItem.tsx2 matches

@dcm31•Updated 1 day ago
19}
20
21export function ValGridItem({ val }: ValGridItemProps) {
22 const [imgError, setImgError] = useState(false);
23 const [moiConfig, setMoiConfig] = useState<any>(null);
25 // Create a deterministic background color based on val name
26 const getBackgroundColor = () => {
27 // Simple hash function for generating a color
28 let hash = 0;
29 const str = val.name + val.username;

getFileEmail4 file matches

@shouser•Updated 3 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago