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=700&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 7186 results for "function"(468ms)

statusmonitor1 match

@hodge•Updated 2 months ago
7);
8
9export async function uptimeCheck(url: string) {
10 let reason: string, status: number, end: number;
11 let ok = true;
1import { getImages } from "./image_manager";
2
3export default async function server(request: Request): Promise<Response> {
4 const url = new URL(request.url);
5 if (request.method === "GET" && url.pathname === "/image") {
GitHubSync

GitHubSynccommit-files2 matches

@jxnblk•Updated 2 months ago
18
19/**
20 * General use function to commit files to GitHub
21 */
22export async function commitFiles({
23 token,
24 owner,
GitHubSync

GitHubSyncsign-webhook1 match

@jxnblk•Updated 2 months ago
1/**
2 * Use this function along with your valtown webhook secret to create
3 * the x-val-signature header when posting to the /export webhook
4 */

codemirrorTsdemo2 matches

@maxm•Updated 2 months ago
2import { renderToString } from "npm:react-dom/server";
3import { importMap } from "./importMap";
4export default async function(req: Request): Promise<Response> {
5 const u = new URL(req.url);
6
33let hasAnError: string = 10;
34
35function increment(num: number) {
36 return num + 1;
37}

allTheFrontendBackendPatternshttp1 match

@maxm•Updated 2 months ago
2import { renderToString } from "npm:react-dom/server";
3let counter = 0;
4export default async function(req: Request): Promise<Response> {
5 return new Response(
6 renderToString(

charmainesStatusstatus3 matches

@charmaine•Updated 2 months ago
6import { SparklineSVG } from "./sparklineSVG";
7
8function StatusRow({ rows }) {
9 return (
10 <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",

allTheFrontendBackendPatternshttp3 matches

@maxm•Updated 2 months ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function Counter() {
6 const [count, setCount] = useState(4);
7
15}
16
17function client() {
18 createRoot(document.getElementById("root")).render(<Counter />);
19}
23}
24
25export default function server(request: Request): Response {
26 return new Response(
27 `

charmainesStatusnotify1 match

@charmaine•Updated 2 months 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}

allTheFrontendBackendPatternsfrontend.ts1 match

@maxm•Updated 2 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [count, setCount] = useState(4);
7 return (

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago