Back to APIs list

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.
nbbaier avatar
paginatedResponse
@nbbaier
Script
Return a paginated response A helper function to take an array and return a paginated response. This is useful when defining one's own folders for pomdtr's vscode extension . Usage: const data = [...] export default async function(req: Request): Promise<Response> { return paginatedResponse(req, data); } For demo usage in the context of the vscode extension see this val .
nbbaier avatar
saveToTana
@nbbaier
Script
Save To Tana This val provides a function saveToTana allows the creation of nodes in Tana via their Input API . The parameters are as follows: Token: to access the Tana Input API, you must pass an API token to the function. Obtain an API token from the Tana app and save it as a secret in Val Town. Node: the node that is created within Tana is passed as the second argument and must conform to the shape of an Input API node (see the documentation on github for details. Target node: optionally, you can specify a specific target node by passing a node ID to the function as it's third argument. Example Usage One way to use this val is with a web endpoint that you can send data to to have parsed and submitted to Tana as a specific type of node. For example, this val import { saveToTana } from "https://esm.town/v/nbbaier/saveToTana"; import { APIPlainNode } from "https://esm.town/v/nbbaier/tanaTypes"; import { Hono } from "npm:hono"; const token = Deno.env.get("tanaInputAPI"); export const honoTanaEndpoint = async (req: Request) => { const app = new Hono(); app.get("/", async c => { let { text, url } = c.req.query(); const payload: APIPlainNode = { name: text, children: [ { type: "field", attributeId: "cwi23sOzRSh8", children: [ { dataType: "url", name: url, }, ], }, ], supertags: [], }; const newNode = await saveToTana(token, payload); return c.json({ newNode }); }); return app.fetch(req); }; Combined with a Chrome extension like Rich URL , the above val allows one to send selected text on a page along with that pages URL to Tana via the val's public GET endpoint.
kingishb avatar
blackLobster
@kingishb
Cron
Send a weekly email digest of good times to go for a bike ride.
brownieinmotion avatar
georgiaTechRegistration
@brownieinmotion
HTTP
// ported from https://github.com/brownie-in-motion/gt-waitlist-bot
maas avatar
forwarder
@maas
Script
Unlimited Anonymous Emails All code can be triggered via email ( docs ), i.e. maas.forwarder@valtown.email . You can generate as many emails as you want to avoid giving away your personal email address and reduce spam. Getting started Log in to Val Town Fork this Val Publish the Val via 🔒 > Unlisted Copy the email endpoint via ⋮ > Endpoints > Copy email address Sign up for newsletters or services using this email ( maas.forwarder@valtown.email ). To remove their ability to email you, simply delete the val (or send it to /dev/null ).
tr3ntg avatar
replaceEmojisWithImages
@tr3ntg
Express
Accepts an HTML string ( body.html ) and returns an emoji-escaped replacement. The purpose of this is due to official PDF spec's lack of support for emojis. This can be seen in the Anvil PDF Generation service as well - emojis are not rendered. node-emoji github here - replaces all emojis with spans emoji images for replacement are hosted at netlify (sourced from private repo)
janpaul123 avatar
indexValsTurso
@janpaul123
Cron
Forked from sqlite/leaderboard
yawnxyz avatar
luciaValtownSqlite
@yawnxyz
Script
A reorganization of: https://www.val.town/v/stevekrouse/lucia_adapter https://esm.town/v/stevekrouse/lucia_adapter_base
inkpotmonkey avatar
instructorExample
@inkpotmonkey
Script
Example copied https://instructor-ai.github.io/instructor-js/#usage into val.town You will need to fork this and properly set the apiKey and organisation for it to work.
iamseeley avatar
resumeConfig
@iamseeley
Script
⚙️ configuration for hello, resume this guide will help you configure and use the resume builder to create your resume page. Ensure that your resume is formatted according to the JSON Resume standard . This is crucial for the resume builder to interpret and render your resume correctly. If you don't want to take the time to manually format your resume content and set up hosting, try using this: Resume to JSON 1. Configure the Resume JSON You have two options to provide your resume data: Resume JSON URL : Point this to your raw resume JSON hosted online. Recommended setups include using Val Town or a GitHub Gist. Example: resumeJsonUrl: 'https://example.com/resume.json' Paste Resume JSON : Provide the resume JSON directly within the configuration. Example: resumeJson: { "basics": { "name": "John Doe" }, "work": [ ... ] } 2. Choose a Theme Select a theme for your resume. You can use the predefined themes or create your own: Predefined Themes : starterTheme oceanTheme Custom Theme : Customize the styles in the starterTheme or create a new one and import it. 3. Custom Styles (Optional) If you want to add additional styles, provide a URL to a custom stylesheet: Example: customStyleUrl: 'https://example.com/styles.css' 4. Set the Section Order Customize the order of the sections in your resume: Default order: sectionOrder: ['header', 'summary', 'education', 'work', 'projects', 'volunteer', 'awards', 'certificates', 'publications', 'skills', 'languages', 'interests', 'references'] Example custom order: sectionOrder: ['header', 'summary', 'projects', 'education', 'work'] 5. Add Custom Sections (Optional) Override any default sections with custom sections: Example: customSections: { header: customHeader } 6. Show/Hide "Save as PDF" Button Control the visibility of the "Save asPDF" button: Example: savePDFIsVisible: true 7. View Your Resume Copy this resumeConfig's module URL and import it in your resumeHandler . Visit the resumeHandler HTTP endpoint to view your resume!
pomdtr avatar
sunbeamValTownFn
@pomdtr
HTTP
Sunbeam integration for Val Town Installation First, install sunbeam . Then create a new val referencing this val. const sunbeamValtown = @pomdtr.sunbeamValTownFn(@me.secrets.valtown) then switch it's visibility to unlisted. You can then install your val in sunbeam # install the extension sunbeam extension install --alias valtown val:<username>/sunbeamValtown Usage sunbeam valtown # list your vals sunbeam valtown --help # list available commands Demo
yawnxyz avatar
lastlogin
@yawnxyz
Script
Forked from pomdtr/lastlogin
tmcw avatar
dominoDomExample
@tmcw
Script
domino example Domino is an implementation of the document object model that you can use to build "webpages" without requiring a browser or a heavy browser-like abstraction. If you need even less DOM-compatibility and just want to parse some HTML, cheerio is an even more lightweight abstraction that works great.
tmcw avatar
duckDbCsv
@tmcw
Script
An interactive, runnable TypeScript val by tmcw
samwillis avatar
pglite
@samwillis
HTTP (preview)
Forked from maxm/pgliteNpm
vladimyr avatar
gltf_torus
@vladimyr
HTTP
Forked from saolsen/gltf_torus