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=2476&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 28757 results for "function"(2823ms)

slackScoutmain.tsx10 matches

@ewinney•Updated 9 months ago
15}
16
17export default async function(interval: Interval): Promise<void> {
18 try {
19 await createTable();
38
39// Create an SQLite table
40async function createTable(): Promise<void> {
41 await sqlite.execute(`
42 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
50
51// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53 return hackerNewsSearch({
54 query: topic,
58}
59
60async function fetchTwitterResults(topic: string): Promise<Website[]> {
61 return twitterSearch({
62 query: topic,
67}
68
69async function fetchRedditResults(topic: string): Promise<Website[]> {
70 return redditSearch({ query: topic });
71}
72
73function formatSlackMessage(website: Website): string {
74 const displayTitle = website.title || website.url;
75 return `*<${website.url}|${displayTitle}>*
78}
79
80async function sendSlackMessage(message: string): Promise<Response> {
81 const slackWebhookUrl = Deno.env.get("SLACK_WEBHOOK_URL");
82 if (!slackWebhookUrl) {
104}
105
106async function isURLInTable(url: string): Promise<boolean> {
107 const result = await sqlite.execute({
108 sql: `SELECT 1 FROM ${TABLE_NAME} WHERE url = :url LIMIT 1`,
112}
113
114async function addWebsiteToTable(website: Website): Promise<void> {
115 await sqlite.execute({
116 sql: `INSERT INTO ${TABLE_NAME} (source, url, title, date_published)
120}
121
122async function processResults(results: Website[]): Promise<void> {
123 for (const website of results) {
124 if (!(await isURLInTable(website.url))) {

rssNotifymain.tsx1 match

@squidarth2•Updated 9 months ago
4import RssParser from "npm:rss-parser";
5
6export async function rssNotify() {
7 const lastRunAt = await blob.getJSON(getLegacyImportUrl(import.meta.url));
8 console.log(`Last run: ${lastRunAt || "Never"}`);

smsjournalertextrelaymain.tsx10 matches

@cephalization•Updated 9 months ago
34// this is either broken or textbelt is not sending me the right stuff
35// this is implemented per the textbelt docs but i cant verify the sig...
36function validateTextbeltRequestSignature(
37 apiKey: string,
38 timestamp: string,
52}
53
54// Helper function to send SMS using TextBelt API
55async function sendSMS(phone: string, message: string) {
56 const response = await fetch("https://textbelt.com/text", {
57 method: "POST",
68}
69
70// Helper function to get conversation history
71async function getConversationHistory(phone: string): Promise<Message[]> {
72 const key = makeBlobKey(phone);
73 const history = await blob.getJSON(key) as Message[] | null;
75}
76
77// Helper function to update conversation history
78async function updateConversationHistory(phone: string, message: Message) {
79 const key = makeBlobKey(phone);
80 const history = await getConversationHistory(phone);
83}
84
85// Helper function to generate AI response
86async function generateAIResponse(history: Message[]): Promise<string> {
87 const openai = new OpenAI();
88 const messages: { role: "user" | "assistant" | "system"; content: string }[] = history.map(msg => ({
106}
107
108export default async function server(request: Request): Promise<Response> {
109 const quotaResponse = await fetch(
110 `https://textbelt.com/quota/${textbeltKey}`,

svgEmojimain.tsx1 match

@pomdtr•Updated 9 months ago
1export function svgEmoji(req: Request) {
2 const url = new URL(req.url);
3 const emoji = decodeURIComponent(url.pathname.slice(1));

linkInBioTemplatemain.tsx6 matches

@rasputinkaiser•Updated 9 months ago
5// ... (previous AuthContext, AuthProvider, and useAuth remain the same)
6
7function App() {
8 // ... (App component remains the same)
9}
10
11function Home({ theme }) {
12 const { user } = useAuth();
13 const isDark = theme === 'dark';
51}
52
53function PromptGenerator() {
54 const [prompt, setPrompt] = useState('');
55
80}
81
82function Tools({ theme }) {
83 const isDark = theme === 'dark';
84 const tools = [
102}
103
104function Gallery({ theme }) {
105 const isDark = theme === 'dark';
106 const [filter, setFilter] = useState('all');
209};
210
211// ... (client and server functions remain the same)

finalScrapermain.tsx3 matches

@rochambeau314•Updated 9 months ago
7import { createRoot } from "https://esm.sh/react-dom/client";
8
9function App() {
10 const [link, setLink] = useState("");
11 const [results, setResults] = useState(null);
81}
82
83function client() {
84 createRoot(document.getElementById("root")).render(<App />);
85}
89}
90
91async function server(request: Request): Promise<Response> {
92 if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {
93 const { link } = await request.json();

hasWebsiteChangedmain.tsx1 match

@browserbase•Updated 9 months ago
7import slugify from "npm:slugify";
8
9export async function hasWebsiteChanged(url: string, threshold = 0.5) {
10 const slug = slugify(url);
11

httpApiScreenshotPageExamplemain.tsx1 match

@browserbase•Updated 9 months ago
3import Jimp from "npm:jimp";
4
5export async function blobReadPictureExample(request: Request): Promise<Response> {
6 const searchParams = new URL(request.url).searchParams;
7 const url = searchParams.get("url") || "https://www.browserbase.com";

browserbaseUtilsmain.tsx2 matches

@browserbase•Updated 9 months ago
5}
6
7export async function loadPageContent(url: string, options: LoadPageContentOptions = { textContent: false }) {
8 const browser = await puppeteer.connect({
9 browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
33}
34
35export async function screenshotPage(url: string, options: ScreenshotPageOptions = { fullPage: true }) {
36 const browser = await puppeteer.connect({
37 browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,

websiteChangeDetectionToolmain.tsx1 match

@browserbase•Updated 9 months ago
2import { email } from "https://esm.town/v/std/email?v=12";
3
4export default async function(interval: Interval) {
5 const bbLandingChanged = await hasWebsiteChanged("https://www.browserbase.com");
6 console.log("bbLandingChanged", bbLandingChanged);

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.