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=805&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 10292 results for "function"(583ms)

parseImportMetaval1 match

@std•Updated 2 months ago
14
15// adapted from https://www.val.town/v/pomdtr/extractValInfo
16export function parseVal(url: string | URL): Val {
17 const { pathname, search } = new URL(url);
18 const [username, filename] = pathname.split("/").slice(-2);
GitHubSync

GitHubSyncgithub-push1 match

@jxnblk•Updated 2 months ago
12const valtown = new ValTown();
13
14export default async function GitHubPush(c: Context) {
15 // auth check in /index
16 const user = await valtown.me.profile.retrieve();
status

statussparklineSVG1 match

@stevekrouse•Updated 2 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;
GitHubSync

GitHubSynchome1 match

@jxnblk•Updated 2 months ago
4import type { Context } from "npm:hono";
5
6export default async function(c: Context) {
7 return c.html(
8 <html>

extractProjectValInfomain.tsx1 match

@maxm•Updated 2 months ago
7}
8
9export function extractProjectValInfo(url: string): ProjectInfo {
10 const pattern = /^https:\/\/esm\.town\/v\/([^/]+)\/([^@]+)@(\d+)-(.+?)(\/.*)?$/;
11 const match = url.match(pattern);

mcpExampleechoMCP1 match

@justbe•Updated 2 months ago
41);
42
43export default async function(req: Request): Promise<Response> {
44 const path = new URL(req.url).pathname;
45 let transport: SSEServerTransport;

NeuralCanvasmain.tsx1 match

@toowired•Updated 2 months ago
3import { handleApiRequest } from 'https://esm.town/v/@username/NeuralCanvas/api';
4
5export default async function server(request: Request): Promise<Response> {
6 const url = new URL(request.url);
7

Which_Jacketmain.tsx1 match

@saltcod•Updated 2 months ago
2import { getWeather } from "https://esm.town/v/stevekrouse/getWeather?v=2";
3
4export default async function(interval: Interval) {
5 let weather = await getWeather("St. John's, NL");
6 let temperature = weather.current_condition[0].FeelsLikeC;

SethGodinBlogEmailmain.tsx1 match

@saltcod•Updated 2 months ago
1import { email } from "https://esm.town/v/std/email";
2
3export default async function (interval: Interval) {
4 try {
5 const response = await fetch("https://seths.blog/feed/");

emailSummaryHandlermain.tsx2 matches

@saltcod•Updated 2 months ago
4import { OpenAI } from "npm:openai";
5
6function stripHtmlBackticks(html: string): string {
7 return html.replace(/^```html\n?/, "").replace(/\n?```$/, "");
8}
9
10export default async function(e: Email) {
11 const openai = new OpenAI();
12 console.log(`from: ${e.from} to: ${e.to} subject: ${e.subject}, cc: ${e.cc}, bcc: ${e.bcc}`);

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago