903 karma · joined Sep 10, 2011 (15y ago) · 690 submissions
comment 13y ago · link · parent
comment 13y ago · link · parent
And your example is disingenuous too, why do we need to add so much logic instead of collecting the errors if you want to handle them anyway?
result.push(err || data);
So you don't need to copy around a variable called "hasFail", one line can be enough var failed = results.every(Buffer.isBuffer);comment 13y ago · link · parent
var result = [];
paths.forEach(function (i, file){
fs.stat(file, function (err, data){
result.push(data);
if (i === 0) {
// Use stat size
}
if (result.length === paths.length) {
// Use the stats
}
});
});
Fairly understandable, more efficient and without introducing logic patterns foreign to many. It also meet his requirements (It is parallel and we only hit every file once)comment 13y ago · link · parent
Because only humans are capable to, do you seriously think overwhelming cognitive advantage would be used any different if we had different traits? If our heads were shaped like the ones of mice? Or if we had 4 stomachs like the cows? And this selfishness and disregard for other animals well being is what made humans growth so quickly and one of the main reasons you and me exist.
comment 13y ago · link · parent
The code can be found here: https://gist.github.com/AltIvan/5243025
It looks like: http://i.imgur.com/iYrfuOf.png
I know that the login button disappeared but it ask you to login in when you try to reply, up-vote or submit.
comment 13y ago · link · parent
comment 13y ago · link · parent
var c = console
var l = console.log
var log = function(){ l.apply(c, arguments) }
Now they can't break the console from working with stuff like: console.log = function(){}comment 13y ago · link · parent
chrome.inspector.detector = function(){ return {open:false}}
But a more aggresive solution is this one: console = undefined;
var iframe = document.body.appendChild(document.createElement("iframe"));
iframe.style.display = "none";
window._console = iframe.contentWindow.console
And you can use `_console` instead of `console`comment 13y ago · link · parent
comment 13y ago · link · parent
comment 13y ago · link · parent
comment 13y ago · link · parent
Instead of looking for a workaround I would suggest that since you are already aiming for modern browsers maybe you should use SVG (clip-path) with CSS {pointer-events: none} so you have a real "hole" and you could use 4 dummy divs if you want to disable interaction with non-focused elements.