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/$2?q=function&page=8&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 24048 results for "function"(1817ms)

Fairstatus3 matches

@canstralian•Updated 6 hours ago
9const thisURL = parseProject(import.meta.url).links.self.project;
10
11function StatusRow({ rows }) {
12 return (
13 <div className="w-full flex flex-col space-y-2">
31}
32
33function StatusSection({ url, rows }) {
34 const sectionRows = rows.filter(row => row[0] === url);
35 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
47}
48
49export default async function(req: Request): Promise<Response> {
50 const { rows } = await sqlite.execute(
51 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

FairsparklineSVG1 match

@canstralian•Updated 6 hours 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;

Fairnotify1 match

@canstralian•Updated 6 hours ago
4const thisURL = parseProject(import.meta.url).links.self.latest;
5
6export async function notify(message: string) {
7 await email({ subject: message, text: `Email sent from ${thisURL}` });
8}

Fairmonitor1 match

@canstralian•Updated 6 hours ago
9const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
10
11export async function uptimeCheck(url: string, attempt = 1) {
12 let reason: string = "";
13 let status: number | null = null;

GlancerdemoCache.ts1 match

@lightweight•Updated 7 hours ago
11// this cron updates a blob that the ../../shared/utils/pollEnabledStatus.ts hits during demos
12// that blob determines whether or not the cobrowsing button is ON or OFF
13export default async function (interval: Interval) {
14 // every page in the "Glancer demo" database should have it's own blob, so we have a cache for each demo
15 // this cron saves a blob for every page in the Demos DB

webscrapeBareBonesTikimain.tsx1 match

@eczajk•Updated 7 hours ago
3import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
4
5function isHTMLElement(node: Node): node is HTMLElement {
6 return node.nodeType === Node.ELEMENT_NODE;
7}

ChatMessage.tsx3 matches

@c15r•Updated 7 hours ago
19}
20
21export default function MessageComponent({ message }: MessageProps) {
22 const [expandedSections, setExpandedSections] = useState<Set<string>>(new Set());
23
152
153 // Detect tool calls
154 if (line.includes('tool_use') || line.includes('function_call')) {
155 try {
156 // Try to parse as JSON
170
171 // Detect tool results
172 if (line.includes('tool_result') || line.includes('function_result')) {
173 try {
174 const resultData = JSON.parse(line);

untitled-2795main.tsx1 match

@notpickard•Updated 7 hours ago
1import axios from "axios";
2async function fetchUsers() {
3 try {
4 const response = await axios.get("https://jsonplaceholder.typicode.com/users");

endpointsget_vals_endpoints.tsx1 match

@chadparker•Updated 7 hours ago
1export default async function(req: Request) {
2 try {
3 const apiKey = Deno.env.get("VALTOWN_API_TOKEN");

saulyteindex.tsx1 match

@laurynas•Updated 8 hours ago
40}
41
42function App() {
43 const [weatherData, setWeatherData] = useState<WeatherData | null>(null);
44 const [location, setLocation] = useState<Location | null>(null);

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month 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.