<commit_before>// please ignore any magic, magic can be resolved at <EMAIL>

var nodemailer = require('nodemailer');
var Q = require('q');
var config = require('./config.js');
var knex = require('knex')({
  dialect: 'mysql',
  connection: config.mysql,
  debug: false
});


GetYesterdayMentions().then(function(mentions){
    
    var output = '<table>';
    for(var i in mentions) {
        output +=   '<tr>' +
                    '<td style="border: 1px solid black; padding: 5px;">' + mentions[i].framework + '</td>' +
                    '<td style="border: 1px solid black; padding: 5px;">'+ mentions[i].count + '</td>' +
                    '</tr>'
    }
    output += '</table>'

    var mailOptions = {
        from: 'Famo.us Tweet Bot <<EMAIL>>', // sender address
        to: '<EMAIL>, <EMAIL>', // list of receivers
        subject: 'Twitter Mentions ' + _yesterdayDate(),
        html: output // html body
    };

    // send mail with defined transport object
    transporter.sendMail(mailOptions, function(error, info){
        if(error){
            console.log(error);
        }else{
            console.log('Message sent: ' + info.response);
            process.exit(1);
        }
    });
});

// create reusable transporter object using SMTP transport
var transporter = nodemailer.createTransport({
    service: 'Gmail',
    auth: config.gmailAuth
});

function GetYesterdayMentions() {
    var today = new Date();
    var start = new Date(1900 + today.getYear(), today.getMonth(), today.getDate()-1, 1).getTime() * 0.001;
    var end = new Date(1900 + today.getYear(), today.getMonth(), today.getDate(), 1).getTime() * 0.001;
    return knex('tweets')
    .distinct('flag').select()
    .then(function(targets){
        var promises = [];
        for (var index in targets){
            debugger;
            promises.push(_countMentions(targets[index].flag, start, end));
        }
        return Q.all(promises);
    });
}

function _yesterdayDate(){
    var today = new Date();
    //javascript has date values 0 indexed lol.
    return (today.getMonth()+1) + "/" + (today.getDate()-2);
}

function _countMentions(framework, start, end) {
    debugger;
    return knex('tweets').count('*')
    .where('created_at', '>', start)
    .where('created_at', '<', end)
    .where('flag', '=', framework)
    .then(function(row){
        debugger;
        return {
            count: row[0]['count(*)'],
            framework: framework
        }
    });
}
<commit_msg>changed mail to send to marketing list<commit_after>// please ignore any magic, magic can be resolved at <EMAIL>

var nodemailer = require('nodemailer');
var Q = require('q');
var config = require('./config.js');
var knex = require('knex')({
  dialect: 'mysql',
  connection: config.mysql,
  debug: false
});


GetYesterdayMentions().then(function(mentions){
    
    var output = '<table>';
    for(var i in mentions) {
        output +=   '<tr>' +
                    '<td style="border: 1px solid black; padding: 5px;">' + mentions[i].framework + '</td>' +
                    '<td style="border: 1px solid black; padding: 5px;">'+ mentions[i].count + '</td>' +
                    '</tr>'
    }
    output += '</table>'

    var mailOptions = {
        from: 'Famo.us Tweet Bot <<EMAIL>>', // sender address
        to: '<EMAIL>', // list of receivers
        subject: 'Twitter Mentions ' + _yesterdayDate(),
        html: output // html body
    };

    // send mail with defined transport object
    transporter.sendMail(mailOptions, function(error, info){
        if(error){
            console.log(error);
        }else{
            console.log('Message sent: ' + info.response);
            process.exit(1);
        }
    });
});

// create reusable transporter object using SMTP transport
var transporter = nodemailer.createTransport({
    service: 'Gmail',
    auth: config.gmailAuth
});

function GetYesterdayMentions() {
    var today = new Date();
    var start = new Date(1900 + today.getYear(), today.getMonth(), today.getDate()-1, 1).getTime() * 0.001;
    var end = new Date(1900 + today.getYear(), today.getMonth(), today.getDate(), 1).getTime() * 0.001;
    return knex('tweets')
    .distinct('flag').select()
    .then(function(targets){
        var promises = [];
        for (var index in targets){
            debugger;
            promises.push(_countMentions(targets[index].flag, start, end));
        }
        return Q.all(promises);
    });
}

function _yesterdayDate(){
    var today = new Date();
    //javascript has date values 0 indexed lol.
    return (today.getMonth()+1) + "/" + (today.getDate()-2);
}

function _countMentions(framework, start, end) {
    debugger;
    return knex('tweets').count('*')
    .where('created_at', '>', start)
    .where('created_at', '<', end)
    .where('flag', '=', framework)
    .then(function(row){
        debugger;
        return {
            count: row[0]['count(*)'],
            framework: framework
        }
    });
}

{'fraction_non_alphanumeric': 0.1647271268057785, 'fraction_numerical': 0.011235955056179775, 'mean_word_length': 2.51056338028169, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, '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': '6902728', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1506, 'n_words': 385}