Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# We need the TAB character for SED (Mac OS X sed does not understand \t)
TAB="$(printf '\t')"
function abort {
echo "$(tput setaf 1)$1$(tput sgr0)"
exit 1
}
@eisisig
eisisig / git-rewrite-to-subfolder
Created September 26, 2016 14:04 — forked from bogdanalbei/ git-rewrite-to-subfolder
Integrating a submodule into the parent repository fix
#!/bin/bash
# We need the TAB character for SED (Mac OS X sed does not understand \t)
TAB="$(printf '\t')"
function abort {
echo "$(tput setaf 1)$1$(tput sgr0)"
exit 1
}
function request_input {
@eisisig
eisisig / open-in-tap.js
Created September 15, 2016 09:38
Try to open previous browser tab in mac chrome
if (process.platform === 'darwin') {
try {
// Try our best to reuse existing tab
// on OS X Google Chrome with AppleScript
execSync('ps cax | grep "Google Chrome"');
execSync(
'osascript chrome.applescript ' + protocol + '://localhost:' + port + '/',
{cwd: path.join(__dirname, 'utils'), stdio: 'ignore'}
);
return;
@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