Skip to content

Instantly share code, notes, and snippets.

View tommymarshall's full-sized avatar

Tommy Marshall tommymarshall

View GitHub Profile
@tommymarshall
tommymarshall / response.md
Created May 3, 2023 14:18
What can't error boundaries catch, with examples (via Chat GPT)

React error boundaries are a useful feature that allows you to catch and handle errors that occur during rendering, rather than letting them crash your entire application. However, there are some scenarios in which error boundaries may not be able to catch errors. Here are some examples:

  1. Errors that occur outside of the component hierarchy: React error boundaries can only catch errors that occur within their component tree. If an error occurs outside of the boundary's tree, it will not be caught. For example:
function App() {
  return (
    <ErrorBoundary>
      <MyComponent />
 
@tommymarshall
tommymarshall / custom_user_bindings.sublime-keymap
Last active April 26, 2020 01:04
Custom User Bindings for using AlignTab with ='s, =>'s, and :'s in Sublime Text
[
{
"keys": ["control+alt+;"], "command": "align_tab",
"args" : {
"user_input" : ":/f"
}
},
{
"keys": ["control+alt+="], "command": "align_tab",
"args" : {
@tommymarshall
tommymarshall / routes.php
Last active October 18, 2019 13:23
Simple Laravel + Craft integration
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
@tommymarshall
tommymarshall / nginx.conf
Last active February 22, 2019 19:17
Parking Domains NGINX config
# My changes
server {
listen [::]:80;
server_name domain.com parkeddomain.com;
rewrite ^ http://domain.com$request_uri? permanent;
}
# Forge's default
server {
listen 80;
@tommymarshall
tommymarshall / .zshrc
Created March 23, 2018 14:26
My Zshrc
# If you come from bash you might have to change your $PATH.
export PATH=./node_modules/.bin:$HOME/bin:$HOME/.composer/vendor/bin:/usr/local/bin:/Users/tmarshall/repos/multitasking/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/tmarshall/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="af-magic"
@tommymarshall
tommymarshall / keybindings.json
Created February 2, 2018 15:04
VSCode Key Bindings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "alt+down",
"command": "incrementor.decByOne"
},
{
"key": "ctrl+down",
"command": "-incrementor.decByOne"
},
@tommymarshall
tommymarshall / .vscode-settings
Created February 2, 2018 14:59
VSCode settings
{
"workbench.colorTheme": "One Monokai",
"editor.lineHeight": 24,
"editor.fontSize": 14,
"files.autoSave": "onFocusChange",
"workbench.editor.labelFormat": "default",
"sublimeTextKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.fontFamily": "Fira Code",
@tommymarshall
tommymarshall / .zshrc
Created January 29, 2018 19:44
Create a PR against master from your the branch you're in, and open it in the browser.
pr () {
local repo=`git remote -v | grep -m 1 "origin" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
}
@tommymarshall
tommymarshall / keybindings.json
Created December 1, 2017 16:15
Get Emmet tag completion (type 'div' hit TAB) working in JSX files
{
"keys": ["tab"], "command": "expand_abbreviation_by_tab", "context": [
{
"operand": "source.js",
"operator": "equal",
"match_all": true,
"key": "selector"
},
{
"key": "selection_empty",
@tommymarshall
tommymarshall / README.md
Last active October 11, 2017 00:01
# of times Nationals won 2 games in a row during the regular season