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
val_town_readme_style
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
cliOld
HTTP
Cli Vals Cli vals are a new type of val (same as http, email, cron and script vals). A cli val must use a function without args as it's default export. The function body will run on the user device using deno . An error message will be shown if deno is not installed. export default function() { if (Deno.args.length == 0) { console.error("<name> arg is required!"); Deno.exit(1); } console.log(`Hey ${Deno.args[0]}!`); } Fork @pomdtr/example_cli to get started. Of course, you can use a cli framework to parse arguments (ex: cliffy ). Running a cli val Go to https://pomdtr-cli.web.val.run/v/<author>/<name>[?v=<version>] to get a runnable script for your val. You can pipe the script to a shell to test it curl 'https://pomdtr-cli.web.val.run/v/pomdtr/cli_example' | sh -s Steve Hello Steve! Or save it to your $PATH . # save the script to the ~/.local/bin folder curl 'https://pomdtr-cli.web.val.run/v/pomdtr/cli_example' > ~/.local/bin/cli_example # make the script executable chmod +x ~/.local/bin/cli_example # run the installed val cli_example Steve Allowing cli vals to access private resources Cli vals run on your device, so by default they can only access public/unlisted vals. You can set the DENO_AUTH_TOKENS env var in your shell config to allow deno to import private vals. export DENO_AUTH_TOKENS=<your-token>@esm.town Cli vals don't have access to val town tokens. Instead of trying to replicate your valtown secrets locally, you can configure your cli vals to call your http endpoints using fetch .
0
pomdtr avatar
pomdtr
copy_val_slug
Script
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
0
pomdtr avatar
pomdtr
open_dependency_graph
Script
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
0
pomdtr avatar
pomdtr
val2img
Script
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
0
pomdtr avatar
pomdtr
bookmarklets
HTTP
Bookmarklet Manager Write your bookmarklets in val.town. Usage You val should just contain your bookmarklet code. alert("Hi mom!"); Make sure that your val is either unlisted or public, and not named bookmarklets . Then navigate to https://pomdtr-bookmarklets.web.val.run/v/:author/:name to generate the bookmarklet link. Sharing a bookmarklet Make sure that your val is public, and add a #bookmarklet tag anywhere in the code. alert("Hi mom!"); // #bookmarklet It should automatically appears on https://pomdtr-bookmarklets.web.val.run . ⚠️ If you are using the Arc Browser , you can use the Powerlet extension to install bookmarklets.
2
pomdtr avatar
pomdtr
sql_search
HTTP
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
vscode
HTTP
Manage your blobs using VS Code ! Just fork this val to install it, and use an api token to authenticate.
2
pomdtr avatar
pomdtr
cli_example
Script
Example Cli Val Usage deno run --allow-all --reload=https://esm.town/v https://esm.town/v/pomdtr/cli_example Steve Hey Steve! Install deno install --allow-all --reload=https://esm.town/v https://esm.town/v/pomdtr/cli_example cli_example Steve Hey Steve!
1
pomdtr avatar
pomdtr
sqliteTable
Script
Sqlite Table Usage: Fork this Val Replace the existing migrations by your own table The table name will match the val name. To update the table, just add new items to the migrations array, and re-run the val
0
pomdtr avatar
pomdtr
dummyVal
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
echoRef
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
refs
Script
An interactive, runnable TypeScript val by pomdtr
0
pomdtr avatar
pomdtr
testBasicAuth
HTTP
An interactive, runnable TypeScript val by pomdtr
2
pomdtr avatar
pomdtr
basicAuth
Script
Val Town Basic Auth Add basic auth on top of any http val Usage Wrap your HTTP handler in the basicAuth middleware. import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth"; function handler(req: Request) { return new Response("You are authenticated!"); } export default basicAuth(handler, { verifyUser: (username, password) => username == "user" && password == "password" }); If you want to use an apiToken as a password: import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth"; import { verifyToken } from "https://www.val.town/v/pomdtr/verifyToken" function handler(req: Request) { return new Response("You are authenticated!"); } export default basicAuth(handler, { verifyUser: (_, password) => verifyToken(password) });
7
pomdtr avatar
pomdtr
lowdb_example
Script
Lowdb Example This val demonstrates the integration between valtown and lowdb . Read the Lodash section if you want to give superpowers to your DB.
4