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/image-url.jpg%20%22Optional%20title%22?q=function&page=17&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 18631 results for "function"(2250ms)

forwarderforwarder1 match

@shlmt•Updated 1 day ago
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {

translateToEnglishWithOpenAImain.tsx1 match

@shlmt•Updated 1 day ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function translateToEnglishWithOpenAI(text: string) {
4 const openai = new OpenAI();
5 const completion = await openai.chat.completions.create({
1// Get alphabet image URLs
2export function getAlphabetImageUrls(): Record<string, string> {
3 return {
4 "A": "https://i.imgur.com/POhK1wg.png",

mastodon-pogodanew-file-2457.tsx1 match

@tomasz•Updated 1 day ago
4import { load } from "npm:cheerio";
5
6async function mastodonWeatherMap() {
7 const html = await fetchText("https://www.bankier.pl//gielda/notowania/indeksy-gpw"); // Przykład linku do strony z ETF-ami
8 const $ = load(html);

hn-remote-ts-genai-jobscron.ts4 matches

@prashamtrivedi•Updated 1 day ago
12
13/**
14 * Main cron handler function
15 */
16export default async function() {
17 console.log("🔄 Starting scheduled refresh of HN remote TypeScript + GenAI jobs data");
18
52 * Send a notification email with job results
53 */
54async function sendNotificationEmail(threadId: number, jobCount: number, timestamp: string): Promise<void> {
55 const recipientEmail = Deno.env.get("NOTIFICATION_EMAIL");
56 if (!recipientEmail) return;
110 * Send an error notification email
111 */
112async function sendErrorEmail(errorMessage: string): Promise<void> {
113 const recipientEmail = Deno.env.get("NOTIFICATION_EMAIL");
114 if (!recipientEmail) return;

hn-remote-ts-genai-jobsapi.ts4 matches

@prashamtrivedi•Updated 1 day ago
9 * Main HTTP handler
10 */
11export default async function(req: Request): Promise<Response> {
12 // Get the URL pathname
13 const url = new URL(req.url);
30 * Handle the main jobs page
31 */
32async function handleJobsPage(req: Request): Promise<Response> {
33 // Get the latest results
34 const results = await getLatestResults();
104 * Handle the JSON API endpoint
105 */
106async function handleJobsAPI(req: Request): Promise<Response> {
107 // Get the format parameter
108 const url = new URL(req.url);
146 * Handle the refresh endpoint
147 */
148async function handleRefresh(req: Request): Promise<Response> {
149 try {
150 // Run the job finder

hn-remote-ts-genai-jobsindex.ts9 matches

@prashamtrivedi•Updated 1 day ago
26
27/**
28 * Main function to fetch and process job listings
29 */
30export async function findRemoteTSGenAIJobs(): Promise<{
31 threadId: number;
32 jobs: JobListing[];
73 * Store job results in blob storage
74 */
75async function storeResults(results: {
76 threadId: number;
77 jobs: JobListing[];
91 * Get the latest stored results
92 */
93export async function getLatestResults(): Promise<{
94 threadId: number;
95 jobs: JobListing[];
107 * Format job listings into a readable HTML format
108 */
109export function formatJobListingsHTML(jobs: JobListing[]): string {
110 if (jobs.length === 0) {
111 return "<p>No matching jobs found.</p>";
220 * Format job listings into a readable text format
221 */
222export function formatJobListingsText(jobs: JobListing[]): string {
223 if (jobs.length === 0) {
224 return "No matching jobs found.";
247
248/**
249 * Helper function to escape HTML special characters
250 */
251function escapeHtml(str: string): string {
252 return str
253 .replace(/&/g, "&amp;")
276}
277
278// Make the main function available for import
279export default findRemoteTSGenAIJobs;
280
1/**
2 * Comment Parser
3 * Functions to parse Hacker News comments and filter for job listings
4 */
5
22 * @param text The comment text to check
23 */
24export function hasTypeScriptAndGenAI(text: string): boolean {
25 const lowerText = text.toLowerCase();
26
56 * @param text The comment text to check
57 */
58export function isRemoteJob(text: string): boolean {
59 const lowerText = text.toLowerCase();
60
84 * @param text The comment text
85 */
86export function extractCompany(text: string): string {
87 const companyMatch = text.match(/^([^|]*?)(?=\s*\||\n|$)/);
88 if (companyMatch && companyMatch[1].trim()) {
111 * @param text The comment text
112 */
113export function extractPosition(text: string): string {
114 // Common patterns for job titles in HN threads
115 const positionPatterns = [
135 * @param text The comment text
136 */
137export function extractSkills(text: string): string[] {
138 const lowerText = text.toLowerCase();
139 const skills: string[] = [];
174 * @param text The comment text
175 */
176export function extractLocation(text: string): string {
177 if (isRemoteJob(text)) {
178 // Check for remote with specific regions
216 * @param text The comment text
217 */
218export function extractUrl(text: string): string | undefined {
219 // Look for URLs in the text
220 const urlMatch = text.match(/(https?:\/\/[^\s]+)/);
226 * @param text The comment text
227 */
228export function extractDescription(text: string): string {
229 // Remove HTML tags for clean text
230 const cleanText = text.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
257 * @returns A parsed job listing or null if not a valid job listing
258 */
259export function parseJobListing(comment: HNItem): JobListing | null {
260 if (!comment.text) {
261 return null;
288 * @returns Array of parsed job listings
289 */
290export function filterJobListings(comments: HNItem[]): JobListing[] {
291 const jobListings: JobListing[] = [];
292
1/**
2 * Hacker News API helper functions
3 * Provides utilities to interact with the official Hacker News API
4 */
28 * @returns The item data or null if not found
29 */
30export async function fetchItem(id: number): Promise<HNItem | null> {
31 try {
32 const response = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
46 * @returns An array of comment items
47 */
48export async function fetchComments(storyId: number): Promise<HNItem[]> {
49 const story = await fetchItem(storyId);
50 if (!story || !story.kids || story.kids.length === 0) {
69 * @returns The thread ID or null if not found
70 */
71export async function findLatestWhoIsHiringThread(): Promise<number | null> {
72 try {
73 // First get the user information for "whoishiring" account
105 * This is useful because the thread is typically posted on the first of each month
106 */
107export function getFallbackThreadId(): number {
108 // May 2023 "Who is hiring?" thread ID as a fallback
109 // In a real implementation, you might want to update this periodically

hn-remote-ts-genai-jobsREADME.md2 matches

@prashamtrivedi•Updated 1 day ago
17
18- `backend/index.ts` - Main script that orchestrates the entire process
19- `backend/hackerNewsApi.ts` - Functions to interact with the Hacker News API
20- `backend/commentParser.ts` - Functions to parse and filter job listings
21
22## View Results

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 2 weeks 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.