Search

Results include substring matches and semantically similar vals. Learn more
sco avatar
denoImportEx
@sco
An interactive, runnable TypeScript val by sco
Script
export let denoImportEx = (async () => {
// const { DOMParser } = await import(
// "https://deno.land/x/deno_dom/deno-dom-wasm.ts"
// const { BskyAgent, AtpSessionEvent, AtpSessionData } = await import(
// "npm:atproto/api"
// const _ = await import("npm:lodash-es"); // The Lodash library exported as ES modules.
const { BskyAgent } = await import("npm:@atproto/api");
// return _.shuffle(_.zip([1, 2, 3, 4], [5, 6, 7, 8]));
const agent = new BskyAgent({
service: "https://scottraymond.com",
dhvanil avatar
val_T3Axgfc7n3
@dhvanil
An interactive, runnable TypeScript val by dhvanil
Script
export default async function handler(req) {
try {
const result = await (async () => {
function fibonacci() {
let a = 0, b = 1;
let lowestThreeDigit = 0;
while (b < 1000) {
let temp = b;
b = a + b;
a = temp;
realog avatar
aqiNotifier
@realog
An interactive, runnable TypeScript val by realog
Script
export async function aqiNotifier(location) {
// The realtime Air Quality Index (AQI) for any location
const myAQI = await easyAQI({
location: location,
const previousAQI = databaseVal.pop();
let direction = "";
if (myAQI.aqi < previousAQI.AQI) {
direction = "improving";
else if (myAQI.aqi > previousAQI.AQI) {
direction = "getting worse";
neverstew avatar
val
@neverstew
An interactive, runnable TypeScript val by neverstew
Script
export function val({ token, id }: {
token?: string;
id: string;
}): Promise<{
id: string;
author: {
id: string;
username: string;
name: string;
code: string;
stevekrouse avatar
Jumpchain_Website
@stevekrouse
@jsxImportSource https://esm.sh/hono@latest/jsx
HTTP
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
export const homepage = (c: Context) => {
return c.html(
<html>
<head>
<title>What is Jumpchain?</title>
<style
dangerouslySetInnerHTML={{
__html:
`:root{--slate1: hsl(200, 7%, 8.8%);--slate2: hsl(195, 7.1%, 11%);--slate3: hsl(197, 6.8%, 13.6%);--slate4: hsl
stevekrouse avatar
poembuilder
@stevekrouse
@jsxImportSource npm:hono@3/jsx
HTTP
/** @jsxImportSource npm:hono@3/jsx */
// await sqlite.execute(`
// CREATE TABLE IF NOT EXISTS poemlines2 (
// id INTEGER PRIMARY KEY autoincrement,
// line TEXT,
// safe TEXT
const app = new Hono();
app.get("/", async (c) => {
const poem = await sqlite.execute(`SELECT id, line FROM poemlines2 WHERE safe='SAFE'`);
return c.html(
rodrigotello avatar
hnEmail
@rodrigotello
// Forked from @stevekrouse.hnEmail
Script
export let hnEmail = async ({
posts,
footer,
posts: any[];
footer?: boolean; // undefined defaults to true
let authors = Array.from(new Set(posts.map((p) => p.author))).slice(0, 3);
let subject = `[HN Follow] New from ${authors.join(", ")}`;
let postTexts = await Promise.all(
posts.map(hnResultToHTML)
let footer_ = [
jcoleman avatar
handleDeerSpringContactForm
@jcoleman
An interactive, runnable TypeScript val by jcoleman
HTTP
export const renderFormAndSaveData = async (req: Request) => {
const origin = req.headers.get("origin");
// Pick out the form data
const formData = await req.formData();
const emailAddress = formData.get("email") as string;
const name = formData.get("name") as string;
const message = formData.get("message") as string;
email({ text: `${emailAddress}\n\n${name}\n\n${message}`, subject: "Contact Message" });
// Store form data
return Response.redirect(`${origin}/contact-confirmation`, 302);
dhvanil avatar
val_nOpADZhOkN
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
function fibonacci() {
let a = 0, b = 1;
let lowestThreeDigit = null;
while (b < 1000) {
if (b >= 100 && b < 1000) {
if (lowestThreeDigit === null) {
lowestThreeDigit = b;
dhvanil avatar
val_BUsb2yqi8y
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_BUsb2yqi8y(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
function generateStringProblems() {
const problems = [
"Write a function to find the longest palindromic substring",
"Implement a function to check if two strings are anagrams",
"Create a function to find the first non-repeating character",
"Write a function to perform string compression (e.g., 'aabbb' -> 'a2b3')",
pncumhsk avatar
get
@pncumhsk
An interactive, runnable TypeScript val by pncumhsk
Script
export let get = () => {
var res = fetch("https://tampere.sometec.fi/showSpace03S.php", {
credentials: "include",
headers: {
"User-Agent":
"Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0",
Accept: "application/json, text/javascript, */*; q=0.01",
"Accept-Language": "en-US,en;q=0.5",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With": "XMLHttpRequest",
thesophiaxu avatar
handler
@thesophiaxu
An interactive, runnable TypeScript val by thesophiaxu
Script
export async function handler(req, res) {
console.email(JSON.stringify(req.body, null, 4), "Hello from Val.town!");
janpaul123 avatar
valle_tmp_88140331236158369280490149661851
@janpaul123
// Initialize blob with an empty array if it doesn't exist
HTTP
// Initialize blob with an empty array if it doesn't exist
await blob.setJSON("stories", []);
// Function to get all stories
const getAllStories = async () => {
const stories = await blob.getJSON("stories");
return stories;
// Function to add a new story
const addStory = async (title, author) => {
const newStory = {
id: v4.generate(),
stevedylandev avatar
fetchIpfsPosts
@stevedylandev
An interactive, runnable TypeScript val by stevedylandev
Script
let currentDate = new Date();
let endDate = Math.floor(currentDate.getTime() / 1000);
let startDate = Math.floor(currentDate.setDate(currentDate.getDate() - 7) / 1000);
export async function fetchIPFSPosts() {
try {
const soRes = await fetch(
`https://api.stackexchange.com/2.3/questions?fromdate=${startDate}&todate=${endDate}&order=desc&sort=creation&tagged=up
method: "GET",
const soResData = await soRes.json();
const soItemsArray = soResData.items;
jonathan_oralart avatar
Download_All_Retool_Apps_and_Workflows_as_JSON
@jonathan_oralart
An interactive, runnable TypeScript val by jonathan_oralart
HTTP
function convertTransitToJson(transitData: any): any {
try {
const r = transit.reader("json", {
handlers: {
"m": function(v: string) {
return new Date(parseInt(v)).toISOString();
const transitValue = typeof transitData === "string"
? JSON.parse(transitData)
: transitData;
function isEmptyTransitCollection(obj: any): boolean {