2014-12-23 16:48:28 +00:00
|
|
|
var User = require('../models/User'),
|
|
|
|
resources = require('./resources.json'),
|
|
|
|
questions = resources.questions,
|
2014-12-26 08:05:00 +00:00
|
|
|
steps = resources.steps,
|
2014-12-26 20:15:24 +00:00
|
|
|
secrets = require('./../config/secrets'),
|
|
|
|
Challenge = require('./../models/Challenge'),
|
|
|
|
Client = require('node-rest-client').Client,
|
|
|
|
client = new Client();
|
2014-12-11 04:44:33 +00:00
|
|
|
|
2014-11-10 18:29:16 +00:00
|
|
|
/**
|
|
|
|
* GET /
|
|
|
|
* Resources.
|
|
|
|
*/
|
2014-12-26 08:05:00 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
module.exports = {
|
|
|
|
learnToCode: function(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/learn-to-code', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'Learn to Code'
|
2014-11-23 21:08:46 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-11-29 23:16:47 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
privacy: function privacy(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/privacy', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'Privacy'
|
2014-11-30 07:01:49 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-11-30 07:01:49 +00:00
|
|
|
|
2014-12-26 08:05:00 +00:00
|
|
|
stats: function stats(req, res) {
|
|
|
|
var date1 = new Date("10/15/2014");
|
|
|
|
var date2 = new Date();
|
|
|
|
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
|
|
|
|
var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
|
|
|
var nonprofitProjects = client.get('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(data, response){return data.length;});
|
|
|
|
User.count({}, function(err, users) { if (err) { debug('User err: ', err); next(err); }
|
|
|
|
User.count({'points': {'$gt': 2}}, function(err, c2) { if (err) { debug('User err: ', err); next(err); }
|
|
|
|
User.count({'points': {'$gt': 4}}, function(err, c4) { if (err) { debug('User err: ', err); next(err); }
|
|
|
|
User.count({'points': {'$gt': 9}}, function(err, c9) { if (err) { debug('User err: ', err); next(err); }
|
|
|
|
User.count({'points': {'$gt': 19}}, function(err, c19) { if (err) { debug('User err: ', err); next(err); }
|
|
|
|
User.count({'points': {'$gt': 29}}, function(err, c29) { if (err) { debug('User err: ', err); next(err); }
|
|
|
|
User.count({'points': {'$gt': 39}}, function(err, c39) { if (err) { debug('User err: ', err); next(err); }
|
2014-12-31 06:02:19 +00:00
|
|
|
User.count({'points': {'$gt': 53}}, function(err, all) { if (err) { debug('User err: ', err); next(err); }
|
|
|
|
res.render('resources/stats', {
|
|
|
|
title: 'Free Code Camp Stats:',
|
|
|
|
daysRunning: daysRunning,
|
|
|
|
users: users,
|
|
|
|
nonprofitProjects: nonprofitProjects, /* can't yet get this to work. Async issue?
|
|
|
|
Hardcoded value for now and created a Trello card */
|
|
|
|
c2: c2,
|
|
|
|
c4: c4,
|
|
|
|
c9: c9,
|
|
|
|
c19: c19,
|
|
|
|
c29: c29,
|
|
|
|
c39: c39,
|
|
|
|
all: all
|
2014-12-26 08:05:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
deployAWebsite: function deployAWebsite(req, res) {
|
|
|
|
res.render('resources/deploy-a-website', {
|
|
|
|
title: 'Deploy a Dynamic Website in 7 Minutes'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
gmailShortcuts: function gmailShortcuts(req, res) {
|
|
|
|
res.render('resources/gmail-shortcuts', {
|
|
|
|
title: 'These Gmail Shortcuts will save you Hours'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
controlShortcuts: function controlShortcuts(req, res) {
|
|
|
|
res.render('resources/control-shortcuts', {
|
|
|
|
title: 'These Control Shortcuts will save you Hours'
|
2014-12-11 04:44:33 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-12-11 04:44:33 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
chromebook: function chromebook(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/chromebook', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'Win a Chromebook'
|
2014-12-12 05:24:44 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-12-12 05:24:44 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
jqueryExercises: function jqueryExercises(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/jquery-exercises', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'jQuery Exercises'
|
2014-11-29 23:16:47 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-12-10 06:30:18 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
livePairProgramming: function(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/live-pair-programming', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'Live Pair Programming'
|
2014-12-15 06:24:54 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-12-15 06:24:54 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
javaScriptInYourInbox: function(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/javascript-in-your-inbox', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'JavaScript in your Inbox'
|
2014-12-15 06:24:54 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-12-15 06:24:54 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
programmerInterviewQuestionsApp: function(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/programmer-interview-questions-app', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'Programmer Interview Questions App'
|
2014-12-10 06:30:18 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-12-10 06:30:18 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
pairProgramWithTeamViewer: function(req, res) {
|
2014-12-26 20:15:24 +00:00
|
|
|
Challenge.find({}, null, { sort: { challengeNumber: 1 } }, function(err, c) {
|
|
|
|
if (err) {
|
|
|
|
debug('Challenge err: ', err);
|
|
|
|
next(err);
|
|
|
|
}
|
|
|
|
res.render('resources/pair-program-with-team-viewer', {
|
|
|
|
title: 'Challenge: Pair Program with Team Viewer',
|
|
|
|
name: 'Pair Program with Team Viewer',
|
|
|
|
video: '',
|
|
|
|
time: 30,
|
|
|
|
steps: steps,
|
|
|
|
cc: req.user ? req.user.challengesHash : undefined,
|
|
|
|
points: req.user ? req.user.points : undefined,
|
|
|
|
challenges: c
|
|
|
|
});
|
2014-12-10 06:30:18 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
about: function(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/about', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title: 'About Free Code Camp and Our Team of Volunteers'
|
2014-12-16 18:31:19 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
2014-12-16 18:31:19 +00:00
|
|
|
|
2014-12-23 16:48:28 +00:00
|
|
|
doneWithFirst100Hours: function(req, res) {
|
2014-12-26 08:05:00 +00:00
|
|
|
res.render('resources/done-with-first-100-hours', {
|
2014-12-23 16:48:28 +00:00
|
|
|
title:
|
|
|
|
'Congratulations on finishing the first 100 hours of Free Code Camp!'
|
2014-11-23 21:08:46 +00:00
|
|
|
});
|
2014-12-23 16:48:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
interviewQuestions: function(req, res) {
|
|
|
|
res.json(questions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-11-12 01:52:03 +00:00
|
|
|
|