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=1344&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 18515 results for "function"(2432ms)

isMyWebsiteDownmain.tsx1 match

@amitron•Updated 5 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;

sqliteExplorerAppREADME.md1 match

@janniks•Updated 5 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

labLoginmain.tsx1 match

@svenlaa•Updated 5 months ago
3import { sqlite } from "https://esm.town/v/std/sqlite";
4
5export default async function(req: Request): Promise<Response> {
6 const body = await req.json();
7 let { username, password } = body;

uptimemain.tsx1 match

@sophie•Updated 5 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let reason: string, status: number, end: number;
10 let ok = true;

statusmain.tsx3 matches

@sophie•Updated 5 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

labLoginUpdateStatusmain.tsx1 match

@svenlaa•Updated 5 months ago
3import { sqlite } from "https://esm.town/v/std/sqlite";
4
5export default async function(req: Request): Promise<Response> {
6 const TABLE_NAME = "lab_login_users_with_times";
7 const body = await req.json();

labLoginDeleteAccountmain.tsx1 match

@svenlaa•Updated 5 months ago
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4export default async function(req: Request): Promise<Response> {
5 const TABLE_NAME = "lab_login_users_with_times";
6 const body = await req.json();

CDS_Countermain.tsx9 matches

@toowired•Updated 5 months ago
33let model;
34
35async function loadModel() {
36 model = await cocoSsd.load();
37}
39loadModel();
40
41self.onmessage = async function(e) {
42 if (!model) {
43 await loadModel();
56const worker = new Worker(workerUrl);
57
58export default async function server(request: Request): Promise<Response> {
59 if (request.method === "POST") {
60 try {
139}
140
141// Helper function to map detected objects to acceptable container types
142function mapToAcceptableContainer(detectedClass) {
143 const lowerClass = detectedClass.toLowerCase();
144 if (lowerClass.includes("bottle")) return "plastic bottle";
149}
150
151// Cleanup function to revoke the worker URL when the val is unloaded
152globalThis.addEventListener("unload", () => {
153 URL.revokeObjectURL(workerUrl);
155
156// Implementation of sendNotification
157async function sendNotification(message) {
158 try {
159 // Using Val Town's email functionality:
160 await email.send({
161 to: 'your_email@example.com', // Replace with your email
172
173// Implementation of logDetection
174async function logDetection(containers) {
175 try {
176 const timestamp = new Date().toISOString();

rss_feed_ai_analysismain.tsx3 matches

@vip•Updated 5 months ago
28}
29
30function App() {
31 const [keys, setKeys] = useState<string[]>([]);
32 const [selectedFeed, setSelectedFeed] = useState<RSSFeed | null>(null);
143}
144
145function client() {
146 createRoot(document.getElementById("root")).render(<App />);
147}
151}
152
153export default async function server(request: Request): Promise<Response> {
154 const { blob } = await import("https://esm.town/v/std/blob");
155 const url = new URL(request.url);

LSDisolatedCodemain.tsx1 match

@willthereader•Updated 5 months ago
1export async function extractLinksFromUrl(url) {
2 const query = `SELECT a AS title, a@href AS url FROM ${url} GROUP BY a`;
3 try {

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.