This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getScrollY() { | |
var currentY = 0; | |
if (typeof( window.pageYOffset ) == 'number') { | |
currentY = window.pageYOffset; | |
} else if (document.body && ( document.body.scrollLeft || document.body.scrollTop )) { | |
currentY = document.body.scrollTop; | |
} else if (document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop )) { | |
currentY = document.documentElement.scrollTop; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUrlParam(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regexS = "[\\?&]" + name + "=([^&#]*)"; | |
var regex = new RegExp(regexS); | |
var results = regex.exec(window.location.href); | |
if (results == null) { | |
return ""; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hideErrors() { | |
window.onerror = function () { | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(), | |
system = require('system'), | |
args = system.args, | |
siteName; | |
function takeScreenshot() { | |
if (args.length === 1) { | |
console.log('Please specify a URL to screenshot.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
processManagement: | |
fork: true | |
pidFilePath: /var/run/mongodb/mongod.pid | |
net: | |
bindIp: 127.0.0.1 | |
port: 27017 | |
storage: | |
dbPath: /var/lib/mongo | |
journal: | |
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapValue(value, fromMin, toMin, fromMax, toMax) { | |
return (value - fromMin) / (toMin - fromMin) * (toMax - fromMax) + fromMax; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=IF(COUNTIFS($B$1:B3;B3)>1;INDEX($A$1:A2;IFERROR(MATCH(B3;$B$1:B2;0);1));MAX($A$1:A2)+1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stdDev(arr) { | |
var avg = mean(arr); | |
var squareDiffs = arr.map(function (value) { | |
var diff = value - avg; | |
var sqrDiff = diff * diff; | |
return sqrDiff; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function weightedMean(arrValues, arrWeights) { | |
var result = arrValues.map(function (value, i) { | |
var weight = arrWeights[i]; | |
var sum = value * weight; | |
return [sum, weight]; | |
}).reduce(function (p, c) { |
OlderNewer