Instantly share code, notes, and snippets.

View serverless-token.js
const client = stream.connect(key, secret);
module.exports.token = (event, context, callback) => {
const data = JSON.parse(event.body);
const token = client.createUserSessionToken(data.user);
const response = {
statusCode: 200,
headers: {
View gist:44c0c465df86105dbf6a1c8c854aacd4
session.feed('user').follow('user', userIdOfUserThatShouldBeFollowed);
View crawl.sh
serverless invoke local --function crawl
View rootStack.js
import React, { Component } from 'react';
import { createStackNavigator } from 'react-navigation';
import browserPollyfill from 'react-native-browser-polyfill';
import { Welcome, Feed } from './screens';
const RootStack = createStackNavigator({
Welcome: {
screen: Welcome,
navigationOptions: {
View create-new-project.sh
create-react-native-app test && cd test && yarn add expo-activity-feed
View crawl.js
module.exports.crawl = () => {
twitterClient.get(
'search/tweets',
{ q: '@FlyFrontier', count: 100 },
(err, data, res) => {
data.statuses.map(status => {
streamClient
.feed('timeline', 'all')
.addActivity({
actor: streamClient.collections.createUserReference(
View token.js
module.exports.token = (event, context, callback) => {
const data = JSON.parse(event.body);
const token = streamClient.createUserSessionToken(data.user);
const response = {
statusCode: 200,
body: JSON.stringify({ token: token })
};
View CommentBox.jsx
<CommentBox
onSubmit={text =>
props.onAddReaction(
'comment',
props.activity,
{
data: { text: text }
}
)
}
View CommentList.jsx
<CommentList
reactions={props.activity.latest_reactions}
/>