Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Erikson markerikson

View GitHub Profile
@markerikson
markerikson / job-search-questions.md
Last active May 9, 2022
Assorted questions to ask companies in interviews
View job-search-questions.md

Questions

Company

  • company location / remote?
  • what project management method?
  • good and bad company culture?
  • performance reviews?
  • what's the path to profitability?
@markerikson
markerikson / next.config.js
Created Nov 2, 2021
Work app Next.js config
View next.config.js
// omit imports and stuff
// Using Next 11.1
module.exports = withPlugins(
[
withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true'
})
],
@markerikson
markerikson / AppErrorFallback.tsx
Created Jul 1, 2021
Next.js ErrorBoundary example
View AppErrorFallback.tsx
import React from 'react';
import Jumbotron from 'react-bootstrap/Jumbotron';
import Alert from 'react-bootstrap/Alert';
import Button from 'react-bootstrap/Button';
import { FallbackProps } from 'react-error-boundary';
interface AEFProps extends FallbackProps {
@markerikson
markerikson / chatsSlice.ts
Last active May 18, 2022
Nested `createEntityAdapter` example
View chatsSlice.ts
// Example of using multiple / nested `createEntityAdapter` calls within a single Redux Toolkit slice
interface Message {
id: string;
roomId: string;
text: string;
timestamp: string;
username: string;
}
@markerikson
markerikson / react-native-jest-google-queries.md
Last active Feb 22, 2021
Stuff I googled while updating React-Redux to run tests against React Native
View react-native-jest-google-queries.md
  • Double-checking whether window exists in React Native:
react native window global
  • Finding the giant "useLayoutEffect warnings" thread:
react uselayouteffect ssr
@markerikson
markerikson / reactiflux-chat-react-hooks-storage.md
Created Sep 14, 2019
Reactiflux chat log: How does React store hooks on Fibers?
View reactiflux-chat-react-hooks-storage.md

[12:14 AM] acreddy : are hooks value stored in fiber?

[10:40 AM] ghardin137 : not really

[10:50 AM] acemarke : @acreddy, @ghardin137 : yes they are, actually.

A "fiber" is a plain JS object that React uses to store bookkeeping information on each rendered component in the tree. The linked list of hooks is indeed stored as a field on the fiber for that component

@markerikson
markerikson / discord-split-theme-userscript.js
Last active Sep 10, 2019
Discord: Split Theme Userscript (Dark Sidebar, Light Chat)
View discord-split-theme-userscript.js
// ==UserScript==
// @name Discord Split Dark+Light Theme
// @version 1
// @match https://discordapp.com/*
// @grant none
// ==/UserScript==
// NOTE: Set Discord to the Light theme. This will override the sidebar and
// "guilds" sections to force them to the dark theme.
@markerikson
markerikson / fixMissingOfflineMirrorFiles.py
Created Aug 28, 2019
Python script to download missing files in a Yarn offline mirror
View fixMissingOfflineMirrorFiles.py
# coding=utf-8
import sys
import re
import requests
if(sys.version_info.major < 3):
print("This script must be run with Python 3.6 or higher!")
exit(1)
import pathlib
@markerikson
markerikson / dialogsRegistry.ts
Created Jul 15, 2019
Redux middleware typing issues
View dialogsRegistry.ts
import React, {ComponentType} from "React";
import {Middleware, Action, AnyAction} from "redux";
import {createSlice, PayloadAction} from "redux-starter-kit";
import {createSelector} from "reselect";
import {generateUUID} from "utilities";
import {RootState} from "store";
interface DialogDisplayOptions {
singleton: boolean;
@markerikson
markerikson / react-redux-stale-props-subscriptions.md
Created Apr 16, 2019
Reactiflux chat log: React-Redux, "stale props", and subscriptions
View react-redux-stale-props-subscriptions.md

[9:13 PM] harry : @acemarke are people still going to need to add Connect components to their jsx to use a redux hook? i couldnt tell where that ended up
[9:13 PM] harry : didnt 100% grok the whole thing
[9:13 PM] acemarke : awright, lemme recap the issue
[9:13 PM] acemarke : :)
[9:13 PM] harry : sweet
[9:13 PM] acemarke : from the top
[9:13 PM] harry : i kinda got the gist of the zombie child thing too. not sure how a child actually subscribes before a parent, though
[9:14 PM] acemarke : (drat... I can already tell this is gonna be one of those chats I have to export to a gist because I'm about to write a lot)
[9:15 PM] acemarke : up through v4, there was a potential bug due to the timing of store subscriptions
[9:15 PM] acemarke : wrapper components subscribe in componentDidMount, which fires bottom-up