This file contains hidden or 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
| // ngmin can handle this fine; if not using ngmin, then | |
| // we'd do ['$provide', function($provide) { ... }] | |
| app.config(function($provide) { | |
| // however, ngmin does not know how to preserve the injected dependencies here! | |
| $provide.decorator('SomeFactory', function($delegate, $timeout) { | |
| }); | |
| }); |
This file contains hidden or 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
| // This can probably be simplified somehow. Not sure why I need to add it in the component to init the service. | |
| import { Component, OnInit } from '@angular/core'; | |
| import {TitleService} from "./@core/utils/title.service"; | |
| @Component({...}) | |
| export class AppComponent implements OnInit { | |
| constructor(private titleService: TitleService) {...} |
This file contains hidden or 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 functions = require('firebase-functions'); | |
| const util = require('util'); | |
| exports.helloWorld = functions.https.onRequest((req, res) => { | |
| // For Firebase Hosting URIs, use req.headers['fastly-client-ip'] | |
| // For callable functions, use rawRequest | |
| // Some users have better success with req.headers['x-appengine-user-ip'] | |
| const ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress; | |
| const headers = JSON.stringify(req.headers, null, 2); | |
| const message = util.format("<pre>Hello world!\n\nYour IP address: %s\n\nRequest headers: %s</pre>", ipAddress, headers); |
This file contains hidden or 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
| { | |
| "auctions": { | |
| "$auction_id": { | |
| "current_bid": { | |
| ".validate": "newData.hasChildren(['uid', 'amount'])", | |
| "uid": { | |
| ".validate": "newData.val() === auth.uid" | |
| }, | |
| "amount": { | |
| ".validate": "newData.isNumber() && newData.val() > data.val() && newData.val() === root.child('auctions/'+$auction_id+'/bids/'+auth.uid+'/amount').val()" |
This file contains hidden or 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
| // docs/{docId}/users is an array of user ids allowed to access the doc | |
| match /docs/{docId} { | |
| allow read if request.auth.uid in getData('docs/$(docId)').users; | |
| } | |
| /** | |
| * Shortcut to simplify pathing | |
| */ | |
| function getPath(childPath) { |
This file contains hidden or 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
| { | |
| "chat": { | |
| // the list of chats may not be listed (no .read permissions here) | |
| // a chat conversation | |
| "$key": { | |
| // if the chat hasn't been created yet, we allow read so there is a way | |
| // to check this and create it; if it already exists, then authenticated | |
| // user (specified by auth.id) must be in $key/users |
This file contains hidden or 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 functions = require('firebase-functions'); | |
| const admin = require('firebase-admin'); | |
| admin.initializeApp(); | |
| const express = require('express'); | |
| const cookieParser = require('cookie-parser')(); | |
| const cors = require('cors')({origin: true}); | |
| const app = express(); | |
| // See https://github.com/firebase/functions-samples/blob/Node-8/authorized-https-endpoint/functions/index.js | |
| const validateFirebaseIdToken = require('./validateFirebaseIdToken'); |
This file contains hidden or 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
| { | |
| "firestore": { | |
| "rules": "firestore.rules", | |
| "indexes": "firestore.indexes.json" | |
| }, | |
| "emulators": { | |
| "firestore": { | |
| "port": 8080 | |
| } | |
| } |
This file contains hidden or 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
| /** | |
| * This little helper is called instead of on() to monitor data and handle auth expiration | |
| * It assumes that you monitor authentication state and re-auth if | |
| * your auth token expires. It also doesn't help with any transactions, set ops, or | |
| * other writes which could be in progress when authentication is lost--those will | |
| * explode in glorious flashes of failure | |
| * | |
| * To support IE8, you will want these polyfills: | |
| * forEach: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill | |
| * indexOf: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill |
This file contains hidden or 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
| /* | |
| * Promise wrapper for Firebase | |
| * | |
| * Requires jQuery and underscore.js | |
| *************************************/ | |
| (function ($) { | |
| "use strict"; | |
| var undefined; | |
| var FIREBASE_URL = 'https://YOURINSTANCE.firebaseio.com'; |
NewerOlder