Search

Results include substring matches and semantically similar vals. Learn more
stevekrouse avatar
smoothBluePanther
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [htmlInput, setHtmlInput] = useState("<h1>Hello, World!</h1>"); const [silliness, setSilliness] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function server(request: Request): Promise<Response> {
if (request.method === "POST" && new URL(request.url).pathname === "/api/modify") {
stevekrouse avatar
legendaryVioletBovid
@stevekrouse
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY
HTTP
"morse code translator with audio output",
"random quote generator with tweet functionality",
"personal finance tracker with basic charts",
"multiplayer rock-paper-scissors game",
function Dashboard() {
const [stats, setStats] = useState<{
useEffect(() => {
async function fetchStats() {
const response = await fetch("/dashboard-stats");
</div>
function App() {
const [prompt, setPrompt] = useState(
versions: [],
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setLoading(false);
function handleVersionChange(direction: "back" | "forward") {
const { currentVersionIndex, versions } = versionHistory;
</div>
function client() {
const path = window.location.pathname;
client();
function extractCodeFromFence(text: string): string {
const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
return htmlMatch ? htmlMatch[1].trim() : text;
export default async function server(req: Request): Promise<Response> {
// Dynamic import for SQLite to avoid client-side import
stevekrouse avatar
whoIsHiring
@stevekrouse
WIP Searcher for HN whos hiring posts HonoJs doesn't support render for async components so the style is off for the home page. And the state changes don't register in html rendering so thinking of using react instead.
HTTP
import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
function App() {
const tabs = { "/": "Home", "/about": "About" };
: <About />}
function ServerApp() {
return (
hydrateRoot(document.getElementById("root"), <App />);
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
dhvanil avatar
val_G4QbNgqzRn
@dhvanil
An interactive, runnable TypeScript val by dhvanil
Script
export default async function handler(req) {
try {
const result = await (async () => {
janpaul123 avatar
valle_tmp_09983323334565619759844043742776
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
isfeng avatar
gpt3
@isfeng
An interactive, runnable TypeScript val by isfeng
Script
import { runVal } from "https://esm.town/v/std/runVal";
export async function gpt3(msg) {
return await runVal("patrickjm.gpt3", {
prompt: JSON.stringify(msg),
iamseeley avatar
convertToResumeJSON
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
import { TokenBucket } from "https://esm.town/v/iamseeley/tokenBucket";
const tokenBucket = new TokenBucket(5, 1/12);
export async function convertToResumeJSON(resume, apiKey) {
if (!tokenBucket.consume()) {
throw new Error("Rate limit reached. Please try again later.");
const endpoint = 'https://api.openai.com/v1/chat/completions';
const model = 'gpt-4';
const messages = [
rodrigotello avatar
fetchCongressTradeReports
@rodrigotello
Receive daily emails of reported congress trades by scheduling a call to @claytn.fetchCongressTradeReports((reports) => console.email(reports))
Script
Receive daily emails of reported congress trades by scheduling a call to
@claytn.fetchCongressTradeReports((reports) => console.email(reports))
export async function fetchCongressTradeReports(callback) {
const res = await fetchJSON(
"https://bff.capitoltrades.com/trades?sortBy=-pubDate"
const trades = res.data;
function isToday(d) {
const now = new Date();
return (
shrirudragoud avatar
modernSalesCRM
@shrirudragoud
@jsxImportSource https://esm.sh/react
HTTP
function Button({ children, onClick, className = '' }) {
function Input({ placeholder, value, onChange, type = 'text', className = '' }) {
function Card({ children, className = '' }) {
function CardHeader({ children }) {
function CardTitle({ children }) {
function CardContent({ children }) {
function Table({ children }) {
function TableHeader({ children }) {
function TableBody({ children }) {
function TableRow({ children, className = '' }) {
janpaul123 avatar
valle_tmp_06883828762455286767916178260256
@janpaul123
// This val will simply respond with "Hello world" to all incoming requests
HTTP
// This val will simply respond with "Hello world" to all incoming requests
export default async function(req: Request): Promise<Response> {
return new Response("Hello world");
toowired avatar
src_index
@toowired
@jsxImportSource https://esm.sh/react@18.2.0
Script
import { setupDatabase } from './db';
import { App } from './App';
export default async function server(request) {
await setupDatabase();
const url = new URL(request.url);
yawnxyz avatar
basicHtmlReq
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
HTTP
export default async function (req: Request): Promise<Response> {
const message = "HELLO HELLO";
return Response.json({message});
rap avatar
myApi
@rap
An interactive, runnable TypeScript val by rap
Script
export function myApi(name) {
return "hi " + name;
tychio avatar
myApi
@tychio
An interactive, runnable TypeScript val by tychio
Script
export function myApi(name) {
return "hi " + name;
venjiang avatar
test
@venjiang
An interactive, runnable TypeScript val by venjiang
Cron
export function test() {
return new Date();