Skip to content

Instantly share code, notes, and snippets.

grrowl / consolefix.js
Last active Aug 29, 2015
<IE8 JS Console fixer
View consolefix.js
if (typeof window.console === "undefined") {
var methods = ['log', 'info', 'error', 'debug', 'warn', 'assert', 'clear', 'dir', 'trace', 'time', 'timeEnd'];
console = {};
for (var key in methods)
console[methods[key]] = function () {};
grrowl /
Last active Aug 29, 2015
Awesome CSS (and other front-end goodies)

Awesome CSS

A starting point for awesome CSS (and Sass, and Less) resources, inspired by Awesome Awesomeness everywhere. Still fleshing this out as I go, feel free to fork/contribute.



grrowl /
Last active Aug 29, 2015
Subdomain/host matching in react-router

We have a rapidly growing React application which renders on both the server- and client-sides. Some sections of the app are on separate subdomains. The same app uses the same assets across many subdomains, so we control it all through the one runtime. This mean react-router needs to be able to distinguish which host or subdomain it's on.


  • HostRoute which subclasses Route and is aware of the host via a static method HostRoute.setHost(url.parse(res.url).hostname)
  • Static method called before (on init of app) i.e. HostRoute.setHost(url.parse(req.url).hostname) and/or HostRoute.setHost(window.location.hostname)
  • Makes sense, since host will never change during the lifetime of the application, a significantly lighter approach and "opt-in" for those who require it.
  • Will require addition to modules/Match to ask the Route itself if it might be a match (if host matc
grrowl /
Created Sep 23, 2015
Forwards port 80 to another port (*nix, OSX up to 10.11)
#!/usr/bin/env sh
sudo ssh -L -N tom@localhost
grrowl / fetchDataComponent.jsx
Last active Oct 19, 2015
redux and react-router helper to provide (dispatch, storeState) to a static fetchData method
View fetchDataComponent.jsx
'use strict';
# FetchData
If property callback `if(storeState)` return true, calls property callback
`fetchData(dispatch, storeState)` so it may dispatch FETCH actions.
## Usage:
grrowl / flattenjson.html
Last active Jan 2, 2016
Flattens multi-level JSON objects (useful for converting complex JSON to CSV format)
View flattenjson.html
textarea { height: 400px; width: 100%; }
<h1>flatten json</h1>
<textarea id="data">[]</textarea>
<button id="goByLine">line-by-line</button>
<button id="goWhole">as whole object</button>
<textarea id="result"></textarea>
grrowl /
Created Jun 2, 2016 <branch to review> [<base branch>]
if [ -z "$*" ]; then echo "Usage: [review branch] [case compare branch]"; exit 0; fi
echo "Checking out $REVIEW_BRANCH"
grrowl / githubDelayedMerge.user.js
Created May 10, 2016
GitHub: click anywhere on the "merge message" (with disabled button) and it'll wait until the button enables and click it for you.
View githubDelayedMerge.user.js
(function () {
function handleLoaded() {
var butan = document.querySelector('.merge-message .btn[disabled]')
var checkTimer;
if (butan) {
butan.parentElement.addEventListener('click', function handleClick(event) {
if (checkTimer) {
grrowl /
Last active Nov 20, 2016 — forked from christophermanning/
Voronoi Diagram with Force Directed Nodes and Delaunay Links

Created by Christopher Manning


Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.

The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.


  • when should this compacter run?
    • every n actions added (compactEvery)
    • when history is at n length (highWaterMark, compactAtLength)
  • can the function signal when it should?
    • run the compacter every time
    • needs a private state (below) or
    • getCompacter({ n, highwater }) => compactingDispatcher()

we can compactingReducer, basically searches the last 50 actions for "stop" or