View karma.conf.js
// Karma configuration | |
// Generated on Thu Oct 18 2018 18:22:53 GMT+0530 (India Standard Time) | |
module.exports = function(config) { | |
config.set({ | |
// base path that will be used to resolve all patterns (eg. files, exclude) | |
basePath: '', | |
reporters: ['progress', 'html'], | |
View filter.js
var left_left = $filter('filter')(objects, { | |
id : "LEGLEFT" | |
}); |
View position.js
_transformObject: function(e) { | |
this.renderAll(); | |
transform.target._renderTransformDetail(transform); | |
} | |
fabric.Object = fabric.util.createClass({}); | |
transformDetailOffset: 30, | |
showTransformDetails: true, |
View fanctory_vs_service.js
//service | |
app.service('MyService', function () { | |
this.sayHello = function () { | |
console.log('hello'); | |
}; | |
}); | |
//factory | |
app.factory('MyService', function () { | |
return { |
View chunk.js
Array.prototype.chunk = function ( n ) { | |
if ( !this.length ) { | |
return []; | |
} | |
return [ this.slice( 0, n ) ].concat( this.slice(n).chunk(n) ); | |
}; |
View isolate_scope.html
<div ng-controller="MyCtrl"> | |
<h2>Parent Scope</h2> | |
<input ng-model="foo"> <i>// Update to see how parent scope interacts with component scope</i> | |
<br><br> | |
<!-- attribute-foo binds to a DOM attribute which is always | |
a string. That is why we are wrapping it in curly braces so | |
that it can be interpolated. | |
--> | |
<my-component attribute-foo="{{foo}}" binding-foo="foo" | |
isolated-expression-foo="updateFoo(newFoo)" > |
View array_difference.js
/*Return only difference array*/ | |
[1,2].filter(function(i){ | |
return [3,1].indexOf(i) < 0 | |
}) | |
/*Return concat difference array*/ | |
[1,2].filter(function(i){ | |
return [3,1].indexOf(i) < 0 | |
}).concat([3,1].filter(function(i){ | |
return [1,2].indexOf(i) < 0 |
View drag.html
<div id="one"> | |
</div> |
View agular_digest_Loop.html
<!DOCTYPE html> | |
<html> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> | |
<body> | |
<div ng-app="myApp" ng-controller="myCtrl"> | |
{{data.time}} | |
<br/> | |
<button ng-click="updateTime()">update time - ng-click</button> | |
<button id="updateTimeButton" >update time</button> | |
</div> |
View memorySizeOfObject.js
function memorySizeOf(obj) { | |
var bytes = 0; | |
function sizeOf(obj) { | |
if(obj !== null && obj !== undefined) { | |
switch(typeof obj) { | |
case 'number': | |
bytes += 8; | |
break; | |
case 'string': |