Skip to content

Instantly share code, notes, and snippets.

View willcode4food's full-sized avatar

Marc Arbesman willcode4food

View GitHub Profile
@willcode4food
willcode4food / cloudSettings
Last active March 5, 2021 21:31
Visual Studio Code Settings Sync Gist for JavaScript/TypeScript Development
{"lastUpload":"2021-03-05T21:31:26.169Z","extensionVersion":"v3.4.3"}
@willcode4food
willcode4food / calcViewBox.js
Last active August 29, 2019 13:59
Calculate Dynamic Aspect Ratio
// Thanks Kyle Mavis!!
const calcViewBox = ({width=0, heigth=0, baseWidth=0, baseHeight=0}) => {
const defaultAspect = baseWidth / baseHeight;
const targetAspect = width / height;
if (targetAspect > defaultAspect) {
const height = baseHeight * (defaultAspect / targetAspect);
const y = (baseHeight - height) / 2;
return `0 ${y} ${baseWidth} ${height}`;
/*
I decided on the Script12 BT cursive font for now. Works better for me than FlottFlott.
*/
.mtk3 {
font-family: "Script12 BT";
font-size: 1em;
}
.mtk4 {
font-family: "Script12 BT";
font-size: 1em;