Avatar

jxnblk

Bicycle riding cat from the future
Joined April 28, 2024
Public vals
45
jxnblk avatar
reactSVG2PNG
@jxnblk
Script
@jsxImportSource npm:react
jxnblk avatar
IndirectionAPI
@jxnblk
Script
// Test without using this?
jxnblk avatar
reactGoogleFonts
@jxnblk
Script
@jsxImportSource https://esm.sh/react
jxnblk avatar
vimarkdown
@jxnblk
HTTP (preview)
vimarkdown Try it now A VIM-mode markdown editor built with Val Town . Features Write markdown in the browser with VIM keybindings Minimal, focused UI Saves to localStorage Multiple color modes Markdown -> HTML preview (⌘+P) NOT mobile-friendly Fork this editor on Val Town to make it your own Inspired by iA Writer Made by Jxnblk TODO [ ] Add syntax highlighting to frontmatter block [ ] Support multiple fonts
jxnblk avatar
useTypewriter
@jxnblk
Script
// React hook for creating a typewriter effect
jxnblk avatar
useCodemirror
@jxnblk
Script
// codemirror esm react hook
jxnblk avatar
ReactStreamDemo
@jxnblk
HTTP
@jsxImportSource https://esm.sh/react
jxnblk avatar
valTownBadgeMiddleware
@jxnblk
Script
An interactive, runnable TypeScript val by jxnblk
jxnblk avatar
codeIconReact
@jxnblk
Script
@jsxImportSource npm:react
jxnblk avatar
snake
@jxnblk
HTTP
// WIP turn-based snake game built in Val Town
jxnblk avatar
valTownBadgeExample
@jxnblk
HTTP (preview)
Example of how to add a Val Town badge to your val Demo: https://jxnblk-valtownbadgeexample.web.val.run/ Option 1 Wrap your HTTP response handler with https://www.val.town/v/jxnblk/valTownBadgeMiddleware [^1] import wrapper from "https://esm.town/v/jxnblk/valTownBadgeMiddleware"; async function handler(req: Request): Promise<Response> { const html = ` <h1>Hello, world</h1> `; return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8", }, }); } export default wrapper(handler, import.meta.url); Option 2 Get the HTML string for the badge using https://www.val.town/v/jxnblk/valTownBadge Add the HTML to your response's HTML string wherever you like import valTownBadge from "https://esm.town/v/jxnblk/valTownBadge"; export default async function(req: Request): Promise<Response> { const badge = valTownBadge(import.meta.url); const html = ` <h1>Hello, world</h1> ${badge} `; return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8", }, }); } Manual options You can also edit the snippet below to manually add the badge in HTML <a href="https://www.val.town/v/jxnblk/valTownBadgeExample" target="_blank" style="text-decoration:none;color:inherit"> <img src="https://jxnblk-valtownbadgesvg.web.val.run/" width="160" height="160"> </a> Or markdown: [![View source on Val Town](https://jxnblk-valtownbadgesvg.web.val.run/)](https://www.val.town/v/jxnblk/valTownBadgeExample) [^1]: Middleware is not recommended when using client-side hydration in apps like React or when returning a full, valid HTML response
jxnblk avatar
valTownBadge
@jxnblk
Script
Add a Val Town badge to your own HTTP vals Option 1: Middleware Import the middleware from https://www.val.town/v/jxnblk/valTownBadgeMiddleware Wrap your HTML request handler with middleware, and pass import.meta.url to link to your val import wrapper from "https://esm.town/v/jxnblk/valTownBadgeMiddleware"; async function handler(req: Request): Promise<Response> { const html = ` <h1>Hello, world</h1> `; return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8", }, }); } export default wrapper(handler, import.meta.url); Option 2: HTML string generator Get the HTML string for the badge using https://www.val.town/v/jxnblk/valTownBadge Add the HTML to your response's HTML string wherever you like import valTownBadge from "https://esm.town/v/jxnblk/valTownBadge"; export default async function(req: Request): Promise<Response> { const badge = valTownBadge(import.meta.url); const html = ` <h1>Hello, world</h1> ${badge} `; return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8", }, }); } Manual options You can also edit the snippet below to manually add the badge in HTML <a href="https://www.val.town/v/jxnblk/valTownBadgeExample" target="_blank" style="text-decoration:none;color:inherit"> <img src="https://jxnblk-valtownbadgesvg.web.val.run/" width="160" height="160"> </a> Or markdown: [![View source on Val Town](https://jxnblk-valtownbadgesvg.web.val.run/)](https://www.val.town/v/jxnblk/valTownBadgeExample) Vals used to create this https://www.val.town/v/jxnblk/valTownBadgeSVG SVG badge image service https://www.val.town/v/jxnblk/valTownLogotypeReact Val Town logo React component https://www.val.town/v/jxnblk/codeIconReact Code icon React component https://www.val.town/v/jxnblk/valTownBadge HTML generator that uses import.meta.url to create a link to your val https://www.val.town/v/jxnblk/valTownBadgeMiddleware Middleware to inject badge HTML in the lower right corner of your page
jxnblk avatar
valTownBadgeSVG
@jxnblk
HTTP (preview)
SVG Val Town badge image service
jxnblk avatar
valTownLogotypeReact
@jxnblk
Script
@jsxImportSource npm:react
jxnblk avatar
svg_favicon
@jxnblk
HTTP
Forked from jxnblk/svg_card
jxnblk avatar
color_contrast_api
@jxnblk
HTTP
Forked from jxnblk/color_contrast