Skip to content

Instantly share code, notes, and snippets.

View jeffbcross's full-sized avatar

Jeff Cross jeffbcross

  • Google
  • Mountain View, CA
View GitHub Profile
@jeffbcross
jeffbcross / gist:9922513
Created April 1, 2014 20:30
Basic ES6 Promise.then synchronous monkey patch
Promise.prototype.then = function (good, bad) {
this.chain_ = this.chain_ || [];
this.chain_.push({resolve: good, reject: bad});
return this;
}
Promise.prototype.resolveNext_ = function () {
if (!this.chain_) return;
var next = this.chain_.shift(), nextVal;
if (!next) return;
@jeffbcross
jeffbcross / gist:9905075
Last active August 29, 2015 13:57
Quick Async Promise Hack
var orderOfExecution = [];
function mockResolve_ (promise, resolvedVal, rejectedVal) {
promise.resolvedVal = resolvedVal;
promise.rejectedVal = rejectedVal;
}
function flush (promise) {
promise.resolveNext_.call(promise);
};
function resolve(val) {
alert('Counted to ' + val);
return val;
}
function reject(reason) {
alert('Could not count');
return reason;
}
@jeffbcross
jeffbcross / gist:7882524
Created December 9, 2013 22:51
angular-sites/test.sh
#!/bin/bash
./node_modules/.bin/webdriver-manager update
./node_modules/.bin/webdriver-manager start
# ^ need to wait 5s and continue with running other scripts,
# then kill the process
./node_modules/.bin/protractor protractorConf.js
code1=$?
echo "code1"
echo $code1
@jeffbcross
jeffbcross / gist:4049899
Created November 10, 2012 04:29
Jitsu Deploy Fail
info: Creating snapshot 0.0.0-4
info Uploading: [=============================] 99%
info: Updating app nko3-deployd
info: Activating snapshot 0.0.0-4 for nko3-deployd
info: Starting app nko3-deployd
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy the app
error:
error: Rackspace Error (404): Item not found