Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Karthick Kumar karthickvkumar

🎯
Focusing
View GitHub Profile
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"
});
@karthickvkumar
karthickvkumar / position.js
Created Jul 3, 2017
show object positoin
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 {
@karthickvkumar
karthickvkumar / chunk.js
Created Jun 20, 2017
Chunk array into equals
View chunk.js
Array.prototype.chunk = function ( n ) {
if ( !this.length ) {
return [];
}
return [ this.slice( 0, n ) ].concat( this.slice(n).chunk(n) );
};
@karthickvkumar
karthickvkumar / isolate_scope.html
Last active Jun 5, 2017
Angular js isolated scopes
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
@karthickvkumar
karthickvkumar / drag.html
Created May 31, 2017
Javascript Native Drag
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>
@karthickvkumar
karthickvkumar / memorySizeOfObject.js
Created Apr 4, 2017 — forked from zensh/memorySizeOfObject.js
calculate memory size of javascript object, it is not a accurate value!
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':
You can’t perform that action at this time.