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=699&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"(592ms)

valentines_day_card_generatorimage_uploader3 matches

@charmaine•Updated 2 months ago
4import { DATABASE_TABLENAME } from "./constants";
5
6function App() {
7 const [uploadStatus, setUploadStatus] = useState<string>("Drag and drop files here");
8 const [fileUrl, setFileUrl] = useState<string | null>(null);
155}
156
157function client() {
158 createRoot(document.getElementById("root")).render(<App />);
159}
160if (typeof document !== "undefined") { client(); }
161
162export default async function server(request: Request): Promise<Response> {
163 if (request.method === "POST" && new URL(request.url).pathname === "/upload") {
164 const { blob } = await import("https://esm.town/v/std/blob");

statusstatus3 matches

@yawnxyz•Updated 2 months 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",

statussparklineSVG1 match

@yawnxyz•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;

statusnotify1 match

@yawnxyz•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}

statusmonitor1 match

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

GitHubSyncvaltown-deploy6 matches

@jxnblk•Updated 2 months ago
17////
18
19export default async function valTownDeploy(c: Context) {
20 console.log("deploy to valtown");
21 const body = await c.req.json();
45}
46
47async function getContents(repo: Repo, after: string, commits: Commit[]) {
48 const filenames = config.vals.map((name: string) => name + ".tsx");
49 console.log(`${filenames.length} val files updated`);
55}
56
57function getModified(commits: Commit[], filenames: string[]) {
58 return commits.reduce((a: string[], b: Commit) => {
59 return [...a, ...b.modified];
61}
62
63function getFileContent(repo: Repo, after: string) {
64 return async (path: string): Promise<{
65 name: string;
81}
82
83async function updateVals(user: ValUser, updates: { name: string; code: string; }[]) {
84 console.log("updateVals");
85 await Promise.all(updates.map(async (update) => {
88}
89
90async function updateVal(username: string, update: { name: string; code: string; }) {
91 const { name, code } = update;
92 const val = await valtown.alias.username.valName.retrieve(username, name);
status

statusstatus3 matches

@stevekrouse•Updated 2 months 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",

statusstatus3 matches

@hodge•Updated 2 months ago
9const thisURL = parseProject(import.meta.url).links.self.latest;
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",

statussparklineSVG1 match

@hodge•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;

statusnotify1 match

@hodge•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}

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago