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=1620&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 18323 results for "function"(1194ms)

turquoisePiranhamain.tsx1 match

@hmy•Updated 1 year ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

jsonBodyParsingmain.tsx1 match

@tmcw•Updated 1 year ago
1export default async function handler(request: Request) {
2 if (request.method !== "POST") {
3 return Response.json({ message: "This val responds to POST requests." }, {

dateme_notion_syncmain.tsx3 matches

@stevekrouse•Updated 1 year ago
3import { dateMeNotionDatabase } from "https://esm.town/v/stevekrouse/dateMeNotionDatabase";
4
5function jsonifyDoc(doc) {
6 return Object.fromEntries(
7 Object.entries(doc)
13}
14
15function sqlifyDoc(doc) {
16 let keys = Object.keys(doc);
17 let sql = `INSERT INTO DateMeDocs
25}
26
27export default async function sync_dateme_docs() {
28 await sqlite.execute("delete from DateMeDocs");
29

stevekrouse_minimalmain.tsx1 match

@stevekrouse•Updated 1 year ago
8const linkClass = "text-blue-500 hover:underline";
9
10async function getHits() {
11 const [, , { rows: [[allHits]] }, { rows: [[todayHits]] }] = await sqlite.batch([
12 "CREATE TABLE IF NOT EXISTS stevekrouse_com_hits (timestamp DATETIME DEFAULT CURRENT_TIMESTAMP)",

brownBoarmain.tsx1 match

@pomdtr•Updated 1 year ago
1export default function(req) {
2 return new Response("Hello from sandbox");
3}

hono_islandmain.tsx1 match

@pomdtr•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/hono/jsx */
2
3export function Island({
4 src,
5 name,

sqliteBuildermain.tsx1 match

@postpostscript•Updated 1 year ago
84}
85
86export function Statement(
87 strings: TemplateStringsArray,
88 ...replacements: (InValue | StatementInstance)[]

password_authmain.tsx7 matches

@parkerdavis•Updated 1 year ago
11};
12
13async function createSessionTable(tableName: string) {
14 await sqlite.execute(`CREATE TABLE ${tableName} (
15 id TEXT NOT NULL PRIMARY KEY,
19}
20
21async function createSession(tableName: string, valSlug: string): Promise<Session> {
22 try {
23 const expires_at = new Date();
39}
40
41async function getSession(tableName: string, sessionID: string, valSlug: string): Promise<Session> {
42 try {
43 const { rows, columns } = await sqlite.execute({
60}
61
62async function fetchUser(token: string): Promise<{ id: string }> {
63 const resp = await fetch("https://api.val.town/v1/me", {
64 headers: {
74}
75
76async function verifyApiToken(token: string) {
77 try {
78 const [currentUser, requestUser] = await Promise.all([fetchUser(Deno.env.get("valtown")), fetchUser(token)]);
106</html>`;
107
108export function redirect(location: string): Response {
109 return new Response(null, {
110 headers: {
124const cookieName = "auth_session";
125
126export function passwordAuth(next, options?: PasswordAuthOptions) {
127 let passwords: string[];
128 if (!options?.password) {

periodicCertCheckmain.tsx1 match

@agmm•Updated 1 year ago
3import { email } from "https://esm.town/v/std/email";
4
5export default async function(interval: Interval) {
6 const domain = "agmm.xyz";
7 const results = await getCertificates(domain);

viewSourcemain.tsx1 match

@neverstew•Updated 1 year ago
3import { escape } from "npm:html-sloppy-escaper";
4
5export default async function viewSource(req: Request) {
6 const pathname = new URL(req.url).pathname;
7 const html = await fetchText(pathname === "/" ? "example.com" : pathname).then(prettifyHtml);

getFileEmail4 file matches

@shouser•Updated 1 week 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.