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.
blur avatar
oracle
@blur
Email
Forked from stevekrouse/forwarder
kaleidawave avatar
savedNamedPlaygrounds
@kaleidawave
HTTP (deprecated)
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)
tmcw avatar
xastscriptExample
@tmcw
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.
saolsen avatar
use_example_rust_val
@saolsen
Script
Example of how to use a rust val. See This Gist for how to build rust vals. And https://www.val.town/v/saolsen/example_rust_val for the output val we are using.
nbbaier avatar
moccasinRodent
@nbbaier
Script
An interactive, runnable TypeScript val by nbbaier
pomdtr avatar
lowdb
@pomdtr
Script
Val Town Adapter for lowdb @std/blob is used as a lowdb sync. See @pomdtr/lowdb_example for example usage.
pomdtr avatar
valtownOpenAPI
@pomdtr
HTTP (deprecated)
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, });
stevekrouse avatar
forwarder
@stevekrouse
Email
Forked from maas/forwarder
natashatherobot avatar
forwarder
@natashatherobot
Email
Forked from stevekrouse/forwarder
pomdtr avatar
vanPlateExample
@pomdtr
HTTP (deprecated)
Van Plate Example of building html using the mini-van lib. Access it at https://pomdtr-vanPlateExample.web.val.run
iamseeley avatar
turquoiseSkunk
@iamseeley
Script
Forked from iamseeley/resumeConfig
iamseeley avatar
thomasResumeConfig
@iamseeley
Script
Forked from iamseeley/resumeConfig
nbbaier avatar
sqliteWriter
@nbbaier
Script
SQLite QueryWriter The QueryWriter class is a utility for generating and executing SQL queries using natural language and OpenAI. It provides a simplified interface for interacting with your Val Town SQLite database and generating SQL queries based on user inputs. This val is inspired by prisma-gpt . PRs welcome! See Todos below for some ideas I have. Usage Import the QueryWriter class into your script: import { QueryWriter } from "https://esm.town/v/nbbaier/sqliteWriter"; Create an instance of QueryWriter, providing the desired table and an optional model: const writer = new QueryWriter({ table: "my_table", model: "gpt-4-1106-preview" }); Call the writeQuery() method to generate an SQL query based on a user input string: const userInput = "Show me all the customers with more than $1000 in purchases."; const query = await writer.writeQuery(userInput); Alternatively, use the gptQuery() method to both generate and execute the SQL query: const userInput = "Show me all the customers with more than $1000 in purchases."; const result = await writer.gptQuery(userInput); Handle the generated query or query result according to your application's needs. API new QueryWriter(args: { table: string; model?: string }): QueryWriter Creates a new instance of the QueryWriter class. table : The name of the database table to operate on. model (optional): The model to use for generating SQL queries. Defaults to "gpt-3.5-turbo". apiKey (optional): An OpenAI API key. Defaults to Deno.env.get("OPENAI_API_KEY") . writeQuery(str: string): Promise<string> Generates an SQL query based on the provided user input string. str : The user input string describing the desired query. Returns a Promise that resolves to the generated SQL query. gptQuery(str: string): Promise<any> Generates and executes an SQL query based on the provided user input string. str : The user input string describing the desired query. Returns a Promise that resolves to the result of executing the generated SQL query. Todos [ ] Handle multiple tables for more complex use cases [ ] Edit prompt to allow for more than just SELECT queries [ ] Allow a user to add to the system prompt maybe? [ ] Expand usage beyond just Turso SQLite to integrate with other databases
vladimyr avatar
lowdb_example
@vladimyr
Script
Forked from pomdtr/lowdb_example
nbbaier avatar
lowdbTest
@nbbaier
HTTP (deprecated)
Forked from pomdtr/lowdb_example
tmcw avatar
getDuckDB
@tmcw
Script
Get a DuckDB database This method sets up a duckdb-wasm database that you can then use to store and retrieve data.