Skip to content

Instantly share code, notes, and snippets.

View joejag's full-sized avatar

Joe Wright joejag

View GitHub Profile
@joejag
joejag / gist:c61a444e69fb4d3292cb3d35a7442fd8
Created February 12, 2021 15:29
Mentor / Coach / Trainer
* Questions for mentors: https://lifehacker.com/ask-your-mentor-these-40-questions-1844330641
@joejag
joejag / gist:6bef92985c8162c834c9ea4bb2eb06dc
Last active December 11, 2020 15:26
Notes on Marc's Maturity Mapping talk from FlowCon
{
"workbench.startupEditor": "newUntitledFile",
"editor.minimap.enabled": false,
"breadcrumbs.enabled": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
@joejag
joejag / marking.md
Last active August 4, 2020 02:03
Example of how to mark a technical test

Tech Test Marking Guide

For a given test exercise.

Out of 22 points.

  1. It works: The code implements the specification (8 points, meets spec is 8 - reduce the score for missing parts or bugs found)

  2. The code is easy to read (4 points)

@joejag
joejag / bbc_perf_bug.md
Last active June 10, 2020 20:08
Hello BBC, please fix a CSS bug that causes high CPU usage on your site

I continuously get high CPU usage on visiting http://news.bbc.co.uk/. I've got a low spec machine, so I notice these things. I've tracked this down to a CSS bug that you have on your news page.

After downloading the homepage and chopping things up, I managed to find the culprit.

Halfway down the some extra styling is applied by: Morph.initStyles = function () {} function.

It applies about 45 extra pieces of styling into the page. Four of these rules result in constant CPU usage. They are:

  • "
import useWhyRerender from './whyRerender'
const MyComponent = props => {
// any states
const [error, setError] = React.useState(false)
// add interesting things to track
useWhyRerender({
...props,
error
const highlightDifferences = (props, prevProps) => {
console.log('RERENDER DIFF!')
const now = Object.entries(props)
const added = now.filter(([key, val]) => {
if (prevProps[key] === undefined) return true
if (prevProps[key] !== val) {
console.log(`${key}
- ${JSON.stringify(val)}
+ ${JSON.stringify(prevProps[key])}`)