Back to APIs list

Hacker News API examples & templates

Use these vals as a playground to view and fork Hacker News API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
compuives avatar
compuives
staticChess
HTTP
Forked from maxm/staticChess
0
nishant avatar
nishant
flightRadar24
Script
Forked from raylu/flightRadar24
0
maxm avatar
maxm
valSession
HTTP
Val Session import { ValSession } from "https://esm.town/v/maxm/valSession"; // Generate a token from your valtown api key. const token = await ValSession.newSession(Deno.env.get("valtown")); // Other services can use it to authenticate const user = await ValSession.validate(token); Fork it, provide your own VT_SESSION_PRIVATE_KEY, and update the hardcoded public key. You can generate your own keys like so: import { crypto } from "https://deno.land/std@0.198.0/crypto/mod.ts"; // Generate a key pair for JWT signing and verification const { privateKey, publicKey } = await crypto.subtle.generateKey( { name: "RSASSA-PKCS1-v1_5", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256", }, true, ["sign", "verify"], ); function formatPEM(b64: string, type: "PRIVATE KEY" | "PUBLIC KEY"): string { const lines = b64.match(/.{1,64}/g) || []; return `-----BEGIN ${type}-----\n${lines.join("\n")}\n-----END ${type}-----`; } const privateKeyPem = formatPEM( btoa(String.fromCharCode(...new Uint8Array(exportPrivateKey))), "PRIVATE KEY", ); const publicKeyPem = formatPEM( btoa(String.fromCharCode(...new Uint8Array(exportPublicKey))), "PUBLIC KEY", ); console.log(privateKeyPem, publicKeyPem);
3
fab1an avatar
fab1an
extractOnThisDayStory
HTTP
An interactive, runnable TypeScript val by fab1an
1
stevekrouse avatar
stevekrouse
newThankYouEmailVersion
HTTP
Forked from stevekrouse/newStripeSubscriber
0
veddevv avatar
veddevv
snakeclone
HTTP
Snake clone with effects.
0
dhvanil avatar
dhvanil
val_xrAXPiDVNV
HTTP
An interactive, runnable TypeScript val by dhvanil
0
janpaul123 avatar
janpaul123
valle_tmp_86669542161959955391274329473221
HTTP
// Function to initialize the stories in blob storage
0
Joelsrubin avatar
Joelsrubin
generateDailyTwitterEmail
Cron
An interactive, runnable TypeScript val by Joelsrubin
0
jaredsilver avatar
jaredsilver
startup_clicker
HTTP
@jsxImportSource https://esm.sh/react
2
gio avatar
gio
razza
HTTP
An interactive, runnable TypeScript val by gio
0
ajax avatar
ajax
resumeConfig
Script
Forked from iamseeley/resumeConfig
0
raylu avatar
raylu
flightRadar24
Script
usage: async function example() { const discordUserId = "713159744516259880"; await @raylu.flightRadar24( "bf721", "01 Jan 2023", "America/Los_Angeles", discordUserId, ); }
1
sharanbabu avatar
sharanbabu
textSummarizationComparisonTool
HTTP
* This val creates a text summarization comparison tool using the Cerebras LLM API. * It provides a text area with default text, a summarize button, and displays two different summarization results: * 1. Direct summarization * 2. Extractive summarization followed by cohesive rewriting * * The server handles API calls to Cerebras, while the client manages the UI and user interactions.
0
stevekrouse avatar
stevekrouse
date_me_form
HTTP
@jsxImportSource npm:hono@3/jsx
0
mahictn avatar
mahictn
snake_game
HTTP
@jsxImportSource https://esm.sh/react@18.2.0
0
ā€¦
15
ā€¦
Next