Skip to content

Instantly share code, notes, and snippets.

const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const dom = new JSDOM(`<body></body>`);
const document = dom.window.document;
const runnerLoopCount = 10;
const canvasLoopCount = 1000;
@LaleWolf
LaleWolf / fabricMemoryLeak.js
Created January 30, 2020 12:43
fabric-gist
const { fabric } = require('fabric');
fabric.Object.prototype.objectCaching = false;
const runnerLoopCount = 10;
const canvasLoopCount = 1000;
const newFabricCanvas = () => {
for (let i = 0; i < canvasLoopCount; i++) {
@LaleWolf
LaleWolf / no return
Created October 3, 2012 09:27
Change property names of a collection [Underscore.js mixin]
_.mixin({
renameProperties: function (object, translations) {
_.each(_.pairs(translations), function(translation) {
_.each(object, function(item){
if (item.hasOwnProperty(translation[0])) {
item[translation[1]] = item[translation[0]];
delete item[translation[0]];
}
});
});
@LaleWolf
LaleWolf / ListToKendoGrid_UnderscoreMixin
Created October 3, 2012 08:35
Anpassung des ListModels auf KendoUI Grid Column Struktur
_.mixin({
renameProperties: function (object, oldValue, newValue) {
_.each(object, function(item) {
item.renameProperty(oldValue, newValue);
});
return object;
}
});