Skip to content

Instantly share code, notes, and snippets.

View kosiakMD's full-sized avatar
🎯
Focusing

Anton Kosiak kosiakMD

🎯
Focusing
View GitHub Profile
@kosiakMD
kosiakMD / memorySizeOfObject.js
Created March 11, 2016 14:26
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@kosiakMD
kosiakMD / umd-script-boilerplate.js
Created November 1, 2016 14:46 — forked from cferdinandi/umd-script-boilerplate.js
A simple boilerplate for UMD JS modules.
(function (root, factory) {
if ( typeof define === 'function' && define.amd ) {
define([], factory(root));
} else if ( typeof exports === 'object' ) {
module.exports = factory(root);
} else {
root.myPlugin = factory(root);
}
})(typeof global !== "undefined" ? global : this.window || this.global, function (root) {