Skip to content

Instantly share code, notes, and snippets.

View bartdorsey's full-sized avatar

Bart Dorsey bartdorsey

View GitHub Profile
@bartdorsey
bartdorsey / how-to-debug.md
Last active July 23, 2024 19:35
How to Debug Code

How to Debug Code

Okay so your code has a problem. Here's a general guide on steps you should take.

Run the code and reproduce the problem

This should be obvious but you need to be running your code to debug it.

Look at any logs or output for error messages

@bartdorsey
bartdorsey / react-pitfalls.md
Last active July 12, 2024 15:44
Common React Pitfalls

Common React Pitfalls

This is a document which tries to collect common Pitfalls that developers fall into when learning React for the first time.

Can't call <<method>> on <<undefined>>

This is usually caused by misunderstanding the component lifecycle. Components in React render synchronously, which means that the first time a component renders it will often have no data, or empty data.

Example:

@bartdorsey
bartdorsey / wsl-quick-dev-setup.md
Last active September 16, 2024 21:13
WSL Quick Dev Setup

WSL Quick Dev Setup

Make sure virtualization is enabled:

  1. Open Task Manager
  2. Performance Tab
  3. Select CPU
  4. Check for "Virtualization Enabled"

If virtualization is not enabled

@bartdorsey
bartdorsey / code-wars-beginners.md
Last active May 29, 2024 19:56
Excellent Code Wars for Beginners
@bartdorsey
bartdorsey / vscode-to-neovim.md
Created April 3, 2024 18:52
VSCode To Neovim Rosetta Stone

VSCode to Neovim Rosetta Stone

@bartdorsey
bartdorsey / neovim-lsp-glossary.md
Created February 5, 2024 18:15
Neovim LSP Glossary

Neovim LSP Glossary

When setting up Language Server Protocol on Neovim, what plugins do what can be pretty confusing. So this table is a list of the most common plugins people use and what they are and why they are.

Plugin Role Why?
lspconfig Configuring the language servers You can use neovim's built in vim.lsp.start() function, but often we don't know all the command line arguments and options needed to pass to that function, so lspconfig is really just a database of a bunch of configurations for lsps
mason Installing language servers Mason will automatically download and install the actual language server programs. This is optional because if you install an LSP server in your $PATH manually you don't necessarily need this
mason-lspconfig Automatically setting up lsps when you install them This glues lspconfig and mason together, So when an lsp is configured the setup function for it will be automatically called, not necessary if you want to manage your LSPs manually
@bartdorsey
bartdorsey / neovim-plugins.md
Last active January 19, 2024 20:07
Neovim must have plugins

Neovim must have plugins

This is my curated list of the neovim plugins I can't live without

Note: if you are just starting out, check out kickstart.nvim

  • Lazy.nvim - The plugin manager I use. Not to be confused with LazyVim the neovim distribution.
  • lspconfig - The must have plugin for configuring LSP support in neovim.
  • nvim-cmp - Completion engine for neovim. Without this you won't get autocomplete for anything
  • oil.nvim - A magical plugin which lets you browse and edit your files and folders like they are in an editor buffer
@bartdorsey
bartdorsey / command-line-utils.md
Last active January 19, 2024 19:39
Must have command line utilities

Must have command line utilities

This is my curated list of command line utilities that I can't live without

  • neovim - Enough said, you either use neovim, or you don't, I'm not going to tell you to use vim, but if you do, neovim is the way. See my neovim must have plugin list here
  • zsh - My shell of choice.
  • zoxide - zoxide is a fuzzy matching cd command. It will automatically remember commonly visited directories, and you can jump to them instantly.
  • fzf - fzf is a tool which will do fuzzy searching. Many of the other tools I use integrate fzf. For instance, zoxide's zi command uses this. You can also use it in your own shell aliases and scripts.
  • starship - Starship is a cross platform shell prompt. I use this so I can have the same prompt no matter which shell I'm using.
  • [lsd](https
@bartdorsey
bartdorsey / docker-inside-wsl.md
Last active January 18, 2024 19:08
Running Docker Inside WSL with systemd.

Running Docker inside WSL with systemd.

Why would you want to do this?

  • Because when you run docker desktop for Windows, it will be creating two WSL instances behind the scenes anyway. This will take up more resources than this method.
  • Docker desktop attempts to inject the docker commands into your existing WSL instance. It does this through a series of hacks that frankly are just complex and prone to breakage.
  • Bind mounts are from Linux to Linux. When you run Docker Desktop on Windows, you are bind mounting from the Windows filesystem to a Linux system. This can make things like hot reloading web frameworks not work very well. (this is because it can't recieve filesystem events when you save the files)

Why is this simpler?

local neovim = {
[[⠀⠀⠀⢀⡴⣂⠀⠀⠀⠀⠀⠀⠀⠀⢰⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]],
[[⠀⢀⡴⣏⣷⡹⣆⡀⠀⠀⠀⠀⠀⠀⢸⣯⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]],
[[⣴⣻⣽⣻⣼⢳⡹⣖⡄⠀⠀⠀⠀⠀⢸⣷⢿⣾⢷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
[[Γú»Γó╖Γú╗Γó╖Γú»Γó│Γí¥Γí╛Γú£ΓíåΓáÇΓáÇΓáÇΓáÇΓó╕Γú┐Γí┐Γú»Γú┐ΓíçΓáÇΓáÇΓáÇΓáÇΓáÇΓóÇΓíÇΓáÇΓúÇΓúñΓúñΓúÇΓáÇΓáÇΓáÇΓáÇΓáÇΓúÇΓúñΓúñΓúÇΓíÇΓáÇΓáÇΓáÇΓáÇΓóÇΓúáΓúñΓúñΓúÇΓíÇΓáÇΓóáΓúñΓúñΓáÇΓáÇΓáÇΓáÇΓóÇΓúñΓúñΓíäΓúñΓúñΓáÇΓóáΓúñΓíäΓúáΓúñΓú╢ΓúñΓíÇΓóÇΓúáΓú┤Γ