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 / .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
@tommymarshall
tommymarshall / Demo.js
Last active August 9, 2017 18:17
Simple Modal in React using react-portal-minimal and styled-components
import React from 'react';
import { TextBlock } from '../../text';
import { Modal } from '../';
class Demo extends React.Component {
state = {
open: false
};
handleOpenModel = () => this.setState({ open: !this.state.open });
@tommymarshall
tommymarshall / ContentfulBuilder.php
Created January 18, 2017 22:50
Contentful Feed Builder
<?php
class ContentfulBuilder {
protected $query;
public function __construct() {
$this->query = new Query;
}
@tommymarshall
tommymarshall / ansible_play.yaml
Created January 6, 2017 22:00
Ansible play for provision server with SSL
---
company: XXX
provider: rackspace
server_os: trusty
server_size: 8G
stack: lamp
httpd_package: apache
database_package: mysql
ssl_test_mode: yes