This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. data modelling and joins? | |
// allows for querying orders | |
// requires getting activites and then querying orders | |
// little slower on the reads?? -- read activity and then read async value details | |
// can easily read orders? | |
// a. | |
// please note that there could be multiple types | |
x = { | |
activities: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Goal1: get activites for user for particular date | |
// Goal2: get most recent activites in the database for reporting | |
// Match: UID and startDate | |
// 2 options | |
// a. pushed objects | |
// not sure how to query for both uid AND startDate | |
// easy to achieve goal 2 | |
z = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"users": { | |
"$uid": { | |
".read": "auth !== null && (auth.uid === $uid || auth.uid === 'admin')", | |
".write": "auth !== null && newData.child('email').exists() && (auth.uid === $uid || auth.uid === 'admin')", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://medium.com/@koresar/fun-with-stamps-episode-1-stamp-basics-e0627d81efe0#.ke7jo334j | |
const stampit = require('stampit'); | |
// stampit(methods, state, enclose); | |
const HasFoo = stampit.compose({ | |
properties: { | |
foo: 'default foo!' | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stampit = require('stampit'); | |
// stampit(methods, state, enclose); | |
var testObj = stampit( | |
// methods | |
{ | |
delegateMethod: function delegateMethod() { | |
return 'shared property'; | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stripe = require("stripe")( | |
"TEST_STRIPE_HERE" | |
); | |
class Charge { | |
constructor(opts = {}) { | |
this.amount = opts.amount; | |
this.currency = 'cad'; | |
this.customer = opts.customer; | |
this.description = opts.description; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stripeProvider = require('../helpers/providers-stripe'); | |
module.exports = class Charge { | |
constructor(opts = {}) { | |
this.amount = opts.amount; | |
this.currency = 'cad'; | |
this.customer = opts.customer; | |
this.description = opts.description; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Run a chain of promises | |
Catch pTwo because it's rejected | |
When handling the error, call a class instance method | |
*/ | |
class CatchHandler { | |
constructor(){ | |
this.value = 'visible' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Why doesn't this return run p1, run p2, run p3 | |
// currently returns run p1, run p3, run p2 | |
const p1 = () => { | |
return new Promise((resolve, reject) => { | |
console.log('run p1'); | |
setTimeout(resolve, 1000, 'p1'); | |
}) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.signInSocial = function() { | |
return $q(function(resolve, reject) { | |
$cordovaOauth.facebook("208207529514102", [ "public_profile", "email"]) | |
.then(function (result) { | |
var credentials = firebase.auth.FacebookAuthProvider.credential(result.access_token); | |
return firebase.auth().signInWithCredential(credentials); | |
}) | |
.then(function (firebaseUser) { | |
resolve(firebaseUser); | |
}) |