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/$%7BsvgDataUrl%7D?q=function&page=2&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 33601 results for "function"(3099ms)

Linear-to-Slack-Remindermain.ts1 match

@juancrossmint•Updated 1 hour ago
10import handleModalSubmit from "./slack/modalSubmit.ts";
11
12export default async function main(req: Request) {
13 const url = new URL(req.url);
14

Linear-to-Slack-ReminderlinearApi.ts2 matches

@juancrossmint•Updated 1 hour ago
8});
9
10export async function getLinearTicket(ticketId: string): Promise<LinearIssue> {
11 const query = `
12 query IssueWithChildren($id: String!) {
69}
70
71export function extractTicketId(input: string): string {
72 // Handle Linear URLs like https://linear.app/team/issue/TEAM-123
73 const urlMatch = input.match(/([A-Z]+-\d+)/);

Linear-to-Slack-Reminderdatabase.ts8 matches

@juancrossmint•Updated 1 hour ago
2import { Reminder } from "./types.ts";
3
4export async function initDatabase() {
5 await sqlite.execute(`
6 CREATE TABLE IF NOT EXISTS reminders (
21}
22
23export async function createReminder(reminder: Omit<Reminder, 'id'>): Promise<number> {
24 const result = await sqlite.execute({
25 sql: `
47
48// Map SQLite row arrays to Reminder objects so it's cleaner to read
49function rowToReminder(row: any[]): Reminder {
50 return {
51 id: row[0],
63}
64
65export async function getActiveReminders(): Promise<Reminder[]> {
66 const result = await sqlite.execute("SELECT * FROM reminders WHERE active = 1");
67 return result.rows.map(rowToReminder);
68}
69
70export async function updateReminder(
71 id: number,
72 updates: Partial<Reminder>
82}
83
84export async function getRemindersByCreator(creatorId: string): Promise<Reminder[]> {
85 const result = await sqlite.execute({
86 sql: "SELECT * FROM reminders WHERE creator_slack_id = ? AND active = 1",
91}
92
93export async function getAllRemindersByCreator(creatorId: string): Promise<Reminder[]> {
94 const result = await sqlite.execute({
95 sql: "SELECT * FROM reminders WHERE creator_slack_id = ?",
99}
100
101export async function clearAllReminders(): Promise<void> {
102 await sqlite.execute("UPDATE reminders SET active = 0");
103}

Linear-to-Slack-Remindercron.ts4 matches

@juancrossmint•Updated 1 hour ago
21 * Orchestrates the daily reminder check. This is the main cron entrypoint.
22 */
23export default async function checkReminders() {
24 const TESTING = true; // TODO: change this to false to put this into production
25
55}
56
57function shouldProcessReminder(
58 reminder: Reminder,
59 now: Date,
67}
68
69function buildSummary(
70 runTimestamp: string,
71 totalChecked: number,
80}
81
82async function processReminder(reminder: Reminder): Promise<number> {
83 console.log(`\n --- Processing ${reminder.ticket_title} ---`);
84

orismain.tsx6 matches

@solomonferedeezez•Updated 2 hours ago
34};
35
36// Utility function for password hashing
37async function hashPassword(password: string): Promise<string> {
38 const encoder = new TextEncoder();
39 const data = encoder.encode(password);
45
46// Main App Component
47function App() {
48 const [user, setUser] = useState<any>(null);
49 const [view, setView] = useState("home");
1596
1597// Client-side rendering
1598function client() {
1599 const rootElement = document.getElementById("root");
1600 if (rootElement) {
1609}
1610
1611// Server-side functions
1612export default async function server(request: Request) {
1613 try {
1614 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");

Sonarfarcaster.ts3 matches

@moe•Updated 2 hours ago
8// export const ogImageUrl = "https://imgur.com/xKVOVUE.png";
9
10export function embedMetadata(baseUrl: string, path: string = '/') {
11 return {
12 version: 'next',
25}
26
27export function handleFarcasterEndpoints(app: Hono) {
28 app.get('/.well-known/farcaster.json', (c) => {
29 const baseUrl = c.req.url.replace(c.req.path, '')
84const decodeBase64Json = (str: string) => JSON.parse(Buffer.from(str, 'base64').toString('utf-8'))
85
86async function sendWelcomeNotification(fid: number, baseUrl: string) {
87 return await sendNotificationToUser(fid, {
88 title: name + ' installed!',

FarcasterSpacesfarcaster.ts3 matches

@moe•Updated 2 hours ago
7// export const ogImageUrl = "https://imgur.com/oLCWKFI.png";
8
9export function embedMetadata(baseUrl: string, path: string = '/') {
10 const channel = path?.startsWith('/space/') ? path.replace('/space/', '') : ''
11 return {
25}
26
27export function handleFarcasterEndpoints(app: Hono) {
28 app.get('/.well-known/farcaster.json', (c) => {
29 const baseUrl = c.req.url.replace(c.req.path, '')
81const decodeBase64Json = (str: string) => JSON.parse(Buffer.from(str, 'base64').toString('utf-8'))
82
83async function sendWelcomeNotification(fid: number, baseUrl: string) {
84 return await sendNotificationToUser(fid, {
85 title: `Welcome to ${name}!`,

SonarApp.tsx2 matches

@moe•Updated 2 hours ago
13import { ChannelScreen, ChannelFeed, ChannelDebug, ChannelMedia, ChannelStats } from './screens/ChannelScreen.tsx'
14
15export function App() {
16 const [context, setContext] = useState<any>()
17 useEffect(() => {
73}
74
75function About() {
76 return (
77 <Section className="flex flex-col items-start gap-3 m-5">

Sonarui.tsx14 matches

@moe•Updated 2 hours ago
4import { useParams, Outlet, NavLink } from 'https://esm.sh/react-router@7'
5
6export function Section({ children, ...props }: any) {
7 const sectionClass = `p-5 rounded-3xl bg-neutral-400/15 ${props.className || ''}`
8 return <div className={sectionClass}>{children}</div>
94}
95
96// export function Input(props: any) {
97// const inputClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
98// return <input class={inputClass} {...props} />;
99// }
100
101// export function Button(props: any) {
102// const buttonClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
103// return <button class={buttonClass} {...props} />;
104// }
105
106export function MonoButton(props: any) {
107 return (
108 <Button {...props}>
112}
113
114export function MonoButtonWithStatus(props: any) {
115 const [status, setStatus] = useState<any>()
116 const handleClick = async () => {
133}
134
135export function Separator({ className = '' }) {
136 return <div className={`border-b border-neutral-400/25 ${className}`}></div>
137}
138
139export function PaddedSpinner() {
140 return (
141 <div className="flex flex-row items-center justify-center p-4 opacity-50 h-32">
145}
146
147export function PaddedError({ message }) {
148 return (
149 <div className="flex flex-row items-center justify-center p-4 opacity-50 h-32">
153}
154
155export function StatsRows({ stats }) {
156 return (
157 <div className="flex flex-col ">
169}
170
171export function Debug({ data, className = '' }) {
172 return <pre className={'whitespace-pre-wrap break-all text-xs ' + className}>{JSON.stringify(data, null, 2)}</pre>
173}
174
175export function NavTabs({ navLinks }) {
176 return (
177 <>
198//////////
199
200export function formatJSON(json: any) {
201 return JSON.stringify(json, null, 2)
202}
226}
227
228export function BackButton({}) {
229 return <ArrowLeft className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={() => (window.location.href = '/')} />
230}
231
232export function ShareButton({ onClick }) {
233 return <Share className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={onClick} />
234}

reactHonoStarterApp.tsx1 match

@dhrv•Updated 2 hours ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (

discordWebhook2 file matches

@stevekrouse•Updated 6 days ago
Helper function to send Discord messages
tuna

tuna9 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.