Skip to content

Instantly share code, notes, and snippets.

@ricomoss
Created December 22, 2013 07:53
Show Gist options
  • Save ricomoss/8079546 to your computer and use it in GitHub Desktop.
Save ricomoss/8079546 to your computer and use it in GitHub Desktop.
Feeds = new Meteor.Collection('feeds');
if (Meteor.isServer) {
Meteor.methods({
twit_get: function() {
Twit = new TwitMaker({
consumer_key: 'foo',
consumer_secret: 'foo',
access_token: 'foo',
access_token_secret: 'foo'
});
Twit.get(
'search/tweets',
{
q: 'banana since:2013-12-11',
count: 10
},
function(err, reply) {
for (var obj in reply['statuses']) {
Feeds.insert({feed: reply['statuses'][obj].text});
}
});
}
});
}
if (Meteor.isClient) {
Template.twitter_feeds.feeds = function () {
return Feeds.find({}, {sort: {feed: -1}});
};
Meteor.call('twit_get');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment