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=13&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 30512 results for "function"(1769ms)

gissue-rolodexApp.tsx2 matches

@cricks_unmixed4u•Updated 1 day ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4console.log("useState", typeof useState); // should be 'function'
5
6
7export default function App(): React.JSX.Element {
8 const [refreshFrequency, setRefreshFrequency] = useState("");
9 const [isSubmitting, setIsSubmitting] = useState(false);

mcp-starterREADME.md1 match

@nbbaier•Updated 1 day ago
31
32The MCP TypeScript SDK uses Node-specific APIs that don't play nicely with Deno
33or edge functions:
34
35- https://github.com/modelcontextprotocol/typescript-sdk/issues/260

mcp-servermain.ts13 matches

@joshbeckman•Updated 1 day ago
32};
33
34function postFilter(post: Post) {
35 return post.type == "post" || post.type == "page";
36}
37
38function buildTagsIndex(tags: Array<Tag>) {
39 return lunr(function() {
40 this.ref("id");
41 this.field("name");
50 });
51}
52function search(input: string, index: lunr.Index, searchData: Record<string, Post>) {
53 let results = index.search(input);
54
55 if ((results.length == 0) && (input.length > 2)) {
56 let tokens = lunr.tokenizer(input).filter(function(token, i) {
57 return token.str.length < 20;
58 });
59
60 if (tokens.length > 0) {
61 results = index.query(function(query) {
62 query.term(tokens, {
63 editDistance: Math.round(Math.sqrt(input.length / 2 - 1)),
90}
91
92function searchTags(input: string, index: lunr.Index, tags: Array<Tag>) {
93 let results = index.search(input);
94
95 if ((results.length == 0) && (input.length > 2)) {
96 let tokens = lunr.tokenizer(input).filter(function(token, i) {
97 return token.str.length < 20;
98 });
99
100 if (tokens.length > 0) {
101 results = index.query(function(query) {
102 query.term(tokens, {
103 editDistance: Math.round(Math.sqrt(input.length / 2 - 1)),
116 });
117}
118function formatPage(page: Post) {
119 return [
120 `# [${page.title}](${SITE_URL + page.url})`,
135}
136
137function extractPostCategory(post: Post) {
138 if (post.type == "page") {
139 return "page";
160 * Uses a cached instance if available
161 */
162async function setupMcpServer(): Promise<McpServer> {
163 // Return cached instance if available
164 if (mcpServerInstance) {
498
499/**
500 * Val.town handler function for HTTP requests
501 * This will be exposed as a Val.town HTTP endpoint
502 */

untitled-8413index.html1 match

@chadparker•Updated 1 day ago
37 import { createRoot } from 'https://esm.sh/react-dom@18.2.0/client';
38
39 function App() {
40 const [vals, setVals] = useState([]);
41 const [loading, setLoading] = useState(true);

GlancerblobKeyForDemoCache.ts1 match

@lightweight•Updated 1 day ago
1export async function blobKeyForDemoCache(id: string) {
2 // get the url of this file
3 // we'll use this to get values for the blob key

untitled-6415main.ts1 match

@joshbeckman•Updated 1 day ago
12const FAST_MODEL = 'claude-3-5-haiku-latest';
13
14export default async function handler(request: Request) {
15 if (request.method !== "POST") {
16 return Response.json({ message: "This endpoint responds to POST requests." }, {
EnhancedVNode

EnhancedVNodevnode.js5 matches

@Teddy2100•Updated 1 day ago
7 this._createElement = createElement;
8
9 // Initialize goober with prefixing and bind the render function
10 setup(this._vnode.bind(this), prefix);
11
12 // Return the bound render function with attached helpers
13 return Object.assign(this._vnode.bind(this), {
14 toStyleObject: this.toStyleObject.bind(this),
33 // Registers a plugin that mutates props before rendering
34 plugin(fn) {
35 if (typeof fn !== "function") {
36 throw new TypeError("[EnhancedVNode] plugin must be a function");
37 } else {
38 this._plugins.push(fn);
96 }
97
98 // Core render function that normalizes props, applies plugins, and returns a VNode
99 _vnode(type, props, children) {
100 props = this._normalizeProps(props, children);

invest-trackercrypto_cron.tsx1 match

@samxii777•Updated 1 day ago
6const SHEET = Deno.env.get("GSHEET")!;
7
8export default async function handler() {
9 const data: Record<string, any> = {};
10

invest-trackercrypto_low_daily.tsx1 match

@samxii777•Updated 1 day ago
3import { crypto } from "./ticker_config.tsx";
4
5export default async function daily() {
6 const lows: Record<string, number> = {};
7
3 *
4 * This is the HTTP entry point for the ValTown MCP Server when deployed
5 * on ValTown itself. It excludes CLI-dependent functionality and uses
6 * header-based authentication with Hono and StreamableHTTPServerTransport.
7 */
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.