Skip to content

Instantly share code, notes, and snippets.

View moredip's full-sized avatar

Pete Hodgson moredip

View GitHub Profile
@moredip
moredip / gulpfile.js
Last active August 29, 2015 14:12
gulp, browserify, reactify, and sadness
//based on https://medium.com/@sogko/gulp-browserify-the-gulp-y-way-bb359b3f9623
var gulp = require('gulp');
var browserify = require('browserify');
var transform = require('vinyl-transform');
var reactify = require('reactify');
gulp.task('browserify', function () {
var browserified = transform(function(filename) {
var b = browserify(filename);
return b.bundle();
@moredip
moredip / README.md
Last active August 29, 2015 14:24 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

Keybase proof

I hereby claim:

  • I am moredip on github.
  • I am petehodgson (https://keybase.io/petehodgson) on keybase.
  • I have a public key whose fingerprint is C102 5F19 DE0B 2154 8873 6DBB 53A8 A903 4518 61FF

To claim this, I am signing this object:

@moredip
moredip / -README.md
Last active July 3, 2017 06:15
functionally-stateful

stateful()

A helper function that lets us write stateful React components in the same functional style as stateless components.

Why?

  • sidesteps the need to introduce class and this-binding confusion into your codebase.
  • slightly terser, slightly more declarative
  • opinionated - doesn't expose the more dangerous features of class-based Components (e.g. lifecycle callbacks)

When you have a team working on a larger React codebase it is hard for everyone to understand which patterns are preferable vs. those which are a necessary compromise.

@moredip
moredip / part-app.js
Last active July 13, 2017 15:42
Introduce Partial Application
const priceByCommodityAndCountry = {
'MANGO': [
{
origin: 'US',
price: 101
},
{
origin: 'BR',
price: 120