Skip to content

Instantly share code, notes, and snippets.

View dr-dimitru's full-sized avatar
👨‍💻
get 💩 done

dr.dimitru dr-dimitru

👨‍💻
get 💩 done
View GitHub Profile
@dr-dimitru
dr-dimitru / readme.md
Last active August 29, 2015 14:10
The javascript comma operator vs. semicolon operator
@dr-dimitru
dr-dimitru / generateUsers.js
Last active August 29, 2015 14:09
Meteor Generate random users with names
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
@dr-dimitru
dr-dimitru / Meteor_Boilerplate_Structure
Last active August 29, 2015 14:08
Meteor.js boilerplate files and folders structure
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
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);
@dr-dimitru
dr-dimitru / readme.md
Last active August 29, 2015 14:07
localStorage square bracket syntax vs. methods
@dr-dimitru
dr-dimitru / readme.md
Last active August 29, 2015 14:07
Test performance of array toString join
@dr-dimitru
dr-dimitru / readme.md
Last active August 29, 2015 14:07
JavaScript: 4 ways to concatenate a string
@dr-dimitru
dr-dimitru / string.js
Last active August 29, 2015 14:07
Clone (a.k.a. create singleton) for String object
/*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
@dr-dimitru
dr-dimitru / object.js
Created September 11, 2014 16:18
Meteor defineReactiveProperty() method
/*
* @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
@dr-dimitru
dr-dimitru / object.js
Created September 11, 2014 10:20
Vanilla JS inArray
/*
* @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',{