Search

Results include substring matches and semantically similar vals. Learn more
stevekrouse avatar
todo_list
@stevekrouse
Example Full-stack Todo List App with React SSR + Client-side hydration & sqlite Requires you to put the React component in another val, in this case: https://www.val.town/v/stevekrouse/TodoApp
HTTP
# Example Full-stack Todo List App with React SSR + Client-side hydration & sqlite
Requires you to put the React component in another val, in this case: https://www.val.town/v/stevekrouse/TodoApp
import ssr_hydrate from "https://esm.town/v/stevekrouse/ssr_hydrate_react";
export default ssr_hydrate("stevekrouse", "TodoApp");
CoachCompanion avatar
efficientAmberUnicorn
@CoachCompanion
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState, useEffect, useRef } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import { marked } from "https://esm.sh/marked@4.3.0";
score += Math.min(tagScore, 0.3); // Cap tag score at 0.3
// Consider channel relevance
if (videoData.channelTitle.toLowerCase().includes(sport.toLowerCase())) {
nn avatar
bingo
@nn
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import confetti from "https://esm.sh/canvas-confetti";
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function slugify(text: string): string {
const termCount = terms.split("\n").filter(t => t.trim()).length;
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
origin: { y: 0.6 },
// Fire again from the sides after a small delay
setTimeout(() => {
localStorage.setItem(`bingo-${gameId}-${playerId}`, JSON.stringify(newChecked));
const handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newName = e.target.value;
</div>
function client() {
const root = document.getElementById("root");
<BingoCard gameId={gameId} playerId={playerId} name={name} terms={terms} />,
if (typeof document !== "undefined") { client(); }
export default async function server(req: Request): Promise<Response> {
all avatar
passwordGen
@all
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import confetti from "https://esm.sh/canvas-confetti@1.6.0";
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function AlbertiCipherDisk({ outerRotation, innerRotation, onRotate }) {
<h2 className="text-3xl font-bold mb-6">Advanced Password Generation System: Usage Instructions</h2>
<ol className="list-decimal list-inside space-y-4 mb-6 text-lg">
<li>
<li>Utilize the Alberti Cipher Disk to introduce an additional layer of cryptographic complexity:</li>
<ul className="list-disc list-inside ml-6 space-y-2">
<li>
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
stevekrouse avatar
lastlogin
@stevekrouse
LastLogin Auth LastLogin Auth is the simplest way to add user authentication to your HTTP val. LastLogin is a decentralized hosted auth provider that enables login to any app through email, Google, Github, etc without API keys. This val exports middleware that can be added to any HTTP val. Login with Google While LastLogin supports many login providers, it's often simplest to have a single "Login with Google" button. Live Demo How to setup These instructions were written to be easily copy-and-pasteable into LLMs like Townie. import { lastlogin } from "https://esm.town/v/stevekrouse/lastlogin_safe" Wrap & export the main HTTP handler: export default lastlogin(handler) . In the HTTP handler, retrieve the user's email: const email = request.headers.get("X-LastLogin-Email") If email, show that user's content, and a logout link to "/auth/logout"; if no email, show login options. import { LoginWithGoogleButton } from "https://esm.town/v/stevekrouse/LoginWithGoogleButton" Use the React Component, optionally supplying the text attribute Add "via LastLogin" underneat LoginWithGoogleButton, centered, secondary text, linking to https://lastlogin.io/ Pass the email from the server to the client-side code if using React hydration or similar techniques. How it works Your users click on the React Component in your app The opens a new window to /auth/login?provider=google in your app This middleware directs them to log into Google via LastLogin They log in to Google Google redirects to LastLogin, who redirects back to /auth/callback in your app This middleware "logs them in" to your app by giving them a session cookie. In your app, you can read the X-LastLogin-Email header to see which (if any) user is logged in Login with LastLogin The classic LastLogin authentication flow is to redirect your user to lastlogin.io/login , where they can pick which way to login: email, Google, Github, etc. Live Demo How to set up These instructions were written to be easily copy-and-pasteable into LLMs like Townie. import { lastlogin } from "https://esm.town/v/stevekrouse/lastlogin_safe" Wrap & export the main HTTP handler: export default lastlogin(handler) . In the HTTP handler, retrieve the user's email: const email = request.headers.get("X-LastLogin-Email") If email, show that user's content, and a logout link to "/auth/logout"; If no email, add a link to "Login or Sign Up" to "/auth/login" Pass the email from the server to the client-side code if using React hydration or similar techniques. How it works Your users click on a link to /auth/login in your app This middleware directs them to login via LastLogin They authenticate to LastLogin LastLogin redirects them back to your app This middleware "logs them in" to your app by giving them a session cookie. In your app, you can read the X-LastLogin-Email header to see which (if any) user is logged in Notes If you want username & password auth: @stevekrouse/lucia_middleware This middleware stores sessions in the lastlogin_session table in your Val Town SQLite This val has NOT been properly audited for security. I am not a security expert. I would suggest only using it for demos, prototypes, or apps where security is not paramount. If you are a security expert, I would appreciate your help auditing this! Todos [ ] Let the user customize the name of the SQLite table [ ] Get a proper security audit for this
Script
* `import { LoginWithGoogleButton } from "https://esm.town/v/stevekrouse/LoginWithGoogleButton"`
* Use the <LoginWithGoogleButton /> React Component, optionally supplying the `text` attribute
* Add "via LastLogin" underneat LoginWithGoogleButton, centered, secondary text, linking to https://lastlogin.io/
* Pass the email from the server to the client-side code if using React hydration or similar techniques.
### How it works
1. Your users click on the <LoginWithGoogleButton /> React Component in your app
2. The <LoginWithGoogleButton /> opens a new window to /auth/login?provider=google in your app
* If no email, add a link to "Login or Sign Up" to "/auth/login"
* Pass the email from the server to the client-side code if using React hydration or similar techniques.
### How it works
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.net/token");
tokenUrl.searchParams.set("client_id", clientID);
tokenUrl.searchParams.set("code", code);
const provider = url.searchParams.get("provider");
authUrl.searchParams.set("client_id", clientID);
authUrl.searchParams.set("redirect_uri", redirectUri);
vawogbemi avatar
TaylorSwiftMoments
@vawogbemi
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import { createFalClient } from "https://esm.sh/@fal-ai/client";
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const swiftEras = [
console.error("Error fetching images:", error);
const generateImage = async (e?: React.FormEvent) => {
e?.preventDefault();
try {
// Enhance the prompt using the server-side endpoint
const enhancedPromptResponse = await fetch("/api/enhance-prompt", {
console.log("Enhanced Prompt:", enhancedPrompt);
const fal = createFalClient({
proxyUrl: "/api/fal/proxy",
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(req: Request): Promise<Response> {
NZHEATPUMPS avatar
Calculator
@NZHEATPUMPS
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import React, { useState } from "https://esm.sh/react@18.2.0";
function ACCalculator() {
baseBTU += ((height - 2.4) * 3.28084) * length * width * 2.5;
// Regional and efficiency considerations
const adjustedBTU = baseBTU * regionFactor.heating;
</div>
function client() {
createRoot(document.getElementById("root")).render(<ACCalculator />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
karkowg avatar
lazyCook
@karkowg
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
function extractJSONFromMarkdown(markdown: string): string {
ingredients ? ` using some or all of these ingredients: ${ingredients}` : ""
dietaryRestrictions ? ` considering these dietary restrictions or allergies: ${dietaryRestrictions}` : ""
}. Be creative and prefer interesting rather than predictable dishes, unless the list of provided ingredients, if any, do
veer avatar
peachcat
@veer
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY Todos I'm looking for collaborators to help. Fork & send me PRs! [ ] Experiment with two prompt chain (started here )
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
setPrompt: React.Dispatch<React.SetStateAction<string>>;
handleSubmit: (e: React.FormEvent) => void;
const previewRef = React.useRef<HTMLDivElement>(null);
async function handleSubmit(e: React.FormEvent | string) {
<React.Fragment key={iframeKey}>
</React.Fragment>
ylp1472 avatar
NeuroHub_Coder
@ylp1472
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY Todos I'm looking for collaborators to help. Fork & send me PRs! [ ] Experiment with two prompt chain (started here )
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
setPrompt: React.Dispatch<React.SetStateAction<string>>;
handleSubmit: (e: React.FormEvent) => void;
const previewRef = React.useRef<HTMLDivElement>(null);
async function handleSubmit(e: React.FormEvent | string) {
<React.Fragment key={iframeKey}>
</React.Fragment>
iamseeley avatar
personalData
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
"highlights": [
platform with secure authentication and full CRUD capabilities, streamlining client operations.",
"Crafted a website for a food truck that captures their unique branding and playful image. The site features a fun, u
eloped a responsive, accessibility-focused website for a law firm, improving client accessibility and increasing inquiries by
"company": "Mindpool",
"Integrated GPT-3.5 for prompt enhancement, significantly improving image and video quality.",
"Overcame the challenge of running FFmpeg client-side in Next.js, enabling real-time video processing in the browser.
"url": "https://github.com/iamseeley/falbulous-minimovie"
"name": "Web Development",
"keywords": ["HTML5", "CSS", "Tailwind CSS", "React", "Next.js", "Vite", "FastAPI", "Hono", "Framer Motion"]
"name": "Programming",
stevekrouse avatar
townie_prompt
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const TOWNIE_SYSTEM_PROMPT =
ement should include a target=\"_top\" attribute.\n\n * If the val contains client-side code, add this script tag to the HTM
stevekrouse avatar
neatBlackSwift
@stevekrouse
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY Todos I'm looking for collaborators to help. Fork & send me PRs! [ ] Experiment with two prompt chain
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
setPrompt: React.Dispatch<React.SetStateAction<string>>;
handleSubmit: (e: React.FormEvent) => void;
const previewRef = React.useRef<HTMLDivElement>(null);
async function handleSubmit(e: React.FormEvent | string) {
<React.Fragment key={iframeKey}>
</React.Fragment>
granin avatar
sqlite
@granin
LLM-Safe Fork of @std/sqlite We found that LLMs have trouble with the inputs and outputs of our @std/sqlite method. It expects the input to be (sql: string, args: any[]) but it's { sql: string, args: any[] } It expects the output to be objects, but they are arrays Instead of struggling to teach it, we built this val to be a wrapper around @std/sqlite that adheres to what the LLMs expect. This val is also backwards-compatible with @std/sqlite, so we're considering merging it in.
Script
Instead of struggling to teach it, we built this val to be a wrapper around @std/sqlite that adheres to what the LLMs expect.
This val is also backwards-compatible with @std/sqlite, so we're considering merging it in.
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { nanoid } from "https://esm.sh/nanoid";
</div>
window.initClient = function() {
const rootElement = document.getElementById("root");
if (typeof document !== "undefined") {
window.initClient();
export default async function server(request: Request): Promise<Response> {
<script>
window.initClient && window.initClient();
</script>
diegoivo avatar
invitingMagentaFlyingfish
@diegoivo
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY Todos I'm looking for collaborators to help. Fork & send me PRs! [ ] Experiment with two prompt chain (started here )
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
setPrompt: React.Dispatch<React.SetStateAction<string>>;
handleSubmit: (e: React.FormEvent) => void;
const previewRef = React.useRef<HTMLDivElement>(null);
async function handleSubmit(e: React.FormEvent | string) {
<React.Fragment key={iframeKey}>
</React.Fragment>