Skip to content

Instantly share code, notes, and snippets.

@eisisig
eisisig / build-step-time-webpack-plugin.js
Created September 14, 2016 22:27 — forked from mzgoddard/build-step-time-webpack-plugin.js
Little webpack plugin for digging out some time info
// Drop this in as the first plugin in a webpack config
{
apply: function(compiler) {
var start;
compiler.plugin(['watch-run', 'run'], function(compiler, cb) {
start = Date.now();
cb();
});
compiler.plugin('make', function(compilation, cb) {
console.log('pre-make', Date.now() - start);
const ABORTABLE_ERROR_KEY = '__abortablePromise';
/**
* @typedef {Promise.<*>} AbortablePromise
*
* @property {function} abort Additional method for abort original promise
*/
/**
*
@eisisig
eisisig / bundle.js
Created April 18, 2016 17:03 — forked from jackgill/bundle.js
A node.js script to create a bundle containing an npm package, and all of its dependencies.
/*
* This script will download a package (and all of its dependencies) from the
* online NPM registry, then create a gzip'd tarball containing that package
* and all of its dependencies. This archive can then be copied to a machine
* without internet access and installed using npm.
*
* The idea is pretty simple:
* - npm install [package]
* - rewrite [package]/package.json to copy dependencies to bundleDependencies
* - npm pack [package]
@eisisig
eisisig / dynamicSelector.js
Created April 7, 2016 19:48 — forked from kbrownlees/dynamicSelector.js
Dynamic reselect selector
export function createDynamicSelector() {
let subSelectors = null;
let actualSelector = null;
return (state, props, ...args) => {
// Check to see if the sub state has change
const subState = state.get('subState');
if (subSelectors === null || !Set(subState.keys()).equals(Set(subSelectors.keys()))) {
// Rebuild our the selectors - could obviously update if required.
subSelectors = subState.map((value, key) => {
@eisisig
eisisig / combining.js
Created April 1, 2016 09:12 — forked from gaearon/combining.js
Combining Stateless Stores
// ------------
// counterStore.js
// ------------
import {
INCREMENT_COUNTER,
DECREMENT_COUNTER
} from '../constants/ActionTypes';
const initialState = { counter: 0 };
// from the brilliant mind of sb
var _catch = Promise.prototype.catch;
Promise.prototype.catch = function () {
return _catch.call(this, function (err) { setTimeout(function () { throw(err); }, 0); });
}
@eisisig
eisisig / gist:032a7c6cea24299d3c7e
Created February 11, 2016 15:10 — forked from ianbattersby/gist:4641450
Ubuntu TeamCity agent setup
#!/bin/bash
# THESE ARE NOTES, NOT TESTED AS SCRIPT!
# We need the following to get and run teamcity agent
sudo apt-get install openjdk-7-jre-headless
sudo apt-get install unzip #For unzipping buildAgent.zip
# For compiling Simple.Web
sudo apt-get install ruby1.9.1
@eisisig
eisisig / README:Rollup.md
Created February 3, 2016 09:56
Standard Configs to use with Rollup.js

Rollup Configs

If you haven't used or heard of Rollup it is an awesome bundling system that allows you to leverage es2015 modules and produce backwards compatible libraries.

Here are a few configs to help you bundle your apps.

Shipit Deploy

Shipit is a pretty awesome universal automation and deployment tool written in JavaScript.

Setup your server

(this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g pm2

Install shipit

  • npm install -g shipit-cli
@eisisig
eisisig / local-npm.md
Created January 17, 2016 14:55 — forked from nolanlawson/local-npm.md
Setting up local-npm as a launch daemon on OS X

Setting up local-npm as a launch daemon on OS X

These instructions will set up local-npm so that it runs as a launch daemon, meaning that it will start up whenever you log in.

First, install local-npm and pm2:

npm install -g local-npm
npm install -g pm2