This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface WelcomeProps { | |
| name: string; | |
| } | |
| const Welcome: React.FC<WelcomeProps> = (props) => <h1>Hello, {props.name}</h1>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { PurgeCSS } = require('purgecss'); | |
| /** | |
| * Remove any CSS not used on the page and inline the remaining CSS in the | |
| * <head>. | |
| * | |
| * @see {@link https://github.com/FullHuman/purgecss} | |
| */ | |
| eleventyConfig.addTransform('purge-and-inline-css', async (content, outputPath) => { | |
| if (process.env.ELEVENTY_ENV !== 'production' || !outputPath.endsWith('.html')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Add the folder path to the repo's root .gitignore file: | |
| dist/ | |
| # 2. Remove the folder from the local git tracking, but keep it on your disk: | |
| git rm -r --cached dist/ | |
| # 3. Push the changes to the git repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, {FunctionComponent, useEffect, useRef, useState} from "react"; | |
| import "./ResizablePanel.css"; | |
| // ResizablePanel.css: | |
| /* | |
| .resizable-panel { | |
| display: flex; | |
| justify-content: space-between; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://github.com/tonaljs/tonal/issues/108 | |
| // To obtain the scale properties, use the scale function: | |
| import { scale } from "@tonaljs/scale" | |
| scale("G aeolian").notes // => ["G", "A", "Bb", ... ] | |
| // To obtain the chords, use the scaleChords function from the same package: | |
| import { scaleChords } from "@tonaljs/scale" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* https://css-tricks.com/snippets/css/system-font-stack/ */ | |
| /* System Fonts as used by GitHub */ | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | |
| } | |
| /* System Fonts as used by Medium and WordPress */ | |
| body { | |
| font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| AUTO GRID | |
| Set the minimum item size with `--auto-grid-min-size` and you'll | |
| get a fully responsive grid with no media queries. | |
| */ | |
| .auto-grid > * { | |
| max-width: 25rem; | |
| margin-left: auto; | |
| margin-right: auto; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // empty initial state | |
| const [pill, setPill] = useState<'red' | 'blue'>(); | |
| // JSX: {pill && <span>You chose {pill.toUpperCase()} pill!</span>} | |
| // clearable state | |
| export const PillSelector: React.FunctionComponent = () => { | |
| const [pill, setPill] = useState<'blue' | 'red' | undefined>('blue'); // <-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const ExampleSizes = () => { | |
| return [...Array(10)].map((i,j)=> | |
| <div style={{width:`${j*50}px`}}> | |
| ... | |
| </div> | |
| ); | |
| }; | |
| /* | |
| {[...Array(10)].map((i,j)=> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void dumpSession(HttpSession session) { | |
| for (Enumeration e = session.getAttributeNames(); e.hasMoreElements();) { | |
| String name = (String)e.nextElement(); | |
| LOG.debug("session: {}={}", name, session.getAttribute(name)); | |
| } | |
| } | |
| dumpSession(request.getSession()); |