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/$%7Burl%7D?q=function&page=2078&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 22487 results for "function"(2466ms)

sqlite_migrationsmain.tsx2 matches

@saolsen•Updated 1 year ago
12};
13
14export async function migrate(migrations) {
15 console.log("Running Migrations");
16 await sqlite.execute(`
52}
53
54export async function undo(migrations) {
55 console.log("Undoing Migrations");
56 await sqlite.execute(`

twitterAlertmain.tsx2 matches

@buttondown•Updated 1 year ago
6const query = "buttondown";
7
8export async function twitterSearch({
9 query,
10 start_time,
52}
53
54export default async function twitterAlert({ lastRunAt }: Interval) {
55 const results = await twitterSearch({
56 query,

basicAuthmain.tsx5 matches

@stevekrouse•Updated 1 year ago
1function extractToken(authorization) {
2 const parts = authorization.split(" ");
3 if (parts[0] == "Bearer") {
18};
19
20async function fetchUser(token: string): Promise<User> {
21 const resp = await fetch("https://api.val.town/v1/me", {
22 headers: {
32}
33
34async function isTokenValid(token) {
35 try {
36 const [visitor, owner] = await Promise.all([fetchUser(token), fetchUser(Deno.env.get("valtown"))]);
41}
42
43async function isRequestAuthenticated(req) {
44 if (!req.headers.has("authorization")) {
45 return false;
50}
51
52export function basicAuth(next: (Request) => Response | Promise<Response>) {
53 return async (req: Request) => {
54 if (req.headers.get("referer") == "https://www.val.town/") {

basicAuthREADME.md1 match

@stevekrouse•Updated 1 year ago
10import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth";
11
12function handler(req: Request) {
13 return new Response("You are authenticated!");
14}

setSFTidbytImagemain.tsx1 match

@squarethecircle•Updated 1 year ago
2import process from "node:process";
3
4export async function setSFTidbytImage({ image, key }: {
5 image: string;
6 key: string;

untitled_amberBedbugmain.tsx1 match

@sreenandm•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

ImgGenmain.tsx1 match

@rayman•Updated 1 year ago
1import { text2png } from "https://esm.town/v/nilslice/libtext2png";
2
3export default async function(req: Request): Promise<Response> {
4 const img = await text2png("Just give me the PNG", "magenta", 30); // returns a `Blob`
5 return new Response(img, {

untitled_jadeMolluskmain.tsx1 match

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

solidExamplemain.tsx1 match

@rayman•Updated 1 year ago
3import { renderToString } from "npm:solid-js/web";
4
5function StlViewer() {
6 return (
7 <StlViewer

favmain.tsx1 match

@yieldray•Updated 1 year ago
3}
4
5export function fav(request: Request) {
6 const url = new URL(request.url);
7 if (url.pathname === "/")

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.