Search

Results include substring matches and semantically similar vals. Learn more
vawogbemi avatar
whoIsHiringHome
@vawogbemi
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { Dispatch } from "https://esm.sh/react";
export default function Home(
dispatch: Dispatch<{
mmrech avatar
anthropicProxy
@mmrech
This Val will proxy anthropic HTTP requests from some frontend client, like langchain, so that you can utilize anthropic apis from the browser. Convert it to an HTTP val in order to use it (you may want to setup an ENV var / header to protect the endpoint with a secret key)
Script
This Val will proxy anthropic HTTP requests from some frontend client, like langchain, so that you can utilize anthropic apis
Convert it to an HTTP val in order to use it (you may want to setup an ENV var / header to protect the endpoint with a secret
taufiq avatar
aHandler
@taufiq
An interactive, runnable TypeScript val by taufiq
HTTP (deprecated)
import { reactExample } from "https://esm.town/v/stevekrouse/reactExample?v=0";
import { aFunction } from "https://esm.town/v/taufiq/aFunction";
export async function aHandler(request: Request): Promise<Response> {
return reactExample();
pomdtr avatar
lastlogin
@pomdtr
Lastlogin Authentication for val.town Looking for an hono integration ? See @pomdtr/lastloginHono Support login in trough: Email Link QR Code Google Oauth Github Oauth Gitlab Oauth Facebook Oauth Demo You can try a demo at https://pomdtr-lastloginhonoexample.web.val.run (see @pomdtr/lastLoginHonoExample for code) Usage Wrap your http handlers in a lastlogin middleware (sessions will be persisted in the lastlogin_session table on your sqlite account). If you want to be the only one able to access your val, you can use @pomdtr/verifyUserEmail. import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail"; export default lastlogin((req) => { return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`); }, { // check that the user email match your val town email verifyEmail: verifyUserEmail }); If you want to customize how is allowed to signup, you can set the verifyEmail option: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; export default lastlogin((req) => { return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`); }, { verifyEmail: (email) => { email == "steve@valtown" } }); You can allow anyone to signup by returning a boolean from the verifyEmail function: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; export default lastlogin((req) => { return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`); }, { verifyEmail: (_email) => true }); Public Routes import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail"; export default lastlogin(() => { return new Response("Hi!"); }, { verifyEmail: verifyUserEmail, public_routes: ["/", "/public/*"], }); See the URLPattern API for reference. Logout Just redirect the user to /auth/logout
Script
const url = new URL(req.url);
const clientID = `${url.protocol}//${url.host}/`;
const redirectUri = `${url.protocol}//${url.host}/auth/callback`;
const tokenUrl = new URL("https://lastlogin.io/token");
tokenUrl.searchParams.set("client_id", clientID);
tokenUrl.searchParams.set("code", code);
const authUrl = new URL("https://lastlogin.io/auth");
authUrl.searchParams.set("client_id", clientID);
authUrl.searchParams.set("redirect_uri", redirectUri);
stevekrouse avatar
pixel
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Express
query: req.query,
path: req.path,
ip: req.get("true-client-ip"),
userAgent: req.get("user-agent"),
pixelData.push(data);
yawnxyz avatar
simpleLogin
@yawnxyz
// Your routes go here
HTTP (deprecated)
github: {
clientId: Deno.env.get("GITHUB_OAUTH_TEST1_CLIENT"),
clientSecret: Deno.env.get("GITHUB_OAUTH_TEST1_SECRET"),
userInfoUrl: "https://api.github.com/user"
google: {
clientId: Deno.env.get("GOOGLE_OAUTH_COVERSHEET_CLIENT"),
clientSecret: Deno.env.get("GOOGLE_OAUTH_COVERSHEET_SECRET"),
redirectUri: "https://yawnxyz-hnclonehtmx.web.val.run/auth/google/callback",
g avatar
csvViewer
@g
* This application creates a CSV viewer using a Hono app that serves a client-side application. * It allows users to upload a CSV file, view its contents in a table format, and provides basic sorting functionality. * * The approach: * 1. Create a server-side Hono app to handle file uploads and serve the HTML, CSS, and JavaScript. * 2. Implement client-side JavaScript to handle file reading, parsing CSV, and displaying the data in a table. * 3. Add sorting functionality to allow users to sort the table by clicking on column headers. * * Libraries used: * - Hono for the server-side application * - Papa Parse (via esm.sh) for parsing CSV on the client-side
HTTP
* This application creates a CSV viewer using a Hono app that serves a client-side application.
* It allows users to upload a CSV file, view its contents in a table format, and provides basic sorting functionality.
* The approach:
* 1. Create a server-side Hono app to handle file uploads and serve the HTML, CSS, and JavaScript.
* 2. Implement client-side JavaScript to handle file reading, parsing CSV, and displaying the data in a table.
* 3. Add sorting functionality to allow users to sort the table by clicking on column headers.
* Libraries used:
* - Hono for the server-side application
* - Papa Parse (via esm.sh) for parsing CSV on the client-side
import { serve } from 'https://esm.town/v/g/serveUtils';
postpostscript avatar
blog
@postpostscript
@postpostscript 's Val Town Blog Blog Posts: Ideas 2024-03-06 - Auth for Val Town 2024-03-09 - sqliteUniverse: Make SQLite Queries Against Multiple Endpoints in Deno (Val Town) (Part 1) 2024-03-09 - sqliteUniverse: Make SQLite Queries Against Multiple Endpoints in Deno (Val Town) (Part 2) Other Projects: 2024-02-25 - moduleHighlightValueLink: Link to a Val With a Value or Method's Code Highlighted 2024-02-28 - provideBlob: Return Response Quickly and Poll for the Expensive Parts 2024-03-02 - MyFooter: my footer component which shares random vals I've liked! 2024-03-16 - readmeManager: Edit Val Readmes With Persistent Drafts 2024-04-09 - reactiveStateBlob: wrap blob state in a proxy to autosave it on changes 2024-04-24 - lock: lock that releases when it leaves the execution context 2024-04-25 - fetchWorker: communicate with a worker over a fetch-like interface
HTTP (deprecated)
- [2024-03-16 - readmeManager: Edit Val Readmes With Persistent Drafts](https://val.town/v/postpostscript/readmeManager)
- [2024-04-09 - reactiveStateBlob: wrap blob state in a proxy to autosave it on changes](https://val.town/v/postpostscript/re
- [2024-04-24 - lock: lock that releases when it leaves the execution context](https://val.town/v/postpostscript/lock)
park avatar
btc
@park
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { useEffect, useState } from "https://esm.sh/react";
import { renderToString } from "npm:react-dom/server";
const CONFIG = {
yawnxyz avatar
SidebarToArchive
@yawnxyz
Sidebar.io Archiver Sidebar's been one of my biggest design resources for the last decade. Since sidebar.io's break announcement this morning (https://sidebar.io/break/) I've set out to mess around with using Val.town to archive sidebar. The Google Sheet can be found here: https://docs.google.com/spreadsheets/d/1RghvMfPTR5xvHMAk1pKYuH2pFYYKOJ6bH0LLkHNZiuc/edit?usp=sharing Initially I was just piping data to Google Sheets but that's slow, wasteful and kind of dumb... instead I just wrapped Hono around the code to provide a download the CSV to browser.
HTTP (deprecated)
# Sidebar.io Archiver
Sidebar's been one of my biggest design resources for the last decade. Since sidebar.io's break announcement this morning (ht
The Google Sheet can be found here: https://docs.google.com/spreadsheets/d/1RghvMfPTR5xvHMAk1pKYuH2pFYYKOJ6bH0LLkHNZiuc/edit?
sema.release();
export async function getSidebar(limit = 1, start = 0) {
const gql = {
// console.log('gql:', JSON.stringify(gql));
let results = await fetchJSON(`https://archive.sidebar.io/graphql`, {
method: 'POST',
while (allLinks.length < totalLimit) {
const links = await getSidebar(limit, offset);
allLinks = allLinks.concat(links);
export default app.fetch;
// let links = await getSidebar(500, 618); // Example usage: limit 10, start from 5
// await addLinksToSheet(links);
wilt avatar
miniWidget
@wilt
Did you know that in recent versions of Windows 11, PWAs can add themselves as desktop widgets? This is a demo of that. Because this PWA isn't published to the Microsoft Store, if you want to try this out for yourself you'll first need to install WinAppSDK version >= 1.2 , enable Developer Mode in settings following the instructions here , and visit https://wilt-miniWidget.web.val.run to install using a recent version of Edge.
HTTP (deprecated)
</script>
<h2>Install this PWA</h2>
<p>To get a widget in your Windows Widgets sidebar!</p>
<img src="${tinyLogomark}" />
</html>
widgets: [{
name: "simplepwa widget",
description: "A simple demo widget for the Windows sidebar",
tag: "simplepwa",
ms_ac_template: "template.json",
stevekrouse avatar
date_me_docs_table
@stevekrouse
@jsxImportSource https://esm.sh/preact
Script
/** @jsxImportSource https://esm.sh/preact */
import { getDocs } from "https://esm.town/v/stevekrouse/getSqliteDateMeDocs";
let linkClass = "text-sky-600 hover:text-sky-500";
pomdtr avatar
island
@pomdtr
Demo: @pomdtr/island_demo
Script
/** @jsxImportSource https://esm.sh/react */
import React from "https://esm.sh/react";
export function Island({
children: any;
const child = React.Children.only(children);
return (
kora avatar
quickstartWebsite
@kora
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
stevekrouse avatar
testVTClient
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const testVTClient = (async () => {
const { createApiClient } = await import(
"https://esm.sh/gh/nbbaier/valtown-zodios@main/src/spec/valtown-client.ts"
const apiClient = createApiClient("https://api.val.town");
const params = {
params: { username: "stevekrouse", val_name: "fetchJSON" },
const user = await apiClient.getValname(params);
return user;
…
41
…
Next