I hereby claim:
- I am deltaepsilon on github.
- I am chrisesplin (https://keybase.io/chrisesplin) on keybase.
- I have a public key ASDNf4HlYGnWXIBBydCSgZa1Wk1q2Z7eUr0Xa5x62ffqbQo
To claim this, I am signing this object:
| const flatten = require('./flatten'); | |
| describe('flatten', () => { | |
| it('should flatten deeply nested arrays of integers', () => { | |
| const arrays = [1, 2, 3, [4, 5, 6, [7, 8, 9], [10, 11, 12]]] | |
| const expected = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; | |
| expect(flatten(arrays)).toEqual(expected); | |
| }); | |
| }); |
I hereby claim:
To claim this, I am signing this object:
| if (typeof window.FirebaseMixin == 'undefined') { | |
| window.FirebaseMixin = superclass => { | |
| if (!superclass) { | |
| superclass = class Superclass {}; | |
| } | |
| return class extends superclass { | |
| constructor() { | |
| super(); | |
| this.__firebaseMixinInit(); |
| // Good | |
| exports.sendEmail = functions.auth.user().onCreate(event => { | |
| const mailgun = require('mailgun-js'); | |
| // ... | |
| }); | |
| // Not As Awesome | |
| const mailgun = require('mailgun-js'); | |
| exports.sendEmail = functions.auth.user().onCreate(event => { |
| const function = require('firebase-functions'); | |
| functions.database.ref('queues/login/{uid}').onWrite(event => { | |
| const config = functions.config(); | |
| // functions.config() returns your environment variables. | |
| // In this case I have an array of my admin users' email addresses in accessControlLists.adminUsers | |
| // It looks like ['chris@chrisesplin.com', 'some-other-admin@chrisesplin.com'] | |
| const adminUsersString = config.['access-control-lists']['admin-users']; | |
| const adminUsers = adminUsersString.split(','); | |
| const user = event.data.val(); |
| // Client-side code, in my case a web browser | |
| firebase.auth().onAuthStateChanged(function (user) { | |
| this.user = user; // Set my local copy of the 'user' object | |
| if (user) { | |
| this.displayName = user.displayName; | |
| this.photoURL = user.photoURL; | |
| var userRef = firebase.database().ref('queues/login').child(user.uid); | |
| userRef.remove() | |
| .then(function () { |
| functions.auth.user().onCreate(event => { | |
| const functions = require('firebase-functions'); | |
| const admin = require('firebase-admin'); | |
| const config = functions.config(); | |
| admin.initializeApp(config.firebase); | |
| const user = event.data; | |
| const userRef = admin.database().ref('/users').child(user.uid); |
| exports.sendWelcomeEmail = functions.auth.user().onCreate(event => { | |
| const user = event.data; | |
| const email = user.email; | |
| // … | |
| }); | |
| exports.sendByeEmail = functions.auth.user().onDelete(event => { | |
| const user = event.data; | |
| const email = user.email; | |
| // … | |
| }); |
| { | |
| "database": { | |
| "rules": "database.rules.bolt" | |
| }, | |
| "hosting": { | |
| "public": "dist", | |
| "rewrites": [ | |
| { | |
| "source": "/app/**/*", | |
| "destination": "/index.html" |