5const { author, name } = extractValInfo(import.meta.url);
67export async function forwarder(e: Email) {
8let attachments: AttachmentData[] = [];
9for (const f of e.attachments) {
1import { OpenAI } from "https://esm.town/v/std/openai";
23export default async function translateToEnglishWithOpenAI(text: string) {
4const openai = new OpenAI();
5const completion = await openai.chat.completions.create({
1// Get alphabet image URLs
2export function getAlphabetImageUrls(): Record<string, string> {
3return {
4"A": "https://i.imgur.com/POhK1wg.png",
4import { load } from "npm:cheerio";
56async function mastodonWeatherMap() {
7const html = await fetchText("https://www.bankier.pl//gielda/notowania/indeksy-gpw"); // Przykład linku do strony z ETF-ami
8const $ = load(html);
hn-remote-ts-genai-jobscron.ts4 matches
1213/**
14* Main cron handler function
15*/
16export default async function() {
17console.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> {
55const recipientEmail = Deno.env.get("NOTIFICATION_EMAIL");
56if (!recipientEmail) return;
110* Send an error notification email
111*/
112async function sendErrorEmail(errorMessage: string): Promise<void> {
113const recipientEmail = Deno.env.get("NOTIFICATION_EMAIL");
114if (!recipientEmail) return;
hn-remote-ts-genai-jobsapi.ts4 matches
9* Main HTTP handler
10*/
11export default async function(req: Request): Promise<Response> {
12// Get the URL pathname
13const url = new URL(req.url);
30* Handle the main jobs page
31*/
32async function handleJobsPage(req: Request): Promise<Response> {
33// Get the latest results
34const results = await getLatestResults();
104* Handle the JSON API endpoint
105*/
106async function handleJobsAPI(req: Request): Promise<Response> {
107// Get the format parameter
108const url = new URL(req.url);
146* Handle the refresh endpoint
147*/
148async function handleRefresh(req: Request): Promise<Response> {
149try {
150// Run the job finder
hn-remote-ts-genai-jobsindex.ts9 matches
2627/**
28* Main function to fetch and process job listings
29*/
30export async function findRemoteTSGenAIJobs(): Promise<{
31threadId: number;
32jobs: JobListing[];
73* Store job results in blob storage
74*/
75async function storeResults(results: {
76threadId: number;
77jobs: JobListing[];
91* Get the latest stored results
92*/
93export async function getLatestResults(): Promise<{
94threadId: number;
95jobs: JobListing[];
107* Format job listings into a readable HTML format
108*/
109export function formatJobListingsHTML(jobs: JobListing[]): string {
110if (jobs.length === 0) {
111return "<p>No matching jobs found.</p>";
220* Format job listings into a readable text format
221*/
222export function formatJobListingsText(jobs: JobListing[]): string {
223if (jobs.length === 0) {
224return "No matching jobs found.";
247248/**
249* Helper function to escape HTML special characters
250*/
251function escapeHtml(str: string): string {
252return str
253.replace(/&/g, "&")
276}
277278// Make the main function available for import
279export default findRemoteTSGenAIJobs;
280
hn-remote-ts-genai-jobscommentParser.ts11 matches
1/**
2* Comment Parser
3* Functions to parse Hacker News comments and filter for job listings
4*/
522* @param text The comment text to check
23*/
24export function hasTypeScriptAndGenAI(text: string): boolean {
25const lowerText = text.toLowerCase();
26
56* @param text The comment text to check
57*/
58export function isRemoteJob(text: string): boolean {
59const lowerText = text.toLowerCase();
60
84* @param text The comment text
85*/
86export function extractCompany(text: string): string {
87const companyMatch = text.match(/^([^|]*?)(?=\s*\||\n|$)/);
88if (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
115const positionPatterns = [
135* @param text The comment text
136*/
137export function extractSkills(text: string): string[] {
138const lowerText = text.toLowerCase();
139const skills: string[] = [];
174* @param text The comment text
175*/
176export function extractLocation(text: string): string {
177if (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
220const 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
230const 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 {
260if (!comment.text) {
261return null;
288* @returns Array of parsed job listings
289*/
290export function filterJobListings(comments: HNItem[]): JobListing[] {
291const 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> {
31try {
32const 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[]> {
49const story = await fetchItem(storyId);
50if (!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> {
72try {
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
1718- `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
2122## View Results