Github API examples & templates
Use these vals as a playground to view and fork Github API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
std
sqlite
Script
SQLite - Docs ↗ SQLite is a lightweight, standard database. Every Val Town account comes with its own private SQLite database that is accessible from any of your vals via std/sqlite . Val Town SQLite is powered by Turso . Usage Migrations ORMs We recommend these admin data viewers for managing your database – viewing or editing data or your database table schema: Outerbase Studio (recommended) - formely known as LibSQL Studio – see instructions here SQLite Explorer (built in Val Town) Limits You can store 10mb on the free plan and up to 1gb on the paid plan. Contact us if you need more space. 📝 Edit docs
0
std
email
Script
Email - Docs ↗ Send emails with std/email . You can only send emails to yourself if you're on Val Town Free. If you're on Val Town Pro , you can email anyone. Want to receive emails instead? Create an email handler val Basic usage import { email } from "https://esm.town/v/std/email";
await email({ subject: "New Ink & Switch Post!", text: "https://www.inkandswitch.com/embark/" }); subject The email subject line. It defaults to Message from @your_username on Val Town . to , cc , and bcc By default, the to field is set to the owner of the Val Town account that calls it. If you have Val Town Pro, you can send emails to anyone via the to , cc , and bcc fields. If you don't have Val Town Pro, you can only send emails to yourself, so leave those fields blank. from The from is limited to a few options: It defaults to notifications@val.town if you don't specify it. If you do specify it, it must be of the form: your_username.valname@valtown.email . replyTo replyTo accepts a string email or an object with strings for email and name (optional). This can be useful if you are sending emails to others with Val Town Pro. import { email } from "https://esm.town/v/std/email";
await email({
to: "someone_else@example.com",
from: "your_username.valname@valtown.email",
replyTo: "your_email@example.com",
text: "these pretzels are making me thirsty",
}); Attachments You can attach files to your emails by using the attachments field.
Attachments need to be Base64 encoded,
which is what the btoa
method is doing in this example: import { email } from "https://esm.town/v/std/email";
export const stdEmailAttachmentExample = email({
attachments: [
{
content: btoa("hello attachments!"),
filename: "test.txt",
type: "text",
disposition: "attachment",
},
],
}); Here's an example sending a PDF . Headers You can set custom headers in emails that you send: import { email } from "https://esm.town/v/std/email?v=13"
console.log(
await email({
text: "Hi",
headers: {
"X-Custom-Header": "xxx",
},
}),
) This is also documented in our REST API , and supported in the SDK . 📝 Edit docs
7
augustohp
ghAutoAssignOnWIP
HTTP
GitHub Projects: Assign to the person who just moved the card Receives Project v2 items webhook events from GitHub. When a card is moved on a Kanban board ( Status field), if it is on a specific column, assign it to the person who moved it. Useful when I move a card from To do (no assignee) to Doing (assigns to me), for example. How to use it? Fork this val and edit it Change wipColumnName to whatever is the name of the column you are using as Doing Provide a token on ghToken with permissions: Repository access to the repository(ies) holding the issues being manipulated Organization permissions: Read access to members, Read and Write access to organization projects Read and write access to Issues and Pull Requests Create an organization webhook pointing to your new val Individual events: Project v2 items
2
pomdtr
pwa
Script
Add a pwa manifest to an http val (to open in as an app in iOS). See https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps for available fields. Usage import handler from "https://esm.town/v/maxm/staticChess";
import { pwa } from "https://esm.town/v/pomdtr/pwa";
export default pwa(handler, {
name: "Static Chess",
display: "standalone",
background_color: "#ffffff",
start_url: "/",
});
3
pomdtr
awesome
HTTP
Awesome Val Town An curated list of useful community vals. Feel free to create your own awesome list! Apps @pomdtr/blob_editor @nbbaier/sqliteExplorerApp View and interact with your Val Town SQLite data. @pomdtr/http_client Attach a postman-like http client to your vals VS Code Extension vt Chrome Extension Tooling Authentication @pomdtr/basicAuth @pomdtr/email_auth @pomdtr/password_auth Sqlite @sqlite/db @pomdtr/sql @pomdtr/kv @postpostscript/sqliteUniverse Blob @stevekrouse/blobAdmin @pomdtr/lowdb Middleware @andreterron/codeOnValTown Testing @pomdtr/test_explorer Api @pomdtr/api @pomdtr/trpc Other @vladimyr/valshot @pomdtr/mdx @pomdtr/serve_readme OpenAI @pomdtr/ask_ai Web Components Val Town Playground CodeMirror
6
pranjaldotdev
poller
Cron
bytes.dev newsletter notifier Tech Stack val.town - Infrastructure SQLite - Database Deno - Runtime Pushover - Notifications How it works At the lowest level it is powered by 3 main scripts, which are invoked by a scheduled cron job that runs daily scraper Goes to bytes.dev and scrapes latest published newsletter inserter Insert it to SQLite if this newsletter already not exists notifier Uses Pushover API to send ios mobile notifications Pushover notifications
3
fil
earthquakes
HTTP
Earthquake map 🌏 This val loads earthquake data from USGS, a topojson file for the land shape, and supporting libraries. It then creates a map and save it as a SVG string. The result is cached for a day. Note that we must strive to keep it under val.town’s limit of 100kB, hence the heavy simplification of the land shape. (For a simpler example, see becker barley .) | | |
|-----|-----|
| Web page | https://fil-earthquakes.web.val.run/ |
| Observable Plot | https://observablehq.com/plot/ |
| linkedom | https://github.com/WebReflection/linkedom |
| topojson | https://github.com/topojson/topojson |
| earthquakes | https://earthquake.usgs.gov |
| world | https://observablehq.com/@visionscarto/world-atlas-topojson |
| css | https://milligram.io/ |
6
iamseeley
resumeHandler
HTTP
📄 hello, resume Creating, customizing, and hosting resumes can get complicated and time-consuming. This project aims to simplify that process and maybe make it a little more enjoyable. Follow the steps in your resumeConfig to get started . Happy job hunting! 💼✨ Thanks to @nbbaier for the great feedback and resumeValidator ! Also, big thanks to Thomas Davis for JSON Resume Standard!
1