Skip to content

Instantly share code, notes, and snippets.

Avatar

Tommy Wu didymu5

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