<commit_before>'use strict';

var express = require('express');
var routes = require('./app/routes/index.js');
var mongoose = require('mongoose');
var passport = require('passport');
var session = require('express-session');

var app = express();
require('dotenv').load();
require('./app/config/passport')(passport);

mongoose.connect(process.env.MONGO_URI);

app.use('/controllers', express.static(process.cwd() + '/app/controllers'));
app.use('/public', express.static(process.cwd() + '/public'));
app.use('/common', express.static(process.cwd() + '/app/common'));

function getMonth(index){
	switch (index) {
		case 0: return "January"; 
		case 1: return "February"; 
		case 2: return "March"; 
		case 3: return "April";
		case 4: return "May"; 
		case 5: return "June"; 
		case 6: return "July"; 
		case 7: return "September"; 
		case 8: return "August"; 
		case 9: return "October"; 
		case 10: return "November"; 
		case 11: return "December"; 
	}
}

function getNaturalString(date){
	var month = getMonth(date.getMonth());
	return ""+month+" "+(date.getDay()+1)+", "+date.getFullYear();
}

app.get('/:time', function(req, res){
	var stringParameter = req.path.substr(1);
	var reNaturalTime = /(January|February|March|April|May|June|July|September|August|October|November|December)(%20)(\d+),(%20)(\d{4})/g;
	var resultNatural = reNaturalTime.exec(stringParameter);
	
	var reUnixTime = /\d{10}/;
	var resultUnix = reUnixTime.exec(stringParameter);
	console.log(stringParameter);
	
	if (resultNatural !== null){ // NATURAL
		var cleanedString = stringParameter.replace(/%20/g," ");
		var d = new Date(cleanedString);
		var jsonObject = {"unix": d.getTime()/1000, "natural": cleanedString}
		res.send(jsonObject);
	} else if (resultUnix !== null){ // UNIX
		var d = new Date(Number(stringParameter)*1000);
		var naturalString = getNaturalString(d);
		var jsonObject = {"unix": d.getTime()/1000, "natural": naturalString}
		res.send(jsonObject);
	} else {
		res.send({"unix":null, "natural": null});		
	}
});

app.use(session({
	secret: 'secretClementine',
	resave: false,
	saveUninitialized: true
}));

app.use(passport.initialize());
app.use(passport.session());

routes(app, passport);

var port = process.env.PORT || 8080;
app.listen(port,  function () {
	console.log('Node.js listening on port ' + port + '...');
});<commit_msg>cleaned code of clementine stuff<commit_after>'use strict';

var express = require('express');
var app = express();

function getMonth(index){
	switch (index) {
		case 0: return "January"; 
		case 1: return "February"; 
		case 2: return "March"; 
		case 3: return "April";
		case 4: return "May"; 
		case 5: return "June"; 
		case 6: return "July"; 
		case 7: return "September"; 
		case 8: return "August"; 
		case 9: return "October"; 
		case 10: return "November"; 
		case 11: return "December"; 
	}
}

function getNaturalString(date){
	var month = getMonth(date.getMonth());
	return ""+month+" "+(date.getDay()+1)+", "+date.getFullYear();
}

app.get('/:time', function(req, res){
	var stringParameter = req.path.substr(1);
	var reNaturalTime = /(January|February|March|April|May|June|July|September|August|October|November|December)(%20)(\d+),(%20)(\d{4})/g;
	var resultNatural = reNaturalTime.exec(stringParameter);
	
	var reUnixTime = /\d{10}/;
	var resultUnix = reUnixTime.exec(stringParameter);
	console.log(stringParameter);
	
	if (resultNatural !== null){ // NATURAL
		var cleanedString = stringParameter.replace(/%20/g," ");
		var d = new Date(cleanedString);
		var jsonObject = {"unix": d.getTime()/1000, "natural": cleanedString}
		res.send(jsonObject);
	} else if (resultUnix !== null){ // UNIX
		var d = new Date(Number(stringParameter)*1000);
		var naturalString = getNaturalString(d);
		var jsonObject = {"unix": d.getTime()/1000, "natural": naturalString}
		res.send(jsonObject);
	} else {
		res.send({"unix":null, "natural": null});		
	}
});

var port = process.env.PORT || 8080;
app.listen(port,  function () {
	console.log('Node.js listening on port ' + port + '...');
});
{'fraction_non_alphanumeric': 0.18615040953090098, 'fraction_numerical': 0.020352444775378505, 'mean_word_length': 4.900439238653002, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, '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': '7262223', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1344, 'n_words': 319}