Skip to content

Instantly share code, notes, and snippets.

View anthonybrown's full-sized avatar
🎯
Focusing

Tony Brown anthonybrown

🎯
Focusing
View GitHub Profile
@anthonybrown
anthonybrown / remove-node-modules.md
Created May 16, 2022 20:34 — forked from lmcneel/remove-node-modules.md
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a
@anthonybrown
anthonybrown / index.md
Created February 16, 2021 19:29 — forked from bvaughn/index.md
How to use profiling in production mode for react-dom
@anthonybrown
anthonybrown / Enhance.js
Created October 16, 2020 10:28 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@anthonybrown
anthonybrown / twittermute.txt
Created January 24, 2020 16:04 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
node_modules
package-lock.json
@anthonybrown
anthonybrown / array_iteration_thoughts.md
Created July 20, 2019 16:40 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@anthonybrown
anthonybrown / create-react-component.js
Created June 18, 2019 12:17 — forked from rastating/create-react-component.js
A script to create the boilerplate code for a new React.js component with a [Jest] spec file
#! /usr/bin/env node
# Usage: node create-react-component.js ComponentName
# Note: If a `components` directory does not exist in the current working directory, nothing will be created
const fs = require('fs')
const path = require('path')
const componentName = process.argv[2]
const componentPath = path.join(
'components',
componentName

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array): T[] 🔒 ES3
@anthonybrown
anthonybrown / flux.js
Created May 30, 2019 09:34 — forked from acdlite/flux.js
A Redux-like Flux implementation in <75 lines of code
/**
* Basic proof of concept.
* - Hot reloadable
* - Stateless stores
* - Stores and action creators interoperable with Redux.
*/
import React, { Component } from 'react';
export default function dispatch(store, atom, action) {
@anthonybrown
anthonybrown / downscroller.coffee
Created May 25, 2019 05:03 — forked from zwily/downscroller.coffee
Puts a big annoying arrow in your Limechat window when you're not scrolled down, like a dummy. (requires limescripts)
## Puts a big annoying arrow in your window when you're not scrolled down, like a dummy
#
scrollAlert = $("<div id='scrolldown-arrow'>⬇</div>")
showing = false
body = $ document.body
win = $ window
doc = $ document