Based on https://bl.ocks.org/officeofjane/2c3ed88c4be050d92765de912d71b7c4
(gist: https://gist.github.com/officeofjane/2c3ed88c4be050d92765de912d71b7c4 )
MIT licensed.
Use node process.node.js to split into separate layout files.
| type OmitNull<T> = T extends null ? Exclude<T, null> | undefined : T; | |
| type OmitNullProps<T extends object> = { [Key in keyof T]: OmitNull<T[Key]> }; | |
| /** | |
| * Allow destructuring an object, turning any null properties into undefined so | |
| * a default can be given. If the given object may be null/undefined, then every | |
| * property may be undefined. | |
| * | |
| * Useful for assigning defaults for properties that may be null. In a usual destructuring | |
| * assignment, nulls are passed through so you can't provide a default for that case: |
| /** | |
| * Creates embed-friendly dist/fragment.html | |
| * | |
| * Install qwik: `npm create qwik@latest` | |
| * Configure static: https://qwik.builder.io/docs/guides/static-site-generation/#static-site-generation-config | |
| * In adapters/static/vite.config.ts place vitePluginQwikFragment() after the staticAdapter. | |
| * Build: `npm run build` | |
| * The file `dist/fragment.html` will be created. | |
| * To test: `npx serve dist` and open http://localhost:3000/fragment.html | |
| * |
| [...document.querySelectorAll('h1,h2,h3,h4,h5,h6')].filter(el => !el.textContent.trim()).forEach(el => console.log(el)) |
| // filename.json <-- the data | |
| // filename.json.d.ts <-- type definition (this file) | |
| // Just an example type | |
| const value: Record<string, string>; | |
| export default value; |
| export interface FetchInfo { | |
| uri: RequestInfo; | |
| init: RequestInit; | |
| res?: unknown; | |
| text?: string; | |
| error?: unknown; | |
| } | |
| function defaultLogger({uri, init, text}: FetchInfo): void { | |
| console.info({uri, text, init}); |
| import {useSyncExternalStore} from 'use-sync-external-store/shim'; | |
| const DOT = '.'; | |
| export default function createStore(defaultStore = {}) { | |
| let allStore = defaultStore; | |
| const listeners = new Set(); | |
| function subscribe(listener) { | |
| listeners.add(listener); |
| #!/bin/bash | |
| # Execution-relative (all shells). Get dir path of the script executed | |
| # by the user. | |
| __0="$(CDPATH= cd -- $(dirname -- $0) && pwd -P)" | |
| echo "$__0"/bar | |
| # Code-relative (bash/zsh only). Get dir path of *this file*, |
| #!/bin/bash | |
| # Like docker compose build [SERVICE]. | |
| # | |
| # USAGE: ddev-build [SERVICE] | |
| # | |
| function ddev-build { | |
| ~/.ddev/bin/docker-compose -f .ddev/.ddev-docker-compose-full.yaml build $1 --no-cache --progress=plain | |
| } |
| <body> | |
| <svg viewBox="0 0 200 200" height="200"> | |
| <circle cx="100" cy="100" r="90" pathLength="1" transform="rotate(-90 100 100)" class="percentage" stroke-dashoffset="0.9"></circle> | |
| </svg> | |
| <p> | |
| Set percentage: | |
| <button type="button">0</button> | |
| <button type="button">15</button> | |
| <button type="button">50</button> |
Based on https://bl.ocks.org/officeofjane/2c3ed88c4be050d92765de912d71b7c4
(gist: https://gist.github.com/officeofjane/2c3ed88c4be050d92765de912d71b7c4 )
MIT licensed.
Use node process.node.js to split into separate layout files.