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
@Injectable() | |
export class GamesService { | |
/** Internal model state */ | |
private games:Object[]; | |
/** Private Subject **/ | |
private _gamesSource:Subject<Object[]> = new Subject<Object[]>(); | |
/** Public Observer **/ |
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
export class GamesComponent implements OnDestroy { | |
private _gamesSubscription:Subscription; | |
constructor(private _gamesService:GamesService){ | |
/** | |
* If we had already emitted values down this observable we would immediately receive them here, without re-requesting them. | |
* We would be able to quickly populate the component and if need re-request the data from within the ngOnInit lifecycle hook. | |
*/ | |
this._gamesSubscription = this._gamesService.gamesChanged$.subscribe((games) => { |
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
fs.readdir(source, function (err, files) { | |
if (err) { | |
console.log('Error finding files: ' + err) | |
} else { | |
files.forEach(function (filename, fileIndex) { | |
console.log(filename) | |
gm(source + filename).size(function (err, values) { | |
if (err) { | |
console.log('Error identifying file size: ' + err) | |
} else { |
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
'use strict'; | |
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const IncomingWebhook = require('@slack/client').IncomingWebhook; | |
const url = 'https://hooks.slack.com/services/${SLACK_API}'; | |
const functions = require('firebase-functions'); | |
/** | |
* Pushes from firebase ref /exception to slack chanel |
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
'use strict'; | |
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const functions = require('firebase-functions'); | |
exports.emailProcessor = functions.database.ref('/email/raw/{emailId}').onWrite(event => { | |
if (event.data.exists()) { | |
let rawEmail = event.data.val(); |
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
bot.on("contactRelationUpdate", (message) => { | |
const userId = message.user.id; | |
const username = message.user.name || "--"; | |
const channelId = message.address.channelId; | |
const address = message.address; | |
// When the users adds the bot | |
if (message.action === "add") { | |
// Persist the user to firebase |
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 userId = session.message.message.user.id; | |
const channelId = session.message.address.channelId; | |
// Load the specified user | |
firebase.database().ref(`chat-users/${channelId}/${userId}`) | |
.once('value') | |
.then((snapshot) => { | |
// Get the ref data | |
let user = snapshot.val(); |
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 functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
// Define a onRequest trigger - this will be invoked from every webhook | |
exports.coinbaseToFirebase = functions.https.onRequest((req, res) => { | |
// Simply log the headers & body (Debug only) | |
console.log(JSON.stringify(req.headers, null, 4)); | |
console.log(JSON.stringify(req.body, null, 4)); |
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
{ | |
"attempt_number": 5, | |
"event": { | |
"created_at": "2018-02-16T08:50:20Z", | |
"data": { | |
"id": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", | |
"name": "Test", | |
"status": "NEW", | |
"pricing": { | |
"BCH": { |
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
{ | |
"title": "Asset Metadata", | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string", | |
"description": "Identifies the asset to which this NFT represents", | |
}, | |
"description": { | |
"type": "string", |