Skip to content

Instantly share code, notes, and snippets.

View didymu5's full-sized avatar

Tommy Wu didymu5

  • Los Angeles
  • 02:13 (UTC -12:00)
View GitHub Profile
@didymu5
didymu5 / _.sum
Created July 17, 2014 07:12
Summing an Array - Nice for totaling numerical value
_.sum = function(obj) {
if (!$.isArray(obj) || obj.length == 0) {
return 0;
}
return _.reduce(obj, function(sum, n) { return sum += n; }); }
new Vue({
router,
store,
created() {
firebase.initializeApp(config)
firebase.auth().onAuthStateChanged((user) => {
this.$store.dispatch('setUser', user)
})
},