JSPerf: The javascript comma operator vs. semicolon operator
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 generateUsers = function(x){ | |
var lastnames = ['Brown', 'Black', 'Green', 'Aaberg', 'Aagard', 'Abdella', 'Abebe', 'Caccamo', 'Caccavale', 'Caccese', 'Cacchione', 'Caccia', 'Cacciatore', 'Easley', 'Easlick', 'Easom', 'Eason', 'East', 'Eastburn', 'Ines', 'Infante', 'Infanti', 'Infantino', 'Infield','Infinger', 'Kaliszewski', 'Kalita', 'Kalivas', 'Kalivoda', 'Kalk', 'Kalka', 'Umpleby', 'Umscheid', 'Umstead', 'Umsted', 'Un', 'Unangst', 'Zediker', 'Zee', 'Zeeb', 'Zeedyk', 'Zeek', 'Zeeman']; | |
var firstnames = ['Mohamed', 'Youssef', 'Ahmed', 'Mahmoud', 'Mustafa', 'Yassin', 'Taha', 'Khaled', 'Hamza', 'Bilal', 'Ibrahim', 'Hassan', 'Hussein', 'Karim', 'Tareq', 'Abdel-Rahman', 'Ali', 'Omar', 'Halim', 'Murad', 'Selim', 'Abdallah', 'Alex', 'Alexander', 'Carter', 'Charlie', 'David', 'Jackson', 'James', 'Jase', 'Joseph', 'Wyatt', 'Charles', 'Clark', 'Cooper', 'Daniel', 'Drake', 'Dylan', 'Edward', 'Eli', 'Elijah', 'Emerson', 'Evan', 'Felix', 'Gabriel', 'Gavin', 'Gus', 'Isaac', 'Isaiah', 'Jacob', 'Jax', 'Kai', 'Kai |
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
myAwesomeApp | |
|-client | |
| |-lib #Only Client libraries | |
| |-js | |
| |-templates | |
|-collections #Define, Publish & Subscribe collections | |
|-lib #Isomorphic (Client + Server) libraries | |
|-public (or static) #files & folders avaliable via http | |
| |-css | |
| |-other |
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 symbols = '23456789QWERTYUPASDFGHJKZXCVBNM'; | |
var qty = 1500000; | |
var length = 7; | |
var code, hash, i, maxIndex, rand, symbol, _i, _j; | |
maxIndex = symbols.length - 1; | |
for (i = _i = 1; 1 <= qty ? _i <= qty : _i >= qty; i = 1 <= qty ? ++_i : --_i) { | |
code = 'KX '; | |
hash = 0; | |
for (symbol = _j = 1; 1 <= length ? _j <= length : _j >= length; symbol = 1 <= length ? ++_j : --_j) { | |
rand = Math.floor((Math.random() * maxIndex) + 1); |
JSPerf: Array toString join
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
/*jshint strict:false */ | |
/* | |
* @function | |
* @namespace String.prototype | |
* @name clone | |
* | |
* @description Clone (a.k.a. create singleton) of String object | |
* This method allows to resolve issue with variable's referencing | |
* See performance here: http://jsperf.com/clone-create-singleton-for-string-object |
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 | |
* @name Object.defineReactiveProperty | |
* @description define Reactive property: | |
* - set callback before Setter and Getter | |
* - set callback on Setter | |
* - set callback on Getter | |
* | |
* @param {object} target - Object on which we define a property | |
* @param {string} prop - Name of defining property |
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 | |
* @name Object.prototype.inArray | |
* @description Extend Object prototype within inArray function | |
* | |
* @param {mix} needle - Search-able needle | |
* @param {bool} searchInKey - Search needle in keys? | |
* | |
*/ | |
Object.defineProperty(Object.prototype, 'inArray',{ |