Skip to content

Instantly share code, notes, and snippets.

View voznik's full-sized avatar
🤔
Open for opportunities

Vadym Parakonnyi voznik

🤔
Open for opportunities
View GitHub Profile
# @ngdoc overview
# @name ui-commons.hook
# @description
# a directive to hook enter/leave events to select children without watchers or broadcasting
@directive = angular.module('ui-commons.hook', [])
@directive.controller 'UiHookController', ['$scope', ($scope) ->
hooks = []
@addHook = (fn) ->
@voznik
voznik / SumByKey.js
Last active September 10, 2015 14:18 — forked from Cacodaimon/SumByKey.js
A simple AngularJS filter for summarizing the values of an array containing objects by a key.
angular.module('caco.feed.filter', [])
.filter('sumByKey', function() {
return function(data, key) {
if (typeof(data) === 'undefined' || typeof(key) === 'undefined') {
return 0;
}
var sum = 0;
for (var i = data.length - 1; i >= 0; i--) {
sum += parseInt(data[i][key]);
.truncate {
width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}