Skip to content

Instantly share code, notes, and snippets.

View kriskarpenko's full-sized avatar
🫀

Kristina Karpenko kriskarpenko

🫀
  • 02:34 (UTC +02:00)
View GitHub Profile
@karpolan
karpolan / mobileOrDesktop.js
Created December 31, 2020 10:14
React with Next/SSR/SSG, useful .onMobile or .onDestop class selector to apply different CSS styles
// In main App or Layout component add following:
const isMobile = useMediaQuery({ maxWidth: 767 }); // From react-responsive, Material UI or other styling library
useEffect(() => {
// Due to SSR/SSG we can not set 'app-layout onMobile' or 'app-layout onDesktop' on the server
// If we modify className using JS, we will got Warning: Prop `className` did not match. Server: "app-layout" Client: "app-layout onDesktop"
// So we have to apply document.body.class using the hook :)
if (isMobile) {
document.body.classList.remove('onDesktop');
@mike-casas
mike-casas / install-nvm-zsh.txt
Last active June 13, 2024 00:46
install nvm on mac with zsh shell
After install zsh
- brew update
- brew install nvm
- mkdir ~/.nvm
after in your ~/.zshrc or in .bash_profile if your use bash shell:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh