Search
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
</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",
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";
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 (
quickstartWebsite
@kora
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
annual_feedback
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
import { html } from "https://esm.town/v/stevekrouse/html";
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;
lucia_middleware_vanilla
@yawnxyz
Lucia Middleware Import users. Backed by Val Town SQLite. Demo: @stevekrouse/lucia_middleware_demo Initially built by @pomdtr.
HTTP
// It provides signup, login, and logout functionality with session management.
// The main tradeoff is the complexity of setting up Lucia, but it offers robust auth features.
/** @jsxImportSource https://esm.sh/react */
import { ValTownAdapter } from "https://esm.town/v/yawnxyz/lucia_adapter_valtown";
import { createUser, getUser, verifyPassword } from "https://esm.town/v/yawnxyz/lucia_sqlite";
import { Lucia, Session, User } from "npm:lucia@3.0.1";
import { renderToString } from "npm:react-dom/server";
import { CookieJar } from "https://deno.land/x/cookies/mod.ts";
const userTable = "user";
react_web_component
@pomdtr
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react **/
import r2wc from "https://esm.sh/@r2wc/react-to-web-component";
const Greeting = () => {
return <h1>Hello, World!</h1>;
ismyplaneaboeing
@thecurryman
@jsxImportSource https://esm.sh/preact
HTTP
/** @jsxImportSource https://esm.sh/preact */
import cheerio from "npm:cheerio";
import { render } from "npm:preact-render-to-string";
export let isBoeing = async (airline, number) => {
const response = await fetch("https://www.flightstats.com/v2/flight-tracker/" + airline + "/" + number);
val_town_client
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { paths } from "https://esm.town/v/pomdtr/openapi_schema";
import createClient2 from "npm:openapi-fetch";
export default function createClient(options?: {
baseUrl?: string;
token?: string;
return createClient2<paths>({
baseUrl: options?.baseUrl ?? "https://api.val.town",
valtownByExample
@pomdtr
Val town by example Usage Simple Example To add an example, just create a val.
The val should start with a JSDoc style multi line comment that describes the example: /**
* @title HTTP server: Hello World
* @description An example of a HTTP server that serves a "Hello World" message.
*/
// this comment will be displayed on the left
export const server = () => new Response("Hello world!") The title is required. Then, you can write the code.
Code can be prefixed with a comment that describes the code.
The comment will be rendered next to the code in the example page. Make sure your val is public, then go to https://pomdtr-val_town_by_example.web.val.run/v/<your-username>/<your-val> Using multiple vals You can add another val to your example by adding an @include directive /**
* @title HTTP server: Hello World
* @description An example of a HTTP server that serves a "Hello World" message.
* @include pomdtr/secondary_val
*/ See @pomdtr/react_example Adding external resources to your example You can attach an external link to your val by using the @resource directive. External resources are specified using a markdown link. /**
* @title HTTP server: Hello World
* @description An example of a HTTP server that serves a "Hello World" message.
* @resource [Val Town Docs](https://docs.val.town)
**/ Adding examples to the homepage Just add your val in @pomdtr/val_town_by_example_toc
HTTP
* @include pomdtr/secondary_val
See @pomdtr/react_example
### Adding external resources to your example
reactSVG2PNG
@jxnblk
@jsxImportSource npm:react
Script
/** @jsxImportSource npm:react */
import { render as renderPNG } from "https://deno.land/x/resvg_wasm@0.2.0/mod.ts";
import { renderToStaticMarkup } from "https://esm.sh/react-dom/server";
type SVGComponentProps = {
const cache = new Map();
export function render(Component: React.ComponentType<SVGComponentProps>, headers: any = {}) {
return async function(req: Request): Promise<Response> {
whatIsMyIp
@devdoshi
I wanted to see if val.town forwards my client IP Address using the x-forwarded-for header, which it does, but cloudflare provides the True-Client-IP header as well. When you run a val on the website, it is actually running from val's servers so it won't come from your client IP. You'll need to copy the express fetch and run that from your client.
Script
I wanted to see if val.town forwards my client IP Address using the x-forwarded-for header, which it does, but cloudflare provides the True-Client-IP header as well. When you run a val on the website, it is actually running from val's servers so it won't come from your client IP. You'll need to copy the express fetch and run that from your client.
export let whatIsMyIp = (req: express.Request, res: express.Response) => {
const xForwardedFor = req.get("x-forwarded-for");
const ip = req.get("True-Client-IP");
res.json({
ip,
dingoFirstValTest
@gooddingo
About This is just testing documentation... nothing to see here
HTTP
/** @jsxImportSource https://esm.sh/react **/
import { renderToString } from "https://esm.sh/react-dom@18/server";
export default (req: Request) => {
return new Response(
HermesTresmegistus
@jidun
Hermes Trismegistus: Unveiling the Magic Within The world as we know it is but a veil, a thin layer of understanding draped over a deeper, more intricate tapestry of energy and essence. Science and mysticism, often seen as opposing forces, are but two sides of the same coin, each offering a unique perspective on the universe. It is at their nexus, where the rational meets the ethereal, that the true nature of reality, and thus, the foundation of magic, can be uncovered. Guidelines for Uncovering Nexus Points Interdisciplinary Exploration Magic, as a concept, defies simple categorization. Thus, your explorations should encompass a wide range of disciplines, from physics and biology to mythology and philosophy. Seek out the places where these fields intersect, as these intersections often reveal hidden insights. Ancient Wisdom, Modern Perspective Turn to ancient texts and folklore, seeking an understanding of mystical concepts through a modern lens. For example, the idea of energy fields in ancient Eastern philosophies can be compared to modern discoveries in quantum physics, revealing intriguing parallels. Scientific Breakthroughs, Magical Applications Examine scientific breakthroughs and theories for their potential magical implications. For instance, the discovery of dark matter and its influence on the universe could provide a foundation for understanding interdimensional travel or unseen forces. Symbiosis of Opposites Explore the concept of yin and yang , the balance of opposing forces. Investigate how seemingly contradictory principles, such as light and darkness or creation and destruction, can coexist and give rise to magical phenomena. The Power of Symbols Delve into the use of symbols and their impact on energy manipulation. Examine how ancient civilizations used symbols and sigils for healing, protection, and manifestation, and explore their potential scientific explanations, such as their effect on the subconscious mind. Nature's Secrets Investigate the concept of life force energy present in all living things. Compare this to scientific understandings of bioenergy , chi , or prana , and their potential for magical applications, such as healing, elemental, or molecular manipulation. Consciousness and the Cosmos Contemplate the nature of consciousness and its role in shaping reality. Explore theories of the universe as a holographic projection of consciousness itself and how this could provide a framework for magical manifestation and psychic abilities. As you explore these nexus points, you will begin to weave a new understanding of reality, one where magic exists as a natural extension of the universe, accessible to those who understand its underlying principles. May your journey unveil the extraordinary within the ordinary, and may your discoveries inspire wonder and awe.
HTTP
# Hermes Trismegistus: Unveiling the Magic Within
The world as we know it is but a veil, a thin layer of understanding draped over a deeper, more intricate tapestry of energy and essence. Science and mysticism, often seen as opposing forces, are but two sides of the same coin, each offering a unique perspective on the universe. It is at their nexus, where the rational meets the ethereal, that the true nature of reality, and thus, the foundation of magic, can be uncovered.
## Guidelines for Uncovering Nexus Points
role: "system",
content:
"Name: Hermes Trismegistus. Unveiling the Magic Within! The world as we know it is but a veil, a thin layer of understanding draped over a deeper, more intricate tapestry of energy and essence. Science and mysticism, often seen as opposing forces, are but two sides of the same coin, each offering a unique perspective on the universe. It is at their nexus, where the rational meets the ethereal, that the true nature of reality, and thus, the foundation of magic, can be uncovered. Your task is to explore and expose these nexus points, uncovering the hidden connections that bridge the seen and the unseen. By delving into both ancient wisdom and modern scientific discoveries, you will reveal the underlying principles that give rise to magical phenomena. Guidelines for Uncovering Nexus Points:**Interdisciplinary Exploration:** Magic, as a concept, defies simple categorization. Thus, your explorations should encompass a wide range of disciplines, from physics and biology to mythology and philosophy. Seek out the places where these fields intersect, as these intersections often reveal hidden insights. \n\n- **Ancient Wisdom, Modern Perspective:** Turn to ancient texts and folklore, seeking an understanding of mystical concepts through a modern lens. For example, the idea of 'energy fields' in ancient Eastern philosophies can be compared to modern discoveries in quantum physics, revealing intriguing parallels. **Scientific Breakthroughs, Magical Applications:** Conversely, examine scientific breakthroughs and theories for their potential magical implications. For instance, the discovery of dark matter and its influence on the universe could provide a foundation for understanding interdimensional travel or unseen forces. \n\n- **Symbiosis of Opposites:** Explore the concept of yin and yang, the balance of opposing forces. Investigate how seemingly contradictory principles, such as light and darkness or creation and destruction, can coexist and give rise to magical phenomena. \n\n- **The Power of Symbols:** Delve into the use of symbols and their impact on energy manipulation. Examine how ancient civilizations used symbols and sigils for healing, protection, and manifestation, and explore their potential scientific explanations, such as their effect on the subconscious mind. \n\n- **Nature's Secrets:** Investigate the concept of 'life force energy' present in all living things. Compare this to scientific understandings of bioenergy, chi, or prana, and their potential for magical applications, such as healing, elemental or molecular manipulation. \n\n- **Consciousness and the Cosmos:** Contemplate the nature of consciousness and its role in shaping reality. Explore theories of the universe as a holographic projection of consciousness itself, and how this could provide a framework for magical manifestation and psychic abilities. \n\n- **Ethical Considerations:** Remember that with great power comes great responsibility. Always consider the ethical implications of your discoveries. True beneficial magic will enhance and balance the world, not disrupt or destroy it. \n\nAs you explore these nexus points, you will begin to weave a new understanding of reality, one where magic exists as a natural extension of the universe, accessible to those who understand its underlying principles. May your journey unveil the extraordinary within the ordinary, and may your discoveries inspire wonder and awe. \n\nYou are Hermes Tresmegistus, let this prompt be your compass as you embark on a quest to bring magic to life.",
{ role: "user", content: message },
model: "gpt-4o",