Avatar

pomdtr

I mainly enjoy building dev tools: - VS Code integration: https://github.com/pomdtr/valtown-vscode - CLI: https://github.com/pomdtr/vt
Joined June 14, 2023
Public vals
317
pomdtr avatar
pomdtr
open_in_fullscreen
Script
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
0
pomdtr avatar
pomdtr
notebook
HTTP
Notebook Val This val automatically serves the codeblock it contains. Each codeblock is augmented with a set of properties ```html { name: "index.html" } <h1>Hello world</h1> ``` Properties follow JSON5 syntax . Currently only a name property is supported. Files Entrypoint <html> <head> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <title>Page Title</title> <meta name='viewport' content='width=device-width, initial-scale=1'> <link rel='stylesheet' type='text/css' media='screen' href='main.css'> <link rel="icon" href="https://fav.farm/📔" /> <script src='main.js'></script> </head> <body> <h1>This whole val code is extracted from a README!</h1> <a href="https://www.val.town/v/pomdtr/notebook">View Val</a> </body> </html> Styling body { background-color: white; } h1 { color: red; } Script console.log("Hi from the readme")
1
pomdtr avatar
pomdtr
test_auth
HTTP
example for @pomdtr/auth_middleware
0
pomdtr avatar
pomdtr
auth_middleware
Script
Authentication middleware Guards your public http vals behind a login page. This val use a json web token stored as an http-only cookie to persist authentication. Usage Set an AUTH_SECRET_KEY env variable (used to sign/verify jwt tokens) to a random string . Then use an API token to authenticate. import { auth } from "https://esm.town/v/pomdtr/auth_middleware"; async function handler(req: Request): Promise<Response> { return new Response("You are authenticated!"); } export default auth(handler); See @pomdtr/test_auth for an example ⚠️ Make sure to only provides your api token to vals you trust (i.e. your own), as it gives access to your whole account.
1
pomdtr avatar
pomdtr
sql
Script
SQL Template Tag Port of blakeembrey/sql-template-tag for usage in val.town. Usage import { sqlite } from "https://esm.town/v/std/sqlite" import { sql, zip } from "https://esm.town/v/pomdtr/sql" const query = sql`SELECT * FROM books WHERE author = ${author}`; console.log(query.sql) // => "SELECT * FROM books WHERE author = ?" console.log(query.args) // => [author] const res = await sqlite.execute(query) console.table(zip(res)) For advanced usage (ex: nesting queries), refer to the project readme .
6
pomdtr avatar
pomdtr
test_sql
Email
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
fets_client
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
fets
HTTP
Fets Example A openapi JSON spec is available at https://pomdtr-fets.web.val.run/openapi.json . You can access a fully typed client with a single import: import { client } from "https://esm.town/v/pomdtr/fets"; const resp = await client["/greetings"].get(); const res = await resp.json(); console.log(res.message);
0
pomdtr avatar
pomdtr
nixpkgs
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
hackernews
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
deno_deploy
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
browser
Script
Types for the val.town web extension
0
pomdtr avatar
pomdtr
copy_markdown_link
Script
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
0
pomdtr avatar
pomdtr
editor_codemirror
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
readme
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
static
HTTP
Static Vals Serve static content from val.town Usage First, fork this val to get your own http endpoint. Then create a val that uses a string as it's default export, or a single string export. The val must be either public or unlisted . export default `<static content>` You can then fetch the exported string from outside val.town using: curl 'https://<owner>-static.web.val.run/<val>.<extension>' The Content-Type will be dynamically set depending on the provided extension. Example https://pomdtr-static.web.val.run/val_town_readme_style.css Val Link
6