Search

Results include substring matches and semantically similar vals. Learn more
hlobil avatar
bookmark
@hlobil
A minimal bookmarking tool This allows you to bookmark links and view them later. Completely powered by ValTown and SQLite. To set this up for yourself Fork the val From your ValTown settings page, add an environment variable named bookmarks_client_id and give it a value (you will be using this for saving) Add another environment variable named bookmarks_client_secret and give it a value (you will also be using this for saving) At first, the "bookmarks" table will not exist, so we need to save an article first, which will create the "bookmarks" table To do this, add a bookmarklet to your browser with this value (replace BOOKMARKS-CLIENT-ID and BOOKMARKS-CLIENT-SECRET with the values you added to the environment variables, and replace BOOKMARKS-URL with your VAL's URL): javascript:void(open('BOOKMARKS-URL/save?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title)+'&id=BOOKMARKS-CLIENT-ID&secret=BOOKMARKS-CLIENT-SECRET', 'Bookmark a link', 'width=400,height=450')) Click this bookmarklet to bookmark the URL of the current active tab Go to your VAL URL homepage to see the bookmark Demo Here are my bookmarks: https://ramkarthik-bookmark.web.val.run/ Note Make sure you don't share bookmarks_client_id and bookmarks_client_secret . It is used for authentication before saving a bookmark.
HTTP (deprecated)
1. Fork the val
rom your ValTown settings page, add an environment variable named `bookmarks_client_id` and give it a value (you will be usin
3. Add another environment variable named `bookmarks_client_secret` and give it a value (you will also be using this for savi
4. At first, the "bookmarks" table will not exist, so we need to save an article first, which will create the "bookmarks" tab
this, add a bookmarklet to your browser with this value (replace `BOOKMARKS-CLIENT-ID` and `BOOKMARKS-CLIENT-SECRET` with th
onent(location.href)+'&t='+encodeURIComponent(document.title)+'&id=BOOKMARKS-CLIENT-ID&secret=BOOKMARKS-CLIENT-SECRET', 'Book
6. Click this bookmarklet to bookmark the URL of the current active tab
### Note
Make sure you don't share `bookmarks_client_id` and `bookmarks_client_secret`. It is used for authentication before saving a
return c.text("Authentication details (ID/Secret) missing!");
if (id != Deno.env.get("bookmarks_client_id") || secret != Deno.env.get("bookmarks_client_secret")) {
return c.text("Unauthorized!");
stevekrouse avatar
esmTownTranspileDemo
@stevekrouse
Val Town's esm.town Transpiles TypeScript and JSX for browsers When Val Town's code registry (esm.town) gets a request from a browser (which it can detect via the User Agent header), it transpiles that val's code to web-standard JavaScript be able to run in the browser. It doesn't do as much as other transpilers (such as esm.sh, such as rewriting npm: imports, etc). We may add that capability in the future. For now, if you want your npm imports to run in the browser, use https://esm.sh/package instead of npm:package . The below script demonstrates this transiplation behavior by fetching its own source code ( import.meta.url ) with the user agent of a browser. You can uncoment the line setting the browser agent if you want to see the difference in the output. Or you could just load this val's module URL in your browser to see the untranspiled TS. As of July 23, 2024, this is the code that determines when esm.town transpiles or not:
Script
/** @jsxImportSource https://esm.sh/react */
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
const exampleJSX = <p>Hello, World!</p>;
jacoblee93 avatar
braveAgent
@jacoblee93
// Shows how to use the Brave Search tool in a LangChain agent
Script
new Calculator(),
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: "chat-zero-shot-react-description",
verbose: true,
const input =
petermillspaugh avatar
encodingAndConsolidation
@petermillspaugh
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { generateLessonHtml } from "https://esm.town/v/petermillspaugh/lessonTemplate";
import { renderToString } from "npm:react-dom/server";
* Note: this lesson is a work in progress 👷‍♂️
const TITLE = "Encoding & consolidation";
iamseeley avatar
starterTheme
@iamseeley
🏁 starter theme for hello, resume
Script
li {
margin-bottom: 10px;
aside {
margin-top: 8px;
margin-bottom: 8px;
std avatar
turso
@std
Deprecated in favor of std/sqlite (also powered by Turso) std/turso was the initial version of our integration with Turso. It was so popular, we rebuilt it to be faster and easier to use: std/sqlite . Turso is a serverless SQLite platform designed for the edge. It runs libSQL , their open contribution fork of SQLite. Every Val Town user automatically gets their own Turso SQLite database! It's great for >100kb data (ie bigger than a val) or when you need SQL: relations, ACID transactions, etc. Storage used in Turso will count against your Val Town total storage (10mb for free users; 1gb for Pro users). Contact us if you'd need more – it should be no problem! Getting started This val uses our public key auth scheme . Generate your keypair On your publicKey click the lock icon🔒 to change the permissions to Unlisted . Fork this helper function replacing stevekrouse with your own username Try out some queries! Usage This val returns a Turso SDK's Client , which supports execute , batch , and transaction . await @me.turso().execute(`create table blobs( key text unique, value text )`) More example usage Architecture This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.
Script
## Usage
This val returns a [Turso SDK's Client](https://docs.turso.tech/reference/client-access/javascript-typescript-sdk), which sup
```js
## Architecture
This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication,
import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
// grab the types off turso's client without importing it
let tursoImport = () => import("https://esm.sh/@libsql/client/web");
type createClient = Awaited<ReturnType<typeof tursoImport>>["createClient"];
export function turso(keys, handle?) {
return {
execute: f("execute") as ReturnType<createClient>["execute"],
batch: f("batch") as ReturnType<createClient>["batch"],
transaction: f("transaction") as ReturnType<createClient>["transaction"],
pa avatar
gifStory
@pa
Generates a story and then a storyboard with 5 animated frames. Note : You'll need to fork this example (and un-comment some code) to run it with new input. Currently it renders cached output, for demo purposes (running takes 30-60s). 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
HTTP (deprecated)
"The sound of rushing water grows louder as the traveler follows the winding path.",
"A massive waterfall comes into view, cascading down a rocky slope.",
"The roar of the falls subsides as the traveler rounds a bend in the path.",
"imageDescriptions": [
"A dense jungle with towering trees and vines",
nico avatar
handleSanguineGithubWebhook
@nico
An interactive, runnable TypeScript val by nico
Script
try {
const gh_res = await fetch(
`https://github.com/login/oauth/access_token?code=${code}&client_id=${process.env.sanguineGithubClientId}&client_secret
method: "POST",
headers: {
bikefixe avatar
TanaPasteExample
@bikefixe
An interactive, runnable TypeScript val by bikefixe
Script
// you call this functioin from Tana's make API request
// as https://api.val.town/express/@bikefixe.TanaPasteExample?arg=stufftopassin
// then you'd call the API where the data you want resides
// a search term might've been passed in
// const url = https://something@domain.com?searchterm=${req.query.arg}
ajax avatar
resumeHandler
@ajax
📄 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 !
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { resumeConfig } from "https://esm.town/v/ajax/resumeConfig";
import { helloResume } from "https://esm.town/v/iamseeley/helloResume";
petermillspaugh avatar
learningAboutLearning
@petermillspaugh
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { generateLessonHtml } from "https://esm.town/v/petermillspaugh/lessonTemplate";
import { renderToString } from "npm:react-dom/server";
* Note: this lesson is a work in progress 👷‍♂️
const TITLE = "Learning about learning";
vlad avatar
joinMatrixRoom
@vlad
An interactive, runnable TypeScript val by vlad
Script
roomId: string,
serverUrl: string = "https://matrix.org",
const url = `${serverUrl}/_matrix/client/v3/rooms/${
encodeURIComponent(roomId)
}/join`;
bandr123 avatar
testPostgres
@bandr123
An interactive, runnable TypeScript val by bandr123
Script
const postgres = await import("https://deno.land/x/postgres/mod.ts");
const client = new postgres.Client(Deno.env.get("neon_url"));
await client.connect();
export const testPostgres = await client.queryObject`select CURRENT_TIME;`;
stevekrouse avatar
spotifyRefreshToken
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
import { querystring } from "https://esm.town/v/stevekrouse/querystring";
export let spotifyRefreshToken = async ({ refresh_token, client_id, client_secret }) =>
fetchJSON("https://accounts.spotify.com/api/token", {
method: "POST",
grant_type: "refresh_token",
headers: {
"Authorization": "Basic " + (new Buffer(client_id + ":" + client_secret).toString("base64")),
"Content-Type": "application/x-www-form-urlencoded",
henninggsson avatar
addItem
@henninggsson
An interactive, runnable TypeScript val by henninggsson
Script
import process from "node:process";
export async function addItem(interval: Interval) {
const { Client } = await import("https://deno.land/x/notion_sdk/src/mod.ts");
const notion = new Client({ auth: process.env.Notion });
const databaseId = "f9c2a3bda35e421e93d8af42ef0a15f9";
try {