<commit_before>
/**
 * Module dependencies.
 */

var DEV_PORT = 3000;

var routes = require('./routes');
var user = require('./routes/user');
var path = require('path');
var util = require('util');
var twitter = require('twitter');
var twit = new twitter({
    consumer_key: 'mYVqwQEonkbBww11sMg',
    consumer_secret: '<KEY>',
    access_token_key: '<KEY>',
    access_token_secret: '<KEY>'
});

//var _ = require('underscore');

// Init server, express app, and socket. Everyone is listening.
var express = require('express')
	, app = express()
	, server = require('http').createServer(app)
	, io = require('socket.io').listen(server);

// all environments
app.set('port', process.env.PORT || DEV_PORT);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(app.router);
app.use(require('stylus').middleware(__dirname + '/public/css'));
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

server.listen(app.get('port'), function(){
	console.log('Express server listening on port ' + app.get('port'));
});

app.get('/', routes.index);
app.get('/users', user.list);

io.sockets.on('connection', function (socket) {
	console.log('HANDSHAKE MADE!');

	socket.on('get-twitter-stream', function (data){
		var params = {
			screen_name : data.username,
			count : 20,
			trim_user : true,
			exclude_replies : true
		};
		console.log("Username: "+data.username);
		twit.get('/statuses/user_timeline.json', params, function (tweets) {
				console.log("twit.get > tweets\n"+util.inspect(tweets));
				socket.emit('twitter-data-update', tweets );
		});
	});
	
	//socket.emit('news', { hello: 'world' });
	// socket.on('my other event', function (data) {
	// 	console.log(data);
	// });
});

// Twitter routing
// twit.get('/statuses/show/27593302936.json', {include_entities:true}, function(data) {
//     console.log(util.inspect(data));
// });



// http.createServer(app).listen(app.get('port'), function(){
// 	console.log('Express server listening on port ' + app.get('port'));
// });<commit_msg>fixing data object references<commit_after>
/**
 * Module dependencies.
 */

var DEV_PORT = 3000;

var routes = require('./routes');
var user = require('./routes/user');
var path = require('path');
var util = require('util');
var twitter = require('twitter');
var twit = new twitter({
    consumer_key: 'mYVqwQEonkbBww11sMg',
    consumer_secret: '<KEY>',
    access_token_key: '<KEY>',
    access_token_secret: '<KEY>'
});

//var _ = require('underscore');

// Init server, express app, and socket. Everyone is listening.
var express = require('express')
	, app = express()
	, server = require('http').createServer(app)
	, io = require('socket.io').listen(server);

// all environments
app.set('port', process.env.PORT || DEV_PORT);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(app.router);
app.use(require('stylus').middleware(__dirname + '/public/css'));
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

server.listen(app.get('port'), function(){
	console.log('Express server listening on port ' + app.get('port'));
});

app.get('/', routes.index);
app.get('/users', user.list);

io.sockets.on('connection', function (socket) {
	console.log('HANDSHAKE MADE!');

	socket.on('get-twitter-stream', function (username){
		var params = {
			screen_name : username,
			count : 20,
			trim_user : true,
			exclude_replies : true
		};
		console.log("Username: "+username);
		twit.get('/statuses/user_timeline.json', params, function (tweets) {
				console.log("twit.get > tweets\n"+util.inspect(tweets));
				socket.emit('twitter-data-update', tweets );
		});
	});
});
{'fraction_non_alphanumeric': 0.20632672332389046, 'fraction_numerical': 0.006373937677053824, 'mean_word_length': 4.812071330589849, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1226559', 'n_tokens_mistral': 1478, 'n_tokens_neox': 1400, 'n_words': 272}