Search

Results include substring matches and semantically similar vals. Learn more
yawnxyz avatar
lucia_adapter_base
@yawnxyz
Copied from https://github.com/lucia-auth/lucia/blob/main/packages/adapter-sqlite/src/base.ts
Script
Copied from <https://github.com/lucia-auth/lucia/blob/main/packages/adapter-sqlite/src/base.ts>
Adapter,
DatabaseSession,
DatabaseUser,
RegisteredDatabaseSessionAttributes,
RegisteredDatabaseUserAttributes,
} from "npm:lucia";
export class SQLiteAdapter implements Adapter {
private controller: Controller;
private escapedUserTableName: string;
valbee avatar
boredActivities
@valbee
// set by valbee.imBored at 2023-04-30T22:41:02.254Z
Script
// set by valbee.imBored at 2023-04-30T22:41:02.254Z
export let boredActivities = {
"activity": "Paint the first thing you see",
"type": "recreational",
"participants": 1,
"price": 0.25,
"link": "",
"key": "1162360",
"accessibility": 0.2
iamseeley avatar
profileHandlers
@iamseeley
@jsxImportSource https://esm.sh/hono@latest/jsx
Script
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
export const getUserProfileHandler = async (c) => {
const username = c.req.param('username');
const payload = await c.get('jwtPayload');
if (payload.username !== username) {
return c.html(
<RootLayout>
<p>You are not authorized to access this profile.</p>
</RootLayout>
try {
ptn avatar
sendMessage
@ptn
An interactive, runnable TypeScript val by ptn
Script
import { fetch } from "https://esm.town/v/std/fetch";
export async function sendMessage(ptnKey: string, message: string) {
await fetch("https://app.phonetonote.com/hooks/zapier", {
body: JSON.stringify({
ptn_key: ptnKey,
text: message,
method: "POST",
headers: { "Content-Type": "application/json" },
elsif_maj avatar
checkTopHNThreadByHourValues
@elsif_maj
An interactive, runnable TypeScript val by elsif_maj
Script
import { topHNThreadByHour } from "https://esm.town/v/elsif_maj/topHNThreadByHour";
export const checkTopHNThreadByHourValues = (() => {
topHNThreadByHour.forEach((h) => {
console.log(h);
dot avatar
girafe
@dot
An interactive, runnable TypeScript val by dot
Cron
export async function girafe() {
let venue = "girafeparis";
let start_date = "03-05-2023";
let reverse_date = "2023-03-05";
let time_slot = "19:00";
let party_size = "2";
let response = await fetch(
`https://www.sevenrooms.com/api-yoa/availability/widget/range?venue=${venue}&time_slot=${time_slot}&party_size=${party_si
let body = await response.json();
let times = body.data.availability[reverse_date][0].times;
pomdtr avatar
val_town_by_example_css
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
/** @type {string} */
export const CSS =
`:root,[data-color-mode=light][data-light-theme=light],[data-color-mode=dark][data-dark-theme=light]{--color-canvas-default
alp avatar
test_concurrencyDoesntWork
@alp
An interactive, runnable TypeScript val by alp
Script
export const test_concurrencyDoesntWork = (async () => {
const fetchDelayedResponse = async (index: number) => {
const start = Date.now();
const response = await fetch(
"https://api.val.town/v1/express/alp.proxyFetch1",
method: "POST",
body: JSON.stringify({
url: "https://hub.dummyapis.com/delay?seconds=1",
console.log(
`Returned data for ${index}, took:`,
vtdocs avatar
discordWelcomeBotCron
@vtdocs
An interactive, runnable TypeScript val by vtdocs
Cron
let { discordDMs } = await import("https://esm.town/v/vtdocs/discordDMs");
let { discordWelcomedMembers } = await import("https://esm.town/v/vtdocs/discordWelcomedMembers");
let { discordWelcomeBotStartedAt } = await import("https://esm.town/v/vtdocs/discordWelcomeBotStartedAt");
export const discordWelcomeBotCron = async () => {
// Only target new users going forwards from bot creation
if (discordWelcomeBotStartedAt === undefined) {
discordWelcomeBotStartedAt = Date.now();
// Don't message a user more than once
if (discordWelcomedMembers === undefined) {
discordWelcomedMembers = [];
bitbloxhub avatar
hnTopStoryExample
@bitbloxhub
An interactive, runnable TypeScript val by bitbloxhub
Script
import { hnTopStory } from "https://esm.town/v/stevekrouse/hnTopStory?v=3";
export const hnTopStoryExample = hnTopStory();
dwelle avatar
purpleDog
@dwelle
An interactive, runnable TypeScript val by dwelle
Script
console.log(42)
megafredrik avatar
dailyDadJoke
@megafredrik
Daily Dad Joke How do you make a programmer laugh every morning? A dad joke cron job! Setup Fork this val Click Create fork 🤣🤣🤣🤣 API This val uses the icanhazdadjoke API . You can find more docs here , such as how to filter by type .
Cron
# Daily Dad Joke
How do you make a programmer laugh every morning?
A dad joke cron job!
## Setup
1. [Fork this val](https://www.val.town/v/stevekrouse/dailyDadJoke/fork)
2. Click **Create fork**
export async function dailyDadJoke() {
let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
return email({
text: punchline,
seanehalpin avatar
placemarkGlobeMonitor
@seanehalpin
Figma plugin statistics collector
Cron
## Figma plugin statistics collector
async function fetchPluginData(pluginId) {
const response = await fetch(`https://www.figma.com/api/plugins/${pluginId}/versions`);
if (!response.ok) {
throw new Error(`Failed to fetch data for plugin ${pluginId}: ${response.statusText}`);
const data = await response.json();
return data.meta.plugin;
export default async function(interval: Interval) {
try {
const microPlugin = await fetchPluginData("1349001943025285729");
lordsknow avatar
rearPurpleHare4rfwdsvxefwdsxefwdcsx
@lordsknow
An interactive, runnable TypeScript val by lordsknow
HTTP (deprecated)
export default async function (e: Email) {
tal avatar
parseMenuOffering
@tal
An interactive, runnable TypeScript val by tal
Script
export async function parseMenuOffering(text: string) {
/** get rid of the wrapping {} */
const stripped = text.slice(1, -1);
const items = stripped.split("|");
return {
items,