This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LinkedList.prototype.reverse = function() { | |
var node = this.head; | |
var previous = null; | |
while (node !== null) { | |
var save = node.next; | |
node.next = previous; | |
previous = node; | |
node = save; | |
} | |
var save = this.head; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var generate = function(numRows) { | |
var rows = []; | |
for (var row = 1; row <= numRows; row++) { | |
rows.push([]); | |
var rowIndex = row - 1; | |
var numOfItems = row; | |
for (var itemNum = 1; itemNum <= numOfItems; itemNum++) { | |
if (itemNum === 1 || itemNum === numOfItems) { | |
rows[rowIndex].push(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[nodemon] 1.14.11 | |
[nodemon] to restart at any time, enter `rs` | |
[nodemon] watching: *.* | |
[nodemon] starting `node server.js` | |
express:router:route new '/' +0ms | |
express:router:layer new '/' +1ms | |
express:router:route get '/' +1ms | |
express:router:layer new '/' +0ms | |
express:router:route new '/login' +0ms | |
express:router:layer new '/login' +0ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const s3etm = require('s3-emails-to-mongo'); | |
// MAKE THIS PART DYNAMIC LATER | |
s3etm.configure({ | |
Bucket: 'zhillb-mail', | |
}); | |
module.exports = async (req, res, next) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bcrypt = require('bcrypt'); | |
// const jwt = require('jsonwebtoken'); | |
const User = require('../models/user'); | |
async function authenticateUser(username, password) { | |
const users = await User.find({ username }); | |
if (users.length) { | |
const user = users[0]; | |
const samePassword = await checkPassword(password, user.password); | |
return samePassword; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bucket = require('./bucket'); | |
const configure = require('./config'); | |
const db = require('./db'); | |
const parse = require('./parseMail'); | |
let config; | |
const processNewMail = function(optionalCallback) { | |
if (config.Bucket === '') { | |
throw new Error('Bucket name must be set!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
module.exports.getFiles = function() { | |
return new Promise((resolve, reject) => { | |
fs.readFile('/home/usr', (err, data) => { | |
if (err) { | |
reject(err); | |
} | |
else { | |
resolve(data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const defaults = { | |
Bucket: '', | |
DB: 'Mail', | |
Save: { | |
headers: false, | |
subject: true, | |
from: true, | |
to: true, | |
cc: true, | |
bcc: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const s3 = new AWS.S3(); | |
var Bucket; | |
function bucketNameIsUndefined() { | |
if (!Bucket) { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function every(array, callbackFunction) { | |
var doesEveryElementMatch = true; | |
array.forEach(function(element) { | |
doesEveryElementMatch = callbackFunction(element); | |
}); | |
return doesEveryElementMatch; | |
} |
NewerOlder