Skip to content

Instantly share code, notes, and snippets.

View alexilyaev's full-sized avatar

Alex Ilyaev alexilyaev

View GitHub Profile
@alexilyaev
alexilyaev / NewMacGuidelines.md
Last active January 17, 2024 15:36
New Mac Guidelines

New Mac Guidelines

Setup

  • Install Dropbox
    • Used for syncing configs between several computers
    • Make available offline
      • Finder > Dropbox > Settings
  • Install VS Code and VS Code Insiders
  • Turn on Settings Sync for VS Code
@alexilyaev
alexilyaev / date-fns-issues.md
Last active October 31, 2023 19:19
Moment.js deprecated, date-fns issues
@alexilyaev
alexilyaev / Importing Modules Setup.md
Last active August 4, 2023 06:43
Import Aliases Setup

Import Aliases

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

For example (anywhere in the app or src tree):

import { network } from 'lib/network';
import { colors } from 'styles/theme';
import useThrottledEvent from 'hooks/useThrottledEvent';
@alexilyaev
alexilyaev / MUI-Select-Custom-Trigger-Area-Hidden-Input.md
Last active April 17, 2023 16:39
MUI Select with custom trigger button, hidden input
@alexilyaev
alexilyaev / Bug.md
Last active March 30, 2023 17:21
SourceTree bug - Filtering branches in the sidebar doesn't work for branch names with a slash
@alexilyaev
alexilyaev / Default vs Named Exports.md
Last active March 13, 2023 09:10
Default vs. Named Exports

Default vs. Named Exports

Named Exports Benefits

  • Find Usages/Find References - Easier to search for the export across the project. Less likely to have been renamed or misspelled
  • Easier refactoring of the exported name
  • No need to think of a variable name. Sometimes it's unclear from the file name, especially if it's ../index.js
  • Choosing a named export with IntelliSense autocomplete is faster than writing your own variable. Also prevents spelling mistakes
  • If we only had named exports, it 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 or export to use
@alexilyaev
alexilyaev / Node-version-managers.md
Last active March 7, 2023 19:16
Node version managers

Node Version Managers

I tried nvm many years ago and it had several issues that I remember:

  • Setup was not as simple compared to n at the time
  • It was quite slow moving from one Node version to another
  • Couldn't automatically switch the Node version when entering a folder (now they cover that)
    • In the past I used avn for that, but it was slow as well
  • Global packages were lost when moving from one Node version to another
  • Tbh, fnm has the same issue now, hopefully they'll add support for it soon
@alexilyaev
alexilyaev / env-configs.md
Last active March 7, 2023 09:33
.env vs. node-config

.env vs. node-config

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 / Why-not-index-files.md
Last active February 26, 2023 18:23
Why not `index` files?

Why not index files

Using index.{jsx,tsx} for Components or index.{js,ts} for other files

  • Hard to search for a component or file based on it’s name (the index file is only on the 7th result)

image

  • Opening several index files in the IDE results in hard to read tabs with needless index keywords