Skip to content

Instantly share code, notes, and snippets.

Michael Jackson mjackson

Block or report user

Report or block mjackson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mjackson
mjackson / travis.yml
Last active May 3, 2019
Travis CI + google-cloud-sdk + updated kubectl + Docker
View travis.yml
# The Google Cloud SDK on Travis is pretty old (2014). So if
# you want to use an up-to-date version, you have to install
# your own. This config is the bare minimum you'll need to
# get an updated version of the SDK + kubectl.
cache:
directories:
# We cache the SDK so we don't have to download it again on subsequent builds.
- $HOME/google-cloud-sdk
services:
# Include the docker service so you can roll your own images.
View HOC-w-Render-Prop.js
import React from "react";
import ReactDOM from "react-dom";
import PropTypes from "prop-types";
document.body.style.background = `
linear-gradient(135deg,
#1e5799 0%,
#2989d8 50%,
#207cca 51%,
#7db9e8 100%
@mjackson
mjackson / react-15-6-2.html
Last active May 10, 2018
React TestUtils Simulate regression between 15.6.2 and 16.3.2
View react-15-6-2.html
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/react@15.6.2/dist/react-with-addons.js"></script>
<script src="https://unpkg.com/react-dom@15.6.2/dist/react-dom.js"></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
</head>
<body>
<div id="root"></div>
View router.js
import React from "react";
import pathToRegexp from "path-to-regexp";
function Home() {
return <h1>Home</h1>;
}
function About() {
return <h1>About</h1>;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am mjackson on github.
  • I am mjackson (https://keybase.io/mjackson) on keybase.
  • I have a public key ASDn-_bfhdzaHqvj4gcakU4yKWlK5RyzlcXQRJMQqYp2fwo

To claim this, I am signing this object:

@mjackson
mjackson / MyComponent.js
Last active Mar 7, 2018
Can we just plop some CSS right smack in the middle of our JavaScript code?!
View MyComponent.js
import React from "react";
body {
font-family: Helvetica, sans-serif;
}
.header-text {
font-weight: bold;
font-size: 2em;
}
@mjackson
mjackson / multiple-git-hooks.sh
Created Feb 6, 2018
Run multiple scripts for the same git hook
View multiple-git-hooks.sh
#!/bin/sh
# This script should be saved in a git repo as a hook file, e.g. .git/hooks/pre-receive.
# It looks for scripts in the .git/hooks/pre-receive.d directory and executes them in order,
# passing along stdin. If any script exits with a non-zero status, this script exits.
script_dir=$(dirname $0)
hook_name=$(basename $0)
hook_dir="$script_dir/$hook_name.d"
View package-info.json
{
"_id": "@dollarshaveclub-engineering/ui",
"_rev": "2-5773c0c926d450044de3c87bc8233fad",
"name": "@dollarshaveclub-engineering/ui",
"description": "DSC Web UI",
"dist-tags": {
"latest": "2.6.4"
},
"versions": {
"2.6.3": {
@mjackson
mjackson / broadcast_subscriber_deprecations.md
Last active Apr 11, 2018
More information about <Broadcast>/<Subscriber> deprecations in react-broadcast
View broadcast_subscriber_deprecations.md

<Broadcast> and <Subscriber> are being deprecated

<Broadcast> and <Subscriber> are being deprecated in react-broadcast in favor of a new API inspired by the new React context RFC. The goals of this change for react-broadcast users are:

  • Make it easier to upgrade to the new React context API when it eventually lands
  • Remove ambiguity around channels

How to upgrade to the new API

Instead of using pre-built <Broadcast> and <Subscriber> components, you create them for yourself. So instead of:

View Context-solution.js
/*eslint-disable no-alert */
////////////////////////////////////////////////////////////////////////////////
// Exercise:
//
// Using context, implement the <Form>, <SubmitButton>, and <TextInput>
// components such that:
//
// - Clicking the <SubmitButton> calls <Form onSubmit>
// - Hitting "Enter" while in a <TextInput> submits the form
// - Don't use a <form> element, we're intentionally recreating the
You can’t perform that action at this time.