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 client = stream.connect(STREAM_KEY, STREAM_SECRET, APP_ID); |
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 getTimelineFeed = (username) => { | |
const timeLineFeed = client.feed('timeline', username); | |
return timeLineFeed.get({ | |
limit: 25, | |
reactions: { | |
counts: true, | |
}, | |
}).then((result) => { | |
return result; | |
}); |
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
[ | |
{ | |
"author": "toyjake74737", | |
"id": "ELBQLRyUFfTn1BkPxMsm", | |
"title": "Creepy Uber", | |
"lastUpdated": 1554394376612, | |
"favoriteCount": 1 | |
}, | |
{ | |
"author": "toyjake74737", |
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 addPostActivity = (username, postId, postTitle, timestamp) => { | |
const userFeed = client.feed('user', username); | |
return userFeed.addActivity({ | |
actor: username, | |
verb: 'post', | |
object: postId, | |
foreign_id: `post:${postId}`, | |
postTitle, | |
timestamp, | |
}); |
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 addReaction = (username, type, postActivityId) => { | |
const userClient = getClient(); | |
return userClient.reactions.add(type, postActivityId, { | |
actor: username, | |
timestamp: new Date().getTime(), | |
}); | |
} |
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 reactions = client.reactions.filter({ | |
'activity_id': postActivityId | |
}); |
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
jwt = require('jsonwebtoken'); | |
module.exports = function createToken(userEmail) { | |
const token = jwt.sign({ | |
access: userEmail | |
}, 'secret'); | |
} |
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
jwt = require('jsonwebtoken'); | |
const ADMINS = ['[email protected]']; | |
module.exports = function createToken(userEmail) { | |
let access = userEmail; | |
ADMINS.forEach(email => { | |
if (email === userEmail) | |
access = '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
const stampit = require('stampit'); | |
const Character = stampit({ | |
props: { | |
name: null, | |
health: 100, | |
stamina: 100, | |
}, | |
init({ name = this.name }) { | |
this.name = name |
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 Flying = stampit(Character, { | |
methods: { | |
fly() { | |
console.log(`${this.name} takes off in the sky!`) | |
stamina --; | |
} | |
} | |
}); | |