Search

Results include substring matches and semantically similar vals. Learn more
timqian avatar
slogan_history
@timqian
@jsxImportSource https://esm.sh/react
HTTP
datetime: "2020-10-04",
iconBackground: "bg-green-500",
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
const Screenshots = (props: { screenshots }) => {
</div>
</div>
function Hero() {
return (
<div className="relative isolate overflow-hidden bg-white">
janpaul123 avatar
valle_tmp_32548579067333305484587672007568
@janpaul123
// Comment: Crafting a streamlined server with Hono that sends back SVG sparkline and a playful animated cat goofing around
HTTP
import { sparklineSVG } from "https://esm.town/v/stevekrouse/sparklineSVG";
// Comment: Crafting a streamlined server with Hono that sends back SVG sparkline and a playful animated cat goofing around
export default async function() {
const sparkline = sparklineSVG([5, 10, 5, 20, 15, 10, 15, 20, 25, 30]);
// HTML response containing the sparkline SVG and a simple animated cat gif
toowired avatar
windsurf_contextManager
@toowired
// Initialize SQLite database
Script
// Context Manager Val
export async function updateContext(context) {
const { phase, activeBlocks, pendingTasks, recentChanges } = context;
return getLatestContext();
export async function getLatestContext() {
const result = db.prepare(`
updatedAt: result.updated_at
export async function getContextHistory(limit = 10) {
return db.prepare(`
// HTTP request handler
export async function onRequest(req) {
const { action, params } = await req.json();
overengineered avatar
status
@overengineered
Uptime Status Page This is the status page for the data generated by this uptime cron: @stevekrouse/uptime
HTTP
import { render } from "npm:preact-render-to-string";
export const sha256 = async function digestMessage(message) {
const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array
"CREATE TABLE IF NOT EXISTS meter_users (id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT, session TEXT, salt TEXT, code TE
function BasicLayout(props) {
return (
</html>
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
var login = document.getElementById('login');
cookies.onchange = function () {
login.disabled = false;//!this.checked;
janpaul123 avatar
valle_tmp_2933423436079547503473880922680217
@janpaul123
// This val will respond with a simple HTML page with fun CSS styles like crazy fonts and gradients
HTTP
// This val will respond with a simple HTML page with fun CSS styles like crazy fonts and gradients
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
charlypoly avatar
slackScout
@charlypoly
Slack scout sends a slack notification every time your keywords are mentioned on Twitter, Hacker News, or Reddit. Get notified whenever you, your company, or topics of interest are mentioned online. Built with Browserbase . Inspired by f5bot.com . Full code tutorial . Getting Started To run Slack Scout, you’ll need a Browserbase API key Slack Webhook URL: setup here Twitter Developer API key Browserbase Browserbase is a developer platform to run, manage, and monitor headless browsers at scale. We’ll use Browserbase to navigate to, and scrape our different news sources. We’ll also use Browserbase’s Proxies to ensure we simulate authentic user interactions across multiple browser sessions . Get started with Browserbase for free here . Twitter We’ve decided to use the Twitter API to include Twitter post results. It costs $100 / month to have a Basic Twitter Developer account. If you decide to use Browserbase, we can lend our token. Comment below for access. Once you have the SLACK_WEBHOOK_URL , BROWSERBASE_API_KEY , and TWITTER_BEARER_TOKEN , input all of these as Val Town Environment Variables . Project created by Sarah Chieng and Alex Phan 💌
Cron
export default async function(interval: Interval): Promise<void> {
async function createTable(): Promise<void> {
async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
async function fetchTwitterResults(topic: string): Promise<Website[]> {
async function fetchRedditResults(topic: string): Promise<Website[]> {
function formatSlackMessage(website: Website): string {
async function sendSlackMessage(message: string): Promise<Response> {
async function isURLInTable(url: string): Promise<boolean> {
async function addWebsiteToTable(website: Website): Promise<void> {
async function processResults(results: Website[]): Promise<void> {
yeskunall avatar
hnLatestJobs
@yeskunall
// Get upto (200) of the latest jobs posted on HN
Cron
return { subject, text };
// Get upto (200) of the latest jobs posted on HN
export async function hnLatestJobs() {
const jobStories: Number[] = await fetch(
"https://hacker-news.firebaseio.com/v0/jobstories.json",
stevekrouse avatar
double
@stevekrouse
double(10)
Script
export function double(x: number) {
return 2 * x;
blotre avatar
dotcom
@blotre
@jsxImportSource https://esm.sh/react
HTTP
) => <a className={linkClass} href={href}>{children}</a>;
const dateClass = "text-xs text-gray-400 font-mono mr-1 hidden sm:inline-block";
async function getHits() {
const [, , { rows: [[monthHits]] }, { rows: [[todayHits]] }] = await sqlite.batch([
"CREATE TABLE IF NOT EXISTS stevekrouse_com_hits (timestamp DATETIME DEFAULT CURRENT_TIMESTAMP)",
SowrovCIV avatar
robustCoralPigeon
@SowrovCIV
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
// [Rest of the previous code remains the same until the renderMainView function]
function renderMainView() {
// Default avatar as inline SVG
// [The rest of the previous code remains unchanged]
export default async function server(request: Request): Promise<Response> {
return new Response(`
stevekrouse avatar
scientificCyanHarrier
@stevekrouse
Simple SQLite dashboard made by townie in this video: https://x.com/stevekrouse/status/1833577807093371325
HTTP
import { vtTokenSessionAuth } from "https://esm.town/v/stevekrouse/vtTokenSessionAuthSafe";
function App() {
const [tables, setTables] = useState([]);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function server(request: Request): Promise<Response> {
try {
erhardik avatar
usefulGreenPenguin
@erhardik
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
const generateId = () => Math.random().toString(36).substring(2, 15);
// CSS Definition (moved before server function)
const css = `
// Simple password hashing (for demonstration - use proper hashing in production)
function hashPassword(password: string): string {
let hash = 0;
// Rest of the existing frontend code remains the same...
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
ronaliuzhong avatar
imaginativeMagentaGalliform
@ronaliuzhong
// Fetches a random joke.
Cron
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
function fetchRandomJoke() {
const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
janpaul123 avatar
valle_tmp_8577620427908266060740786834009
@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) {
bcongdon avatar
emailMeWhenBadAirQuality
@bcongdon
An interactive, runnable TypeScript val by bcongdon
Script
import { set } from "https://esm.town/v/std/set?v=11";
import process from "node:process";
export async function emailMeWhenBadAirQuality({ lat, long }: {
lat: number;
long: number;