Skip to content

Instantly share code, notes, and snippets.

View eduardoreche's full-sized avatar
🤓

Eduardo Reche eduardoreche

🤓
View GitHub Profile
@eduardoreche
eduardoreche / settings.json
Last active May 12, 2022 18:13
VSCode settings
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.autoClosingBrackets": "languageDefined"
},
"prettier.printWidth": 80,
"prettier.singleQuote": true,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": false,
"terminal.integrated.minimumContrastRatio": 4.5,
@Cacodaimon
Cacodaimon / SumByKey.js
Created November 4, 2013 21:12
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]);