Skip to content

Instantly share code, notes, and snippets.

'use strict';
const theGlobal = typeof window === 'object' ? window : global;
const realPromiseConstructor = theGlobal.Promise;
const wrappedPromiseConstructor = function (resolve, reject, progress) {
const originalPromiseInstance = new realPromiseConstructor(resolve, reject, progress);
// Who called us? Let's store it.
@aurels
aurels / gist:843967
Created February 25, 2011 15:45
stream system command output to STDOUT (ruby)
IO.popen('ant run') do |io|
while (line = io.gets) do
puts line
end
end
@eric1234
eric1234 / random_string.js
Created June 15, 2010 20:09
Random string generator
Array.prototype.random = function() {
return this[parseInt(Math.random() * this.length)];
}
String.random = function(len) {
var chars = $R('a', 'z').toArray().concat($R('A', 'Z').toArray());
return $R(1, len).inject('', function(m, i) {return m + chars.random()});
}