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
// tested on: https://www.youtube.com/results?search_query=chrome+performance | |
const styleElement = document.createElement("style"); | |
styleElement.innerHTML = ` | |
@property --unused-property-no-inherit { inherits: false } | |
*, *:before, *:after { box-sizing: inherit } | |
.opacity-30 { | |
opacity: 0.3; | |
} |
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 styleElement = document.createElement("style"); | |
styleElement.innerHTML = `@property --unused-property-no-inherit { inherits: false }` | |
document.head.appendChild(styleElement); | |
const styleSheet = styleElement.sheet; | |
setTimeout(() => { | |
performance.mark("inject html opacity 0.5"); | |
console.log("add to <html> opacity: 0.5"); | |
styleSheet.insertRule("html { opacity: 0.5 }", styleSheet.cssRules.length); | |
}, 1000); |
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
brew update | |
brew install Cmake protobuf rust python | |
git clone https://github.com/bfirsh/stable-diffusion.git | |
git checkout apple-silicon-mps-support | |
mkdir -p models/ldm/stable-diffusion-v1/ | |
# accept license and download the model | |
# sd-v1-4.ckpt from: | |
# https://huggingface.co/CompVis/stable-diffusion-v-1-4-original |
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
#!/usr/bin/env bash | |
git fetch & | |
MAIN_BRANCH="main" | |
# detect master / main branch | |
if [ "$(git rev-parse --quiet --verify $MAIN_BRANCH)" ]; then | |
echo "main branch: ${MAIN_BRANCH}" | |
else | |
MAIN_BRANCH="master" |
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
export const actionCreator = <TState>() => <TOptions extends {}>( | |
actionHandler: ActionHandler<TOptions, TState> | |
) => actionHandler; | |
type ActionHandler<TOptions extends {}, TState extends {}> = ( | |
state: TState, | |
options: TOptions | |
) => TState; | |
type ActionOptions<T> = T extends ActionHandler<infer TOptions, infer State> | |
? TOptions | |
: never; |
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
//https://codepen.io/anon/pen/XyVQyp | |
setUpTestEnvironment(); | |
console.log('Test', 500) | |
setViewportSize(500); | |
assert.equal(meassureElementWidth('.content'), 500) |
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
export default function() { | |
return import('react-dom'); | |
} |
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 viewportClassPrefix = (viewport: 'xs' | 'sm' | 'md' | 'lg') => viewport === 'xs' ? '' : ('-' + viewport); | |
const flexAlignment = { | |
col: { | |
direction: { | |
outer: (viewport: 'xs' | 'sm' | 'md' | 'lg') => `flex${viewportClassPrefix(viewport)}-column`, | |
inner: (viewport: 'xs' | 'sm' | 'md' | 'lg') => `flex${viewportClassPrefix(viewport)}-row`, | |
}, |
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
interface Box { | |
height: number; | |
width: number; | |
color: 'RED' | 'BLUE' | |
} | |
function logColor(box: Box) { | |
switch (box.color) { | |
case 'RED': | |
console.log(box, 'is red'); |
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
interface Box { | |
height: number; | |
width: number; | |
color: 'RED' | 'BLUE' | |
} | |
function logColor(box: Box) { | |
switch (box.color) { | |
case 'RED': | |
console.log(box, 'is red'); |
NewerOlder