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.
tr3ntg
replaceEmojisWithImages
Script
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)
0
kaleidawave
savedNamedPlaygrounds
HTTP
For the future playground for the Ezno type checker: https://github.com/kaleidawave/ezno/pull/115 Can save an id for a content and recall content from an id (thus acting as a sort of compressor) Inspired by how the https://play.rust-lang.org/ shares playgrounds. (However uses a SQL-lite db hosted by Valtown rather than GitHub gists)
1
tmcw
xastscriptExample
Script
xastscript xastscript is a great way to safely generate XML from within JavaScript - it provides a sort of 'Domain Specific Language' for building XML trees, and then you can encode that into XML using xast-util-to-xml . For example, we at Val Town use xastscript and these utilities to generate our sitemap.xml file for Google to discover vals.
0
pomdtr
valtownOpenAPI
HTTP
Val Town Typescript Spec This val return an up-to-date typescript version of the val.town openapi spec for usage with a feTS client. Usage Deno script import { createClient, type NormalizeOAS } from "npm:fets";
import openapi from "https://pomdtr-valtownOpenAPI.web.val.run/openapi.ts";
export const client = createClient<NormalizeOAS<typeof openapi>>({
endpoint: openapi.servers[0].url,
});
2