Skip to content

Instantly share code, notes, and snippets.

@brianloveswords
Created March 2, 2011 16:28
Show Gist options
  • Save brianloveswords/851205 to your computer and use it in GitHub Desktop.
Save brianloveswords/851205 to your computer and use it in GitHub Desktop.
db.open(function(err, client){
var is_setup = null;
var hash_col = null;
var user_col = null;
var continue_execution = function(){
if ( !(is_setup && hash_col && user_col) ) return false;
sys.puts('setup and found collections');
start_stream();
return true;
};
// setup stuff
db.createCollection('hashtag', function(err, collection){
console.log('ready with hashtag');
hash_col = collection;
continue_execution();
});
db.createCollection('user', function(err, collection){
console.log('ready with user');
user_col = collection;
continue_execution();
});
var prepare_stream_watcher = (function () {
winston.add(winston.transports.File, {filename: 'status.log'});
twit.headers['User-Agent'] = 'DML Game Follower';
twit.addListener('error', function(error){
winston.error(error.message);
}).addListener('tweet', function(tweet){
winston.info('@' + tweet.user.screen_name + ': ' + tweet.text);
tweet_parser(tweet);
}).addListener('end', function(resp) {
winston.info("disconnected: " + resp.statusCode);
});
is_setup = true;
continue_execution();
})();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment