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=21&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 19135 results for "function"(1097ms)

ValTownForNotionresets1 match

@siaa•Updated 1 day ago
7});
8
9export default async function(interval: Interval) {
10 const subdomain = "valtownfornotion";
11 const items = await blob.list(subdomain);

ValTownForNotionnotionHelpers.ts20 matches

@siaa•Updated 1 day ago
7});
8
9export async function createDatabasePagesParallel(databaseId: string, pages: []) {
10 const creations = pages.map((page) =>
11 notion.pages.create({
43
44// delete all database rows
45export async function deleteAllDatabasePagesParallel(databaseId: string) {
46 const pageIds = await notion.databases.query({
47 database_id: databaseId,
59}
60
61export async function getDatabaseId(databaseTitle: string) {
62 // getDatabaseId(databaseTitle)
63 const database = await notion.databases
66}
67
68export async function getDatabaseTitle(databaseId: string) {
69 // getDatabaseTitle(databaseId)
70 const database = await notion.databases.retrieve({ database_id: databaseId });
73}
74
75export async function getDatabaseParentPageId(databaseId: string) {
76 let currentBlockId = databaseId;
77
98}
99
100export async function getCalloutProperties(askingFor: string) {
101 const blockProperties = (askingFor != "val.town")
102 ? {
121}
122
123export async function findChildDatabaseBlocks(rootBlockId: string, blockIdentifier: string) {
124 const matchingBlocks = [];
125
126 async function searchBlock(blockId) {
127 const res = await notion.blocks.children.list({ block_id: blockId });
128
165}
166
167export async function findCalloutBlocks(rootBlockId: string, blockIdentifier: string) {
168 const matchingBlocks = [];
169
170 async function searchBlock(blockId) {
171 const res = await notion.blocks.children.list({ block_id: blockId });
172
200}
201
202export async function getBostonTime() {
203 const now = new Date();
204
213}
214
215export async function listChildrenChildPages(blockId: string) {
216 try {
217 const response = await notion.blocks.children.list({
229}
230
231export async function addFavicon(data?: any) {
232 const pageId = data?.id;
233 // use notion if nothing if the URL property is empty
234 const url = await getWebhookPropertyValue(data, "Website") || "notion.com";
235 // send the URL value to the function that will get the site's favicon location
236 const faviconURL = await helpers.scrapeFaviconUrl(url);
237 console.log({ "Verified favicon URL": faviconURL });
242}
243
244export async function setPageStatus(object: any) {
245 const { data, section, step } = object;
246 const pageId = data?.id;
282}
283
284export async function updatePageIcon(pageId: string, faviconURL?: string) {
285 try {
286 const response = await notion.pages.update({
302}
303
304export async function listChildren(pageId: string) {
305 // get page properties
306 try {
318}
319
320// Helper function to get property value from webhook payload
321export async function getWebhookPropertyValue(payload: any, propertyName: any) {
322 let result = null;
323 // check to see if the whole payload was sent, or just the data object
357}
358
359export async function getNotionPage(pageId: string) {
360 // get page properties
361 try {

ValTownForNotionhelpers.ts5 matches

@siaa•Updated 1 day ago
1export async function setBlobKey(object: any) {
2 const { slug, clientPageId, containerId } = object;
3 const blobKey = [ // key_legend: "[subdomain]--[id of guest page]--[id of container to be reset]",
11}
12
13export async function slugify(str: string) {
14 // const containerTitleSlug = (await helpers.setContainerTitle(c.req.headers.get("x-container-title"))).split(" ").join("-");
15 return (str.replace(/[^\w\s]|_/g, "").replace(/\s+/g, " ").trim().toLowerCase()).split(" ").join("-");
16}
17
18// Function to scrape favicon URL from a website
19export async function scrapeFaviconUrl(url: string) {
20 try {
21 // Ensure URL has protocol
75}
76
77export async function extractCamelCaseWords(str: string) {
78 if (!str) return [];
79

ValTownForNotionexample-database-pages.ts1 match

@siaa•Updated 1 day ago
58
59 // if the blob exists that maps to this callout for this user, use the id property inside it
60 // otherwise call the function to find the id of the callout for this user
61 // const blockId = blobject // if therre's a blob, then this isn't the first call
62 // ? blobject.id // use the id in the blob to speed up subsequent calls

blog-cloneutil.tsx2 matches

@jamiesinclair•Updated 1 day ago
1export function formatDate(dateString: string): string {
2 try {
3 const date = new Date(dateString);
12}
13
14export function dayOfWeek(dateString: string): string {
15 try {
16 return new Date(dateString).toLocaleDateString("en-US", {

blog-cloneSocialLinks.tsx1 match

@jamiesinclair•Updated 1 day ago
2import { BlueskyIcon, DiscordIcon, GitHubIcon, RSSIcon, TwitterIcon } from "./icons.tsx";
3
4export default function SocialLinks() {
5 return (
6 <div className="social-links">

blog-clonerender-markdown.ts1 match

@jamiesinclair•Updated 1 day ago
10
11// Process markdown content
12export async function processMarkdown(content: string): Promise<string> {
13 const result = await unified()
14 .use(remarkParse)

blog-cloneREADME.md1 match

@jamiesinclair•Updated 1 day ago
31 - **`rss.ts`**: RSS feed generation
32 - **`favicon.ts`** & **`og-image.ts`**: Asset routes
33- **`/utils/`**: Utility functions for post processing, caching, etc.
34- **`/posts/`**: Markdown files for blog posts
35- **`/styles/`**: CSS styling

blog-cloneproxy.ts1 match

@jamiesinclair•Updated 1 day ago
5const OLD_BLOG_URL = "https://val-town-blog.pages.dev/";
6
7export async function proxyHonoRequest(c: any) {
8 const url = new URL(c.req.url);
9

blog-cloneOGImage.tsx1 match

@jamiesinclair•Updated 1 day ago
4const LINE_HEIGHT = 72;
5
6export default function OGImage({
7 title = "Val Town Blog",
8 ...props

getFileEmail4 file matches

@shouser•Updated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",