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/$2?q=function&page=2461&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 28557 results for "function"(8766ms)

aqimain.tsx1 match

@amoeba•Updated 9 months ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "seattle, wa"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

zillowScrapermain.tsx1 match

@rochambeau314•Updated 9 months ago
6import cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
7
8export default async function server(request: Request): Promise<Response> {
9 const url = new URL(request.url);
10 const zillowUrl = url.searchParams.get("url");

craigslistScrapermain.tsx3 matches

@rochambeau314•Updated 9 months ago
7import { createRoot } from "https://esm.sh/react-dom/client";
8
9function App() {
10 const [url, setUrl] = useState('');
11 const [listing, setListing] = useState(null);
59}
60
61function client() {
62 createRoot(document.getElementById("root")).render(<App />);
63}
65if (typeof document !== "undefined") { client(); }
66
67async function server(request: Request): Promise<Response> {
68 const url = new URL(request.url);
69 const cheerio = await import("https://esm.sh/cheerio@1.0.0-rc.12");

adorableRedChameleonREADME.md1 match

@jamisonl•Updated 9 months ago
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality

emailmain.tsx1 match

@aroyan•Updated 9 months ago
12 * The email address(es) to send the email to. Only available to Val Town Pro subscribers.
13 * Can be a single string, IAddress object, or an array of strings/IAddress objects.
14 * @default the email of the logged user calling this function.
15 */
16 to?: (IAddress | string)[] | IAddress | string;

ruralCrimsonGuppymain.tsx3 matches

@jamisonl•Updated 9 months ago
22const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_BOT_TOKEN);
23
24async function findUserVoiceChannel(guildId, userId) {
25 try {
26 const channels = await rest.get(Routes.guildChannels(guildId));
39}
40
41async function sayMessage(guildId, channelId, message) {
42 const url = googleTTS.getAudioUrl(message, {
43 lang: "en",
68}
69
70function createDiscordJSAdapter(channelId, guildId) {
71 return {
72 sendPayload: (payload) => {

ruralCrimsonGuppyREADME.md1 match

@jamisonl•Updated 9 months ago
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality

valTopicGenmain.tsx3 matches

@roramigator•Updated 9 months ago
89];
90
91async function getCurrentTopic() {
92 const storedTopic = await blob.getJSON("currentTopic");
93 if (storedTopic && new Date(storedTopic.expiresAt) > new Date()) {
105}
106
107function TopicDisplay({ topic, expiresAt }) {
108 const expirationDate = new Date(expiresAt);
109 const timeRemaining = expirationDate - new Date();
130}
131
132export default async function server(req: Request): Promise<Response> {
133 const currentTopic = await getCurrentTopic();
134 const { renderToString } = await import("https://esm.sh/react-dom/server");

luciaValtownSqlitemain.tsx8 matches

@yawnxyz•Updated 9 months ago
236}
237
238function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
239 const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
240 return {
246}
247
248function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
249 const { id, ...attributes } = raw;
250 return {
254}
255
256function escapeName(val: string): string {
257 return "`" + val + "`";
258}
259
260// Helper functions
261export async function createTables(userTable: string, sessionTable: string) {
262 return sqlite.batch([
263 `CREATE TABLE IF NOT EXISTS ${userTable} (
277}
278
279export async function createUser({ userTable, sessionTable, username, password, github_id, google_id }: {
280 userTable: string;
281 sessionTable: string;
299}
300
301export async function getUser(
302 { userTable, username, github_id, google_id }: {
303 userTable: string;
330}
331
332export async function verifyPassword(hashed_password: string, password: string): Promise<boolean> {
333 return new Scrypt().verify(hashed_password, password);
334}

stormyCyanLeoponmain.tsx1 match

@stevekrouse•Updated 9 months ago
6 webhook_url: string = process.env.discord_webhook,
7) => {
8 function chunkString(str) {
9 const chunks = [];
10 let startIndex = 0;

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.