Skip to content

Instantly share code, notes, and snippets.

@wefiy
wefiy / app.js
Created October 16, 2017 06:24 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@wefiy
wefiy / README.md
Created October 12, 2017 02:55 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

const fs = require('fs');
const remark = require('remark');
const md = fs.readFileSync('./fixtures/alert.md');
const ast = remark().parse(md);
function getCellValue(node) {
return node.children[0].children[0].value;
}