Search

Results include substring matches and semantically similar vals. Learn more
janpaul123 avatar
reproduceResolveModuleError
@janpaul123
// Copied from https://www.val.town/v/sqlite/db
Script
import { db } from "https://esm.town/v/sqlite/db?v=9";
import type { InStatement } from "https://esm.town/v/std/sqlite";
import type { ResultSet } from "npm:@libsql/client";
// Copied from https://www.val.town/v/sqlite/db
async function execute(statement: InStatement): Promise<ResultSet> {
syncretizm avatar
youtubeEndpoint
@syncretizm
An interactive, runnable TypeScript val by syncretizm
HTTP
let mode = url.searchParams.get("mode") || "";
let responseContent;
let publishedDate, currentDate, timeDiff, daysDiff; // Declare variables outside the switch
yturl = decodeURIComponent(yturl);
const videoIdMatch = yturl.match(/(?:https?:\/\/)?(?:www\.)?youtube\.com\/(?:watch\?v=|live\/)([a-zA-Z0-9_-]+)|youtu\.be\/(
stevekrouse avatar
mongo
@stevekrouse
Silly mongo-like client on Val Town SQLite inspired by Pongo
Script
# Silly mongo-like client on Val Town SQLite inspired by [Pongo](https://github.com/event-driven-io/Pongo)
ajax avatar
resumeConfig
@ajax
⚙️ 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!
Script
"reference":
sure of working with Thomas for the past three years at Earbits, and on a few side projects. Two years ago our CTO left on a
"name": "Yotam Rosenbaum, SVP of Operations, Earbits, Inc.",
"Javascript / Typescript",
"React / Next",
"Redux / Apollo",
"highlights": [
"React / Next",
"Node / Laravel",
"highlights": [
"React",
"Redux",
"highlights": [
"React, Apollo, Styled Components",
"Node.js / Rails",
"summary":
"Built a very large and complex React / Redux application. It works on all platforms and has IOS/Android builds due
"website": "https://listium.com",
doublelotus avatar
sendNotification
@doublelotus
Push Notification Sender This val can be used in other vals to send notifications to a segment using OneSignal's REST API This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to Netlify for free. OneSignal has easy to follow docs so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then install the PWA on your platform of choice and you're off to the races! Setup Save your ONESIGNAL_TOKEN and SEGMENT_APPID from OneSignal to your Val Town environment variables Import into another val! import sendNotification from "https://esm.town/v/gwoods22/sendNotification";
Script
This val can be used in other vals to send notifications to a segment using [OneSignal's REST API](https://documentation.ones
otifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads t
## Setup
bao avatar
notionSiteRss
@bao
Generate an RSS feed for your Notion site. Prerequisite: the articles/posts needs to be in a Notion database. Create a Notion integration in http://notion.so/profile/integrations Go to the Notion database -> click ••• from top right -> Connections -> Connect to, select the integration from last step Fork this val Set up your NOTION_DATABASE_ID and NOTION_API_TOKEN in: https://www.val.town/settings/environment-variables Update the code to customize with your database properties (look out for "Customize based on your database") Share the RSS url
HTTP
import { Client } from "https://esm.sh/@notionhq/client";
export default async function server(request: Request): Promise<Response> {
// Retrieve Notion API token from environment variable
if (!notionToken || !databaseId) {
return new Response("Notion API token or database ID not configured", { status: 500 });
const notion = new Client({ auth: notionToken });
try {
// Fetch database metadata
jxnblk avatar
test
@jxnblk
A test utility and badge to put in your val readme to show test suite status Example: Usage: Make a val Make a separate test suite HTTP val for the val you want to test Import describe and it utilities Write tests Add the badge to your readme, with the url parameter pointing to the test suite val's endpoint. Tests run whenever the test suite val or the badge is fetched import { describe, it } from "https://esm.town/v/jxnblk/test"; import { assertEquals } from "jsr:@std/assert@1"; export default describe("my test suite", () => { const sum = (a, b) => a + b; it("sums it up", () => { assertEquals(sum(1, 2), 3); }) }) Badge: [![][badge]][url] [badge]: https://jxnblk-test.web.val.run?url=YOUR_TEST_SUITE_ENDPOINT [url]: YOUR_TEST_SUITE_URL Example [![][badge]][url] [badge]: https://jxnblk-test.web.val.run?url=https://jxnblk-tunatestsuite.web.val.run [url]: https://www.val.town/v/jxnblk/tunaTestSuite
HTTP
/** @jsxImportSource npm:preact */
import { render } from "npm:preact-render-to-string";
export function it(name, fn) {
const ok = "✅ [OK]: ";
yawnxyz avatar
valVersions
@yawnxyz
* Retrieves a user by their username. * @param {string} username - The username of the user to retrieve. * @returns {Promise<Object>} The user object.
Script
import { Sema } from 'npm:async-sema'; // Import async-sema
const client = new ValTown();
* Retrieves a user by their username.
export async function getUser(username) {
const user = await client.alias.username.retrieve(username);
return user;
// Automatically fetches more pages as needed.
for await (const basicVal of client.users.vals.list(user.id, {
limit: 100,
// Automatically fetches more pages as needed.
for await (const versionListResponse of client.vals.versions.list(valId, {
limit: 20, // Default limit
const valPromises = [];
for await (const basicVal of client.users.vals.list(user.id, {
limit: 100,
generatecoll avatar
creativity_quotes
@generatecoll
Random Creativity Quotes The following call will bring back random creativity quotes
HTTP
const postgres = await import("https://deno.land/x/postgres/mod.ts");
const client = new postgres.Client(process.env.neon_url);
await client.connect();
let res = await client.queryObject`select quote_text, author FROM quotes ORDER BY RANDOM() LIMIT 1;`;
let quote = res.rows[0].quote_text;
willthereader avatar
dependentHarlequinTiger
@willthereader
An interactive, runnable TypeScript val by willthereader
Script
let tabsClicked = 0;
tabs.forEach((tab) => {
if (["Sidestory", "Apocrypha", "Media", "Informational"].some(text => tab.textContent.includes(text))) {
console.log(`Clicking '${tab.textContent.trim()}' tab.`);
tab.click();
liamdanielduffy avatar
REACT_DOM_MINIFIED_PT1
@liamdanielduffy
// set by liamdanielduffy.buildReactDomMinified at 2023-06-01T12:04:43.562Z
Script
// set by liamdanielduffy.buildReactDomMinified at 2023-06-01T12:04:43.562Z
export let REACT_DOM_MINIFIED_PT1 = "/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, I
nicosuave avatar
databaseRunner
@nicosuave
An interactive, runnable TypeScript val by nicosuave
HTTP
console.log("Connecting to PostgreSQL");
const client = new pg.Client({
connectionString: url,
try {
await client.connect();
console.log("Connected to PostgreSQL successfully");
console.log("Executing PostgreSQL query");
const res = await client.query(query);
console.log(`PostgreSQL query executed. Row count: ${res.rows.length}`);
await Promise.race([
client.end(),
new Promise((_, reject) => setTimeout(() => reject(new Error("Connection close timed out")), 1000)),
zzz avatar
YoutubeTranscript
@zzz
An interactive, runnable TypeScript val by zzz
Script
static generateRequest(page: string, config?: TranscriptConfig) {
const clientScreenNonce = this.generateNonce();
const params = this.extractValue(page, YouTubeKey.serializedShareEntity);
context: {
client: {
hl: config?.lang || "en",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Saf
clientName: "WEB",
clientVersion: "2.20200925.01.00",
osName: "Macintosh",
user: {},
clientScreenNonce,
clickTracking: {
throw new YoutubeTranscriptError("Malformed YouTube video url or ID.");
* Generate nonce for clientScreenNonce as part of YouTube API
static generateNonce() {
MattieTK avatar
octopusAgilePricing
@MattieTK
Backend val for https://www.val.town/v/MattieTK.laMetricOctopus Feel free to use it in your own apps.
Script
"East Midlands": "B",
"Eastern England": "A",
"Merseyside & Northern Wales": "D",
"North Eastern England": "F",
"North Western England": "G",
sqlite avatar
db
@sqlite
Query All Public Vals Example: val town leaderboard import { zip } from "https://esm.town/v/pomdtr/sql"; import { db } from "https://esm.town/v/sqlite/db"; const res = await db.execute("SELECT author_username, COUNT(*) AS val_count FROM vals GROUP BY author_username ORDER BY 2 DESC LIMIT 10"); console.table(zip(res));
HTTP
import { InStatement } from "https://esm.town/v/std/sqlite";
import type { ResultSet } from "npm:@libsql/client";
async function execute(statement: InStatement): Promise<ResultSet> {
const resp = await fetch("https://sqlite-execute.web.val.run", {