Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Ilyaev alexilyaev

View GitHub Profile
View env-configs.md

Configs + Environment Variables

.env

Pros

  • Very simple to setup.
  • Automatically assigns configured values on top of process.env.
  • Automatically supports overriding configured values via Environment Variables.
  • Promotes best practices (FAQ):
@alexilyaev
alexilyaev / eslint-no-null.md
Last active Mar 4, 2021
ESLint `no-null` rule from `eslint-plugin-unicorn`
View eslint-no-null.md
@alexilyaev
alexilyaev / StackBlitz.md
Last active May 23, 2021
Checking out StackBlitz Web Containers
View StackBlitz.md

StackBlitz - Introducing WebContainers: Run Node.js natively in your browser

Good Things

  • Really easy to start up a new project and play around with it locally (like in CodeSandbox, but supports Node.js as well).
    • Turns out CodeSandbox have an experimental support for Node.js projects as well 😳 I don't know if they run it locally or remotely, and you can't clone and existing Node repo and run it.
  • Can connect to any repo on GitHub and play around with the code (if the Node.js version matches):
    • If it's my repo, I can directly commit to it. That's actually nice, cause it could be a very fast workflow for quick changes.
  • Can run on a Tablet or Chromebook.
@alexilyaev
alexilyaev / user-settings.json
Last active May 8, 2022
VS Code Common Settings
View user-settings.json
{
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
@alexilyaev
alexilyaev / emotion-guidelines.md
Last active May 16, 2022
CSS in JS - Emotion Guidelines
View emotion-guidelines.md

CSS-in-JS

This repo uses a CSS-in-JS library called Emotion for its styling.

Why Emotion?

Emotion is a performant and flexible CSS-in-JS library. Building on many other CSS-in-JS libraries, it allows us to style apps quickly with string or object styles. It has predictable composition to avoid specificity issues in CSS. With source maps and labels, Emotion has a great developer experience and performance with heavy caching in production.

Also, Material UI v5 will most likely use Emotion instead of JSS:
material-ui - [RFC] v5 styling solution

@alexilyaev
alexilyaev / . README.md
Last active May 18, 2022
Setup ESLint with Prettier
View . README.md

ESLint with Prettier Setup

Basically, when using Prettier, all ESLint styling rules should be disabled.
This can be done with eslint-config-prettier.

See .eslintrc.js example below.
In prettier.config.js you can use anything you want (see example below).

Now the tricky part is how to run them...
Usually ESLint should run first, then Prettier.

View Importing Modules Setup.md

Importing Modules Setup

In an effort to keep import statements clean and easy to work with, we use import aliases.

For example (anywhere in the app tree):

import { network } from 'lib/network';
import { colors } from 'styles/theme';
import useThrottledEvent from 'hooks/useThrottledEvent';
View Default vs Named Exports.md

Default vs. Named Exports

Named Exports Benefits

  • No need to think of a variable name. Sometimes it's unclear from the file name, especially if it's ../index.js
  • Intellisense autocomplete is faster and prevents spelling mistakes
  • Easier to serach for the export across the project (less likely to have been misspelled or named differently)
  • If we only had named exports, that would be easier for new developers to learn how to use it, as there is no extra logical step of choosing which type of import to use

Default Export Benefits

@alexilyaev
alexilyaev / NewMacGuidelines.md
Last active Sep 23, 2022
New Mac Guidelines
View NewMacGuidelines.md

Setup

  • Preferences
    • General
      • Appearance - Dark
    • Acessibility
      • Pointer Control > Trackpad Options - Enable Dragging with three finger drag
    • Keyboard
  • Key Repeat - Fast