This file contains hidden or 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 randomNumber(from, to) { | |
return Math.floor((Math.random()*(to - from + 1)) + from); | |
} |
This file contains hidden or 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
// Common Regular Expression | |
// Email Address | |
/* Humans */ var emailHuman = /[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}/i; | |
/* Bots */ var emailBots = /^[\w!#$%&\’*+\/=?^`{|}~.-]+@(?:[a-z\d][a-z\d-]*(?:\.[a-z\d][a-z\d-]*)?)+\.(?:[a-z][a-z\d-]+)$/i; | |
// Date | |
var datePattern = /([01]?\d)[-\/ .]([0123]?\d)[-\/ .](\d{4})/; | |
// Web Address |
This file contains hidden or 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 debug = true, | |
_log = function() { | |
debug && window.console && console.log.apply(console, arguments); | |
}; |
This file contains hidden or 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 memoizer = function (cache, operation) { | |
var self = function (n) { | |
var result = cache[n]; | |
if (typeof result !== 'number') { | |
result = operation(self, n); | |
cache[n] = result; | |
} | |
return result; | |
}; | |
return self; |
NewerOlder