This file contains 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 from "react"; | |
const scaleWidth = 500; | |
const scaleHeight = 500; | |
function draw(canvas, scaleX, scaleY) { | |
const context = canvas.getContext("2d"); | |
context.scale(scaleX, scaleY); | |
context.clearRect(0, 0, canvas.clientWidth, canvas.clientHeight); |
This file contains 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 from "react"; | |
function WidthAndHeight() { | |
const [width, setWidth] = React.useState(window.innerWidth); | |
const [height, setHeight] = React.useState(window.innerHeight); | |
React.useEffect(() => { | |
window.addEventListener("resize", updateWidthAndHeight); | |
return () => window.removeEventListener("resize", updateWidthAndHeight); | |
}); |
This file contains 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
require('colors'); | |
const lighthouse = require('lighthouse'); | |
const chromeLauncher = require('chrome-launcher'); | |
const launchAndRun = (url, opts, config = null) => | |
chromeLauncher.launch({ chromeFlags: opts.chromeFlags }) | |
.then(chrome => { | |
opts.port = chrome.port; | |
return lighthouse(url, opts, config).then(results => chrome.kill().then(() => results.lhr)); | |
}); |
This file contains 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 ClassName = () => { | |
const createdClasses = []; | |
const stringToCss = str => str.split('').map(c => c.charCodeAt(0) >= 97 | |
? c | |
: `-${String.fromCharCode(c.charCodeAt(0) + 32)}`).join(''); | |
const cssString = css => Object.keys(css).map(key => `${stringToCss(key)}:${css[key]}`).join(';'); | |
const addStyle = (name, css) => { |
This file contains 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
namespace Visitor | |
type IPrescription = | |
abstract member Accept : IPrescriptionVisitor -> unit | |
and IPrescriptionVisitor = | |
abstract member Visit : PointInTime -> unit | |
abstract member Visit : Infusion -> unit | |
and PointInTime() = |
NewerOlder