Search

Results include substring matches and semantically similar vals. Learn more
nbbaier avatar
create_val
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
export default async function(ctx: BrowserContext) {
const val = await fetchJSON("https://api.val.town/v1/vals", {
headers: {
Authorization: `Bearer ${Deno.env.get("valtown")}`,
method: "POST",
body: JSON.stringify({
code: "console.log('a')",
return {
type: "open",
url: `https://val.town/v/${val.author.username}/${val.name}`,
janpaul123 avatar
valle_tmp_70427092421104433856545248978618
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP (deprecated)
// 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) {
const sampleStories = Array.from({ length: 30 }).map((_, idx) => ({
id: idx + 1,
title: faker.lorem.sentence(),
url: faker.internet.url(),
votes: Math.floor(Math.random() * 100),
vpontis avatar
dot_com
@vpontis
stevekrouse.com - my personal website This val hosts my personal website. The view data is stored in Val Town SQLite - @std/sqlite. It used to live on Github Pages, which is why I proxy over requests to certain blog posts over to the Github Pages site still. Todos [ ] Speed up page load by loading sqlite data later like in @healeycodes/steve_web [ ] Store more (legally storable) analytics data, and maybe make a sparkline! [ ] Add some sort of way to contact me [ ] Move over all my blog posts from Github Pages (maybe into @std/blob as a CMS?)
HTTP
# stevekrouse.com - my personal website
This val hosts my personal website. The view data is stored in Val Town SQLite - @std/sqlite.
It used to live on Github Pages, which is why I proxy over requests to certain blog posts over to the Github Pages site still
## Todos
- [ ] Speed up page load by loading sqlite data later like in @healeycodes/steve_web
- [ ] Store more (legally storable) analytics data, and maybe make a sparkline!
/** @jsxImportSource https://esm.sh/react */
const linkClass = "text-blue-500 hover:underline";
const Link = (
{ children, href }: {
nate avatar
test
@nate
An interactive, runnable TypeScript val by nate
Script
import { testMessages } from "https://esm.town/v/nate/testMessages";
export let test = (msg) =>
testMessages.push({ time: Date.now(), msg });
janpaul123 avatar
valleBlogV0
@janpaul123
Fork this val to your own profile. Create a Val Town API token , open the browser preview of this val, and use the API token as the password to log in.
HTTP (deprecated)
* Fork this val to your own profile.
* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API tok
async function main(req: Request): Promise<Response> {
const { readable, writable } = new TransformStream();
const writer = writable.getWriter();
const write = (text) => writer.write(new TextEncoder().encode(text));
(async () => {
write(`<!DOCTYPE html>
<html>
<head><link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" /></head>
rcurtiss avatar
annoy
@rcurtiss
An interactive, runnable TypeScript val by rcurtiss
Script
export async function annoy() {
const resume = resume2;
// const boo = await import("https://esm.sh/@atproto/api");
const { default: BskyAgent } = await import("npm:@atproto/api");
console.log(BskyAgent);
const agent = new BskyAgent.BskyAgent({ service: "https://bsky.social" });
await agent.login({
identifier: process.env.BLUESKY_USERNAME!,
password: process.env.BLUESKY_PASSWORD!,
// const actor = await agent.getProfile();
jeremys avatar
Breathe
@jeremys
A very simple breathing tool I made for folks who may get panic attacks or just need to regulate their breathing Pure HTML, CSS, and JS!
HTTP (deprecated)
## A very simple breathing tool I made for folks who may get panic attacks or just need to regulate their breathing
Pure HTML, CSS, and JS!
export default async function(req: Request): Promise<Response> {
const query = new URL(req.url).searchParams;
// Read name from the querystring or body. Defaults to "you" if not present.
// HTML string
const htmlContent = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
chet avatar
watchNimbusDam
@chet
An interactive, runnable TypeScript val by chet
Cron
import { watchWebsite } from "https://esm.town/v/chet/watchWebsite";
export default async function(interval: Interval) {
await watchWebsite("https://cdec.water.ca.gov/dynamicapp/QueryRES?s=NAT");
janpaul123 avatar
valle_tmp_016298797667905655232930394407136
@janpaul123
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
// Set these to your own
const username = "janpaul123";
const tempValsParentFolderId = "4bb7b010-4443-11ef-8642-de64eea55b61";
const valTownToken = Deno.env.get("valtown");
const vt = new ValTown({ bearerToken: valTownToken });
const app = new Hono();
const jsxResponse = (jsx) => {
return new Response(renderToString(jsx), { headers: { "Content-Type": "text/html" } });
const systemprompt = `The conversation below is your recent interaction with the user.
janpaul123 avatar
valle_tmp_228422435641258538528486008331893
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP (deprecated)
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_realistic_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
const sampleStories = Array.from({ length: 30 }).map((_, idx) => ({
id: idx + 1,
title: faker.lorem.sentence(),
url: faker.internet.url(),
votes: Math.floor(Math.random() * 100),
beneskildsen avatar
snip
@beneskildsen
An interactive, runnable TypeScript val by beneskildsen
Script
import { dispatch } from "https://esm.town/v/beneskildsen/dispatch";
export const snip = (x, y, clientID, grammar) => {
return dispatch(
type: "SNIP",
pos: { x, y },
clientID,
grammar: decodeGrammar(grammar),
bonsaiReducer,
"bonsaiState"
stevekrouse avatar
asyncExample1
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export let asyncExample1 = {p: Promise.resolve(10)}
neverstew avatar
htmlResponse
@neverstew
An interactive, runnable TypeScript val by neverstew
Script
import type { VNode } from "npm:preact";
export const htmlResponse = (htmlNode: VNode, options?: ResponseInit) =>
new Response(
html(htmlNode),
...options,
headers: {
"Content-Type": "text/html",
...options?.headers,
politelyinvinciblepointer avatar
increasemiraclechildcounter
@politelyinvinciblepointer
An interactive, runnable TypeScript val by politelyinvinciblepointer
Script
let { miraclechildcounter } = await import("https://esm.town/v/politelyinvinciblepointer/miraclechildcounter");
export function increasemiraclechildcounter() {
miraclechildcounter++;
lirenxn avatar
cronTest
@lirenxn
An interactive, runnable TypeScript val by lirenxn
Script
export function cronTest() {
console.log("hello world");
return "hello world";