From 06fe5390baf037fb7f08ae540ff483d25db9d04c Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 24 Nov 2014 18:07:03 -0800 Subject: [PATCH 1/9] seems to attempt to write timestamp --- app.js | 3 +- controllers/challenges.js | 2 +- models/User.js | 1 + views/account/profile.jade | 4 + views/partials/challenges.jade | 248 ++++++++++++++++----------------- views/partials/navbar.jade | 2 +- 6 files changed, 133 insertions(+), 127 deletions(-) diff --git a/app.js b/app.js index 02bbb774fb2..2f027fb5258 100644 --- a/app.js +++ b/app.js @@ -163,8 +163,9 @@ app.get('/account/unlink/:provider', userController.getOauthUnlink); * API examples routes. */ app.post('/completed_challenge', function(req, res) { - req.user.challengesCompleted.push(parseInt(req.body.cn)); + req.user.challengesHash[req.body.cn] = Math.round(+new Date()/1000); req.user.save(); + console.log(req.user.challengesHash); }); /** diff --git a/controllers/challenges.js b/controllers/challenges.js index 71b86c1bd14..e7f951f0cc7 100644 --- a/controllers/challenges.js +++ b/controllers/challenges.js @@ -19,7 +19,7 @@ exports.returnChallenge = function(req, res, next) { video: c.video, time: c.time, steps: c.steps, - cc: req.user.challengesCompleted + cc: req.user.challengesHash }); }); }; \ No newline at end of file diff --git a/models/User.js b/models/User.js index d4a265ccc77..5bc9f8553e8 100644 --- a/models/User.js +++ b/models/User.js @@ -14,6 +14,7 @@ var userSchema = new mongoose.Schema({ instagram: String, tokens: Array, challengesCompleted: { type: Array, default: [] }, + challengesHash: { type: Object, default: {} }, profile: { name: { type: String, default: '' }, diff --git a/views/account/profile.jade b/views/account/profile.jade index a7b443c7a0c..69ef916bce6 100644 --- a/views/account/profile.jade +++ b/views/account/profile.jade @@ -29,6 +29,10 @@ block content span.ion-edit | Update my profile + h1 Completed Challenges + ul + //each val, index in user.challengesHash + //li= index + ': ' + val h3 Danger Zone button.btn.btn-danger.confirm-deletion span.ion-trash-b diff --git a/views/partials/challenges.jade b/views/partials/challenges.jade index 7f3cd3d740a..78ff771a06a 100644 --- a/views/partials/challenges.jade +++ b/views/partials/challenges.jade @@ -3,128 +3,128 @@ .panel-body ol(start='0') li - a(href="/challenges/0", class="#{ cc.indexOf(0) > -1 ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp + a(href="/challenges/0", class="#{ cc.hasOwnProperty('0') ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp |   (1 min) - li - a(href="/challenges/1", class="#{ cc.indexOf(1) > -1 ? 'strikethrough' : '' }") Enter the Free Code Camp Chat Room - |   (5 mins) - li - a(href="/challenges/2", class="#{ cc.indexOf(2) > -1 ? 'strikethrough' : '' }") Create a Website and Deploy it to the Internet - |   (5 mins) - li - a(href="/challenges/3", class="#{ cc.indexOf(3) > -1 ? 'strikethrough' : '' }") Install Github's Atom Text Editor - |   (5 mins) - li - a(href="/challenges/4", class="#{ cc.indexOf(4) > -1 ? 'strikethrough' : '' }") Modify and Redeploy Your Website - |   (5 mins) - li - a(href="/challenges/5", class="#{ cc.indexOf(6) > -1 ? 'strikethrough' : '' }") Add Dynamic Content to your Website - |   (10 mins) - li - a(href="/challenges/6", class="#{ cc.indexOf(7) > -1 ? 'strikethrough' : '' }") Codecademy's HTML & CSS track - |   (7 hrs) - li - a(href="/challenges/7", class="#{ cc.indexOf(8) > -1 ? 'strikethrough' : '' }") Experiment with HTML and CSS in CodePen - |   (10 mins) - li - a(href="/challenges/8", class="#{ cc.indexOf(9) > -1 ? 'strikethrough' : '' }") Code School's Try jQuery - |   (4 hrs) - li - a(href="/challenges/9", class="#{ cc.indexOf(10) > -1 ? 'strikethrough' : '' }") jQuery Exercises - |   (3 hrs) - li - a(href="/challenges/10", class="#{ cc.indexOf(11) > -1 ? 'strikethrough' : '' }") Code School's Discover DevTools - |   (2 hrs) - li - a(href="/challenges/11", class="#{ cc.indexOf(12) > -1 ? 'strikethrough' : '' }") Customize Bootstrap with Bootswatch - |   (10 mins) - li - a(href="/challenges/12", class="#{ cc.indexOf(13) > -1 ? 'strikethrough' : '' }") Inject Life with CSS Transformations - |   (15 mins) - li - a(href="/challenges/13", class="#{ cc.indexOf(14) > -1 ? 'strikethrough' : '' }") Codecademy's JavaScript track - |   (10 hrs) - li - a(href="/challenges/14", class="#{ cc.indexOf(16) > -1 ? 'strikethrough' : '' }") Stanford's Introduction to Computer Science - |   (24 hrs) - li - a(href="/challenges/15", class="#{ cc.indexOf(15) > -1 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP - |   (30 mins) - li - a(href="/challenges/16", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Learn Regular Expressions - |   (1 hr) - li - a(href="/challenges/17", class="#{ cc.indexOf(5) > -1 ? 'strikethrough' : '' }") Start Your First Pair Programming Session - |   (30 mins | Pair) - li - a(href="/challenges/18", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte - |   (15 hrs | Pair) - li - a(href="/challenges/19", class="#{ cc.indexOf(18) > -1 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course - |   (1 hr) - li - a(href="/challenges/20", class="#{ cc.indexOf(19) > -1 ? 'strikethrough' : '' }") Stanford's SQL Mini-course - |   (4 hrs | Pair) - li - a(href="/challenges/21", class="#{ cc.indexOf(20) > -1 ? 'strikethrough' : '' }") Stanford's JSON Mini-course - |   (1 hrs | Pair) - li - a(href="/challenges/22", class="#{ cc.indexOf(21) > -1 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte - |   (15 hrs | Pair) - li - a.disabled(href="/challenges/23", class="#{ cc.indexOf(22) > -1 ? 'strikethrough' : '' }") Build an Interview Question Machine - |   (5 hrs | Pair) - li - a.disabled(href="/challenges/24", class="#{ cc.indexOf(23) > -1 ? 'strikethrough' : '' }") Build a Text-based Adventure - |   (5 hrs | Pair) - li - a.disabled(href="/challenges/25", class="#{ cc.indexOf(24) > -1 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte - |   (15 hrs | Pair) - li - a.disabled(href="/challenges/26", class="#{ cc.indexOf(25) > -1 ? 'strikethrough' : '' }") Code School's Try Git - |   (30 mins) - li - a.disabled(href="/challenges/27", class="#{ cc.indexOf(26) > -1 ? 'strikethrough' : '' }") Install Node.js - |   (1 hr) - li - a.disabled(href="/challenges/28", class="#{ cc.indexOf(27) > -1 ? 'strikethrough' : '' }") Clone a Github Repo - |   (15 mins) - li - a.disabled(href="/challenges/29", class="#{ cc.indexOf(28) > -1 ? 'strikethrough' : '' }") Deploy an app to Heroku - |   (15 mins) - li - a.disabled(href="/challenges/30", class="#{ cc.indexOf(29) > -1 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS - |   (5 hrs) - li - a.disabled(href="/challenges/31", class="#{ cc.indexOf(30) > -1 ? 'strikethrough' : '' }") Try MongoDB - |   (30 mins) - li - a.disabled(href="/challenges/32", class="#{ cc.indexOf(31) > -1 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API - |   (1 hr) - li - a.disabled(href="/challenges/33", class="#{ cc.indexOf(32) > -1 ? 'strikethrough' : '' }") Build your first API - |   (10 hrs | Pair) - li - a.disabled(href="/challenges/34", class="#{ cc.indexOf(33) > -1 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping - |   (10 hrs | Pair) - li - a.disabled(href="/challenges/35", class="#{ cc.indexOf(34) > -1 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS - |   (5 hrs) - li - a.disabled(href="/challenges/36", class="#{ cc.indexOf(35) > -1 ? 'strikethrough' : '' }") Reverse Engineer SnapChat - |   (50 hrs | Pair) - li - a.disabled(href="/challenges/37", class="#{ cc.indexOf(36) > -1 ? 'strikethrough' : '' }") Reverse Engineer Reddit - |   (50 hrs | Pair) - li - a.disabled(href="/challenges/38", class="#{ cc.indexOf(37) > -1 ? 'strikethrough' : '' }") Reverse Engineer Pintrest - |   (50 hrs | Pair) - li - a.disabled(href="/challenges/39", class="#{ cc.indexOf(38) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project - |   (150 hrs | Pair) - li - a.disabled(href="/challenges/40", class="#{ cc.indexOf(39) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project - |   (150 hrs | Pair) - li - a.disabled(href="/challenges/41", class="#{ cc.indexOf(40) > -1 ? 'strikethrough' : '' }") Crack the Coding Interview - |   (5 hrs) \ No newline at end of file + //li + // a(href="/challenges/1", class="#{ cc.indexOf(1) > -1 ? 'strikethrough' : '' }") Enter the Free Code Camp Chat Room + // |   (5 mins) + //li + // a(href="/challenges/2", class="#{ cc.indexOf(2) > -1 ? 'strikethrough' : '' }") Create a Website and Deploy it to the Internet + // |   (5 mins) + //li + // a(href="/challenges/3", class="#{ cc.indexOf(3) > -1 ? 'strikethrough' : '' }") Install Github's Atom Text Editor + // |   (5 mins) + //li + // a(href="/challenges/4", class="#{ cc.indexOf(4) > -1 ? 'strikethrough' : '' }") Modify and Redeploy Your Website + // |   (5 mins) + //li + // a(href="/challenges/5", class="#{ cc.indexOf(6) > -1 ? 'strikethrough' : '' }") Add Dynamic Content to your Website + // |   (10 mins) + //li + // a(href="/challenges/6", class="#{ cc.indexOf(7) > -1 ? 'strikethrough' : '' }") Codecademy's HTML & CSS track + // |   (7 hrs) + //li + // a(href="/challenges/7", class="#{ cc.indexOf(8) > -1 ? 'strikethrough' : '' }") Experiment with HTML and CSS in CodePen + // |   (10 mins) + //li + // a(href="/challenges/8", class="#{ cc.indexOf(9) > -1 ? 'strikethrough' : '' }") Code School's Try jQuery + // |   (4 hrs) + //li + // a(href="/challenges/9", class="#{ cc.indexOf(10) > -1 ? 'strikethrough' : '' }") jQuery Exercises + // |   (3 hrs) + //li + // a(href="/challenges/10", class="#{ cc.indexOf(11) > -1 ? 'strikethrough' : '' }") Code School's Discover DevTools + // |   (2 hrs) + //li + // a(href="/challenges/11", class="#{ cc.indexOf(12) > -1 ? 'strikethrough' : '' }") Customize Bootstrap with Bootswatch + // |   (10 mins) + //li + // a(href="/challenges/12", class="#{ cc.indexOf(13) > -1 ? 'strikethrough' : '' }") Inject Life with CSS Transformations + // |   (15 mins) + //li + // a(href="/challenges/13", class="#{ cc.indexOf(14) > -1 ? 'strikethrough' : '' }") Codecademy's JavaScript track + // |   (10 hrs) + //li + // a(href="/challenges/14", class="#{ cc.indexOf(16) > -1 ? 'strikethrough' : '' }") Stanford's Introduction to Computer Science + // |   (24 hrs) + //li + // a(href="/challenges/15", class="#{ cc.indexOf(15) > -1 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP + // |   (30 mins) + //li + // a(href="/challenges/16", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Learn Regular Expressions + // |   (1 hr) + //li + // a(href="/challenges/17", class="#{ cc.indexOf(5) > -1 ? 'strikethrough' : '' }") Start Your First Pair Programming Session + // |   (30 mins | Pair) + //li + // a(href="/challenges/18", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte + // |   (15 hrs | Pair) + //li + // a(href="/challenges/19", class="#{ cc.indexOf(18) > -1 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course + // |   (1 hr) + //li + // a(href="/challenges/20", class="#{ cc.indexOf(19) > -1 ? 'strikethrough' : '' }") Stanford's SQL Mini-course + // |   (4 hrs | Pair) + //li + // a(href="/challenges/21", class="#{ cc.indexOf(20) > -1 ? 'strikethrough' : '' }") Stanford's JSON Mini-course + // |   (1 hrs | Pair) + //li + // a(href="/challenges/22", class="#{ cc.indexOf(21) > -1 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte + // |   (15 hrs | Pair) + //li + // a.disabled(href="/challenges/23", class="#{ cc.indexOf(22) > -1 ? 'strikethrough' : '' }") Build an Interview Question Machine + // |   (5 hrs | Pair) + //li + // a.disabled(href="/challenges/24", class="#{ cc.indexOf(23) > -1 ? 'strikethrough' : '' }") Build a Text-based Adventure + // |   (5 hrs | Pair) + //li + // a.disabled(href="/challenges/25", class="#{ cc.indexOf(24) > -1 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte + // |   (15 hrs | Pair) + //li + // a.disabled(href="/challenges/26", class="#{ cc.indexOf(25) > -1 ? 'strikethrough' : '' }") Code School's Try Git + // |   (30 mins) + //li + // a.disabled(href="/challenges/27", class="#{ cc.indexOf(26) > -1 ? 'strikethrough' : '' }") Install Node.js + // |   (1 hr) + //li + // a.disabled(href="/challenges/28", class="#{ cc.indexOf(27) > -1 ? 'strikethrough' : '' }") Clone a Github Repo + // |   (15 mins) + //li + // a.disabled(href="/challenges/29", class="#{ cc.indexOf(28) > -1 ? 'strikethrough' : '' }") Deploy an app to Heroku + // |   (15 mins) + //li + // a.disabled(href="/challenges/30", class="#{ cc.indexOf(29) > -1 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS + // |   (5 hrs) + //li + // a.disabled(href="/challenges/31", class="#{ cc.indexOf(30) > -1 ? 'strikethrough' : '' }") Try MongoDB + // |   (30 mins) + //li + // a.disabled(href="/challenges/32", class="#{ cc.indexOf(31) > -1 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API + // |   (1 hr) + //li + // a.disabled(href="/challenges/33", class="#{ cc.indexOf(32) > -1 ? 'strikethrough' : '' }") Build your first API + // |   (10 hrs | Pair) + //li + // a.disabled(href="/challenges/34", class="#{ cc.indexOf(33) > -1 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping + // |   (10 hrs | Pair) + //li + // a.disabled(href="/challenges/35", class="#{ cc.indexOf(34) > -1 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS + // |   (5 hrs) + //li + // a.disabled(href="/challenges/36", class="#{ cc.indexOf(35) > -1 ? 'strikethrough' : '' }") Reverse Engineer SnapChat + // |   (50 hrs | Pair) + //li + // a.disabled(href="/challenges/37", class="#{ cc.indexOf(36) > -1 ? 'strikethrough' : '' }") Reverse Engineer Reddit + // |   (50 hrs | Pair) + //li + // a.disabled(href="/challenges/38", class="#{ cc.indexOf(37) > -1 ? 'strikethrough' : '' }") Reverse Engineer Pintrest + // |   (50 hrs | Pair) + //li + // a.disabled(href="/challenges/39", class="#{ cc.indexOf(38) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project + // |   (150 hrs | Pair) + //li + // a.disabled(href="/challenges/40", class="#{ cc.indexOf(39) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project + // |   (150 hrs | Pair) + //li + // a.disabled(href="/challenges/41", class="#{ cc.indexOf(40) > -1 ? 'strikethrough' : '' }") Crack the Coding Interview + // |   (5 hrs) \ No newline at end of file diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index bfce8b0d1bc..9fa4f46a358 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -20,7 +20,7 @@ img(src='#{user.profile.picture}') else img(src='#{user.gravatar(60)}') - | #{user.profile.name || user.email || user.id} [ #{user.challengesCompleted.length} ]  + | #{user.profile.name || user.email || user.id} [ #{Object.keys(user.challengesHash).length} ]  i.caret ul.dropdown-menu li From 1a0acdea82653adf0c6ab55d0174447834e7c850 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 24 Nov 2014 18:48:07 -0800 Subject: [PATCH 2/9] attempt to modify User.js --- models/User.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/User.js b/models/User.js index 5bc9f8553e8..8add8e69e37 100644 --- a/models/User.js +++ b/models/User.js @@ -14,7 +14,7 @@ var userSchema = new mongoose.Schema({ instagram: String, tokens: Array, challengesCompleted: { type: Array, default: [] }, - challengesHash: { type: Object, default: {} }, + challengesHash: { type: {}, default: { '-1': 'void'} }, profile: { name: { type: String, default: '' }, From d973619f4a8474e28c3de6a4b93b6b08d4c11c95 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Tue, 25 Nov 2014 11:17:07 -0800 Subject: [PATCH 3/9] writes completed challenges to database --- app.js | 26 +++++++++++++++++++++++--- models/User.js | 2 +- views/partials/challenges.jade | 4 ++-- views/partials/navbar.jade | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 2f027fb5258..5f57bf1a4e3 100644 --- a/app.js +++ b/app.js @@ -33,6 +33,10 @@ var userController = require('./controllers/user'); var apiController = require('./controllers/api'); var contactController = require('./controllers/contact'); +/** + * User model + */ +var User = require('./models/User'); /** * API keys and Passport configuration. */ @@ -163,9 +167,25 @@ app.get('/account/unlink/:provider', userController.getOauthUnlink); * API examples routes. */ app.post('/completed_challenge', function(req, res) { - req.user.challengesHash[req.body.cn] = Math.round(+new Date()/1000); - req.user.save(); - console.log(req.user.challengesHash); + console.log(req.user); + + User.findById(req.user.id, function (err, user) { + if (err) { + console.log(err); + res.status(500); + return res.send('something went wrong'); + } + user.challengesHash[parseInt(req.body.cn)] = Math.round(+new Date()/1000); + user.save(function(err, newDats) { + if (err) { + console.log(err); + res.status(500); + return res.send('something went wrong'); + } + console.log('Suer', user); + res.status(200).send('saved'); + }); + }); }); /** diff --git a/models/User.js b/models/User.js index 8add8e69e37..00d31b33657 100644 --- a/models/User.js +++ b/models/User.js @@ -14,7 +14,7 @@ var userSchema = new mongoose.Schema({ instagram: String, tokens: Array, challengesCompleted: { type: Array, default: [] }, - challengesHash: { type: {}, default: { '-1': 'void'} }, + challengesHash: {}, profile: { name: { type: String, default: '' }, diff --git a/views/partials/challenges.jade b/views/partials/challenges.jade index 78ff771a06a..2d3e9c5b88f 100644 --- a/views/partials/challenges.jade +++ b/views/partials/challenges.jade @@ -3,8 +3,8 @@ .panel-body ol(start='0') li - a(href="/challenges/0", class="#{ cc.hasOwnProperty('0') ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp - |   (1 min) + //a(href="/challenges/0", class="#{ cc.hasOwnProperty('0') ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp + //|   (1 min) //li // a(href="/challenges/1", class="#{ cc.indexOf(1) > -1 ? 'strikethrough' : '' }") Enter the Free Code Camp Chat Room // |   (5 mins) diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index 9fa4f46a358..471aceef084 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -20,7 +20,7 @@ img(src='#{user.profile.picture}') else img(src='#{user.gravatar(60)}') - | #{user.profile.name || user.email || user.id} [ #{Object.keys(user.challengesHash).length} ]  + //| #{user.profile.name || user.email || user.id} [ #{Object.keys(user.challengesHash).length} ]  i.caret ul.dropdown-menu li From 9b9554c47d61228facd3b1f081afd7af307e81f9 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Tue, 25 Nov 2014 11:31:35 -0800 Subject: [PATCH 4/9] update the hash to have default values --- models/User.js | 204 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 2 deletions(-) diff --git a/models/User.js b/models/User.js index 00d31b33657..5d9254a04ed 100644 --- a/models/User.js +++ b/models/User.js @@ -14,8 +14,208 @@ var userSchema = new mongoose.Schema({ instagram: String, tokens: Array, challengesCompleted: { type: Array, default: [] }, - challengesHash: {}, - + challengesHash: { + 0: { + type: Number, + default: 0, + }, + 1: { + type: Number, + default: 0, + }, + 2: { + type: Number, + default: 0, + }, + 3: { + type: Number, + default: 0, + }, + 4: { + type: Number, + default: 0, + }, + 5: { + type: Number, + default: 0, + }, + 6: { + type: Number, + default: 0, + }, + 7: { + type: Number, + default: 0, + }, + 8: { + type: Number, + default: 0, + }, + 9: { + type: Number, + default: 0, + }, + 10: { + type: Number, + default: 0, + }, + 11: { + type: Number, + default: 0, + }, + 12: { + type: Number, + default: 0, + }, + 13: { + type: Number, + default: 0, + }, + 14: { + type: Number, + default: 0, + }, + 15: { + type: Number, + default: 0, + }, + 16: { + type: Number, + default: 0, + }, + 17: { + type: Number, + default: 0, + }, + 18: { + type: Number, + default: 0, + }, + 19: { + type: Number, + default: 0, + }, + 20: { + type: Number, + default: 0, + }, + 21: { + type: Number, + default: 0, + }, + 22: { + type: Number, + default: 0, + }, + 23: { + type: Number, + default: 0, + }, + 24: { + type: Number, + default: 0, + }, + 25: { + type: Number, + default: 0, + }, + 26: { + type: Number, + default: 0, + }, + 27: { + type: Number, + default: 0, + }, + 28: { + type: Number, + default: 0, + }, + 29: { + type: Number, + default: 0, + }, + 30: { + type: Number, + default: 0, + }, + 31: { + type: Number, + default: 0, + }, + 32: { + type: Number, + default: 0, + }, + 33: { + type: Number, + default: 0, + }, + 34: { + type: Number, + default: 0, + }, + 35: { + type: Number, + default: 0, + }, + 36: { + type: Number, + default: 0, + }, + 37: { + type: Number, + default: 0, + }, + 38: { + type: Number, + default: 0, + }, + 39: { + type: Number, + default: 0, + }, + 40: { + type: Number, + default: 0, + }, + 41: { + type: Number, + default: 0, + }, + 42: { + type: Number, + default: 0, + }, + 43: { + type: Number, + default: 0, + }, + 44: { + type: Number, + default: 0, + }, + 45: { + type: Number, + default: 0, + }, + 46: { + type: Number, + default: 0, + }, + 47: { + type: Number, + default: 0, + }, + 48: { + type: Number, + default: 0, + }, + 49: { + type: Number, + default: 0, + } + }, profile: { name: { type: String, default: '' }, gender: { type: String, default: '' }, From 645f363fc3d23fdb704dce38abcc160e64f1535b Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Tue, 25 Nov 2014 12:22:14 -0800 Subject: [PATCH 5/9] got sidenav looking right again --- views/partials/challenges.jade | 250 ++++++++++++++++----------------- views/partials/navbar.jade | 2 +- 2 files changed, 126 insertions(+), 126 deletions(-) diff --git a/views/partials/challenges.jade b/views/partials/challenges.jade index 2d3e9c5b88f..4d8d1c63dbc 100644 --- a/views/partials/challenges.jade +++ b/views/partials/challenges.jade @@ -3,128 +3,128 @@ .panel-body ol(start='0') li - //a(href="/challenges/0", class="#{ cc.hasOwnProperty('0') ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp - //|   (1 min) - //li - // a(href="/challenges/1", class="#{ cc.indexOf(1) > -1 ? 'strikethrough' : '' }") Enter the Free Code Camp Chat Room - // |   (5 mins) - //li - // a(href="/challenges/2", class="#{ cc.indexOf(2) > -1 ? 'strikethrough' : '' }") Create a Website and Deploy it to the Internet - // |   (5 mins) - //li - // a(href="/challenges/3", class="#{ cc.indexOf(3) > -1 ? 'strikethrough' : '' }") Install Github's Atom Text Editor - // |   (5 mins) - //li - // a(href="/challenges/4", class="#{ cc.indexOf(4) > -1 ? 'strikethrough' : '' }") Modify and Redeploy Your Website - // |   (5 mins) - //li - // a(href="/challenges/5", class="#{ cc.indexOf(6) > -1 ? 'strikethrough' : '' }") Add Dynamic Content to your Website - // |   (10 mins) - //li - // a(href="/challenges/6", class="#{ cc.indexOf(7) > -1 ? 'strikethrough' : '' }") Codecademy's HTML & CSS track - // |   (7 hrs) - //li - // a(href="/challenges/7", class="#{ cc.indexOf(8) > -1 ? 'strikethrough' : '' }") Experiment with HTML and CSS in CodePen - // |   (10 mins) - //li - // a(href="/challenges/8", class="#{ cc.indexOf(9) > -1 ? 'strikethrough' : '' }") Code School's Try jQuery - // |   (4 hrs) - //li - // a(href="/challenges/9", class="#{ cc.indexOf(10) > -1 ? 'strikethrough' : '' }") jQuery Exercises - // |   (3 hrs) - //li - // a(href="/challenges/10", class="#{ cc.indexOf(11) > -1 ? 'strikethrough' : '' }") Code School's Discover DevTools - // |   (2 hrs) - //li - // a(href="/challenges/11", class="#{ cc.indexOf(12) > -1 ? 'strikethrough' : '' }") Customize Bootstrap with Bootswatch - // |   (10 mins) - //li - // a(href="/challenges/12", class="#{ cc.indexOf(13) > -1 ? 'strikethrough' : '' }") Inject Life with CSS Transformations - // |   (15 mins) - //li - // a(href="/challenges/13", class="#{ cc.indexOf(14) > -1 ? 'strikethrough' : '' }") Codecademy's JavaScript track - // |   (10 hrs) - //li - // a(href="/challenges/14", class="#{ cc.indexOf(16) > -1 ? 'strikethrough' : '' }") Stanford's Introduction to Computer Science - // |   (24 hrs) - //li - // a(href="/challenges/15", class="#{ cc.indexOf(15) > -1 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP - // |   (30 mins) - //li - // a(href="/challenges/16", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Learn Regular Expressions - // |   (1 hr) - //li - // a(href="/challenges/17", class="#{ cc.indexOf(5) > -1 ? 'strikethrough' : '' }") Start Your First Pair Programming Session - // |   (30 mins | Pair) - //li - // a(href="/challenges/18", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte - // |   (15 hrs | Pair) - //li - // a(href="/challenges/19", class="#{ cc.indexOf(18) > -1 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course - // |   (1 hr) - //li - // a(href="/challenges/20", class="#{ cc.indexOf(19) > -1 ? 'strikethrough' : '' }") Stanford's SQL Mini-course - // |   (4 hrs | Pair) - //li - // a(href="/challenges/21", class="#{ cc.indexOf(20) > -1 ? 'strikethrough' : '' }") Stanford's JSON Mini-course - // |   (1 hrs | Pair) - //li - // a(href="/challenges/22", class="#{ cc.indexOf(21) > -1 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte - // |   (15 hrs | Pair) - //li - // a.disabled(href="/challenges/23", class="#{ cc.indexOf(22) > -1 ? 'strikethrough' : '' }") Build an Interview Question Machine - // |   (5 hrs | Pair) - //li - // a.disabled(href="/challenges/24", class="#{ cc.indexOf(23) > -1 ? 'strikethrough' : '' }") Build a Text-based Adventure - // |   (5 hrs | Pair) - //li - // a.disabled(href="/challenges/25", class="#{ cc.indexOf(24) > -1 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte - // |   (15 hrs | Pair) - //li - // a.disabled(href="/challenges/26", class="#{ cc.indexOf(25) > -1 ? 'strikethrough' : '' }") Code School's Try Git - // |   (30 mins) - //li - // a.disabled(href="/challenges/27", class="#{ cc.indexOf(26) > -1 ? 'strikethrough' : '' }") Install Node.js - // |   (1 hr) - //li - // a.disabled(href="/challenges/28", class="#{ cc.indexOf(27) > -1 ? 'strikethrough' : '' }") Clone a Github Repo - // |   (15 mins) - //li - // a.disabled(href="/challenges/29", class="#{ cc.indexOf(28) > -1 ? 'strikethrough' : '' }") Deploy an app to Heroku - // |   (15 mins) - //li - // a.disabled(href="/challenges/30", class="#{ cc.indexOf(29) > -1 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS - // |   (5 hrs) - //li - // a.disabled(href="/challenges/31", class="#{ cc.indexOf(30) > -1 ? 'strikethrough' : '' }") Try MongoDB - // |   (30 mins) - //li - // a.disabled(href="/challenges/32", class="#{ cc.indexOf(31) > -1 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API - // |   (1 hr) - //li - // a.disabled(href="/challenges/33", class="#{ cc.indexOf(32) > -1 ? 'strikethrough' : '' }") Build your first API - // |   (10 hrs | Pair) - //li - // a.disabled(href="/challenges/34", class="#{ cc.indexOf(33) > -1 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping - // |   (10 hrs | Pair) - //li - // a.disabled(href="/challenges/35", class="#{ cc.indexOf(34) > -1 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS - // |   (5 hrs) - //li - // a.disabled(href="/challenges/36", class="#{ cc.indexOf(35) > -1 ? 'strikethrough' : '' }") Reverse Engineer SnapChat - // |   (50 hrs | Pair) - //li - // a.disabled(href="/challenges/37", class="#{ cc.indexOf(36) > -1 ? 'strikethrough' : '' }") Reverse Engineer Reddit - // |   (50 hrs | Pair) - //li - // a.disabled(href="/challenges/38", class="#{ cc.indexOf(37) > -1 ? 'strikethrough' : '' }") Reverse Engineer Pintrest - // |   (50 hrs | Pair) - //li - // a.disabled(href="/challenges/39", class="#{ cc.indexOf(38) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project - // |   (150 hrs | Pair) - //li - // a.disabled(href="/challenges/40", class="#{ cc.indexOf(39) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project - // |   (150 hrs | Pair) - //li - // a.disabled(href="/challenges/41", class="#{ cc.indexOf(40) > -1 ? 'strikethrough' : '' }") Crack the Coding Interview - // |   (5 hrs) \ No newline at end of file + a(href="/challenges/0", class="#{ cc[0] > 0 ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp + |   (1 min) + li + a(href="/challenges/1", class="#{ cc[1] > 0 ? 'strikethrough' : '' }") Enter the Free Code Camp Chat Room + |   (5 mins) + li + a(href="/challenges/2", class="#{ cc[2] > 0 ? 'strikethrough' : '' }") Create a Website and Deploy it to the Internet + |   (5 mins) + li + a(href="/challenges/3", class="#{ cc[3] > 0 ? 'strikethrough' : '' }") Install Github's Atom Text Editor + |   (5 mins) + li + a(href="/challenges/4", class="#{ cc[4] > 0 ? 'strikethrough' : '' }") Modify and Redeploy Your Website + |   (5 mins) + li + a(href="/challenges/5", class="#{ cc[6] > 0 ? 'strikethrough' : '' }") Add Dynamic Content to your Website + |   (10 mins) + li + a(href="/challenges/6", class="#{ cc[7] > 0 ? 'strikethrough' : '' }") Codecademy's HTML & CSS track + |   (7 hrs) + li + a(href="/challenges/7", class="#{ cc[8] > 0 ? 'strikethrough' : '' }") Experiment with HTML and CSS in CodePen + |   (10 mins) + li + a(href="/challenges/8", class="#{ cc[9] > 0 ? 'strikethrough' : '' }") Code School's Try jQuery + |   (4 hrs) + li + a(href="/challenges/9", class="#{ cc[10] > 0 ? 'strikethrough' : '' }") jQuery Exercises + |   (3 hrs) + li + a(href="/challenges/10", class="#{ cc[11] > 0 ? 'strikethrough' : '' }") Code School's Discover DevTools + |   (2 hrs) + li + a(href="/challenges/11", class="#{ cc[12] > 0 ? 'strikethrough' : '' }") Customize Bootstrap with Bootswatch + |   (10 mins) + li + a(href="/challenges/12", class="#{ cc[13] > 0 ? 'strikethrough' : '' }") Inject Life with CSS Transformations + |   (15 mins) + li + a(href="/challenges/13", class="#{ cc[14] > 0 ? 'strikethrough' : '' }") Codecademy's JavaScript track + |   (10 hrs) + li + a(href="/challenges/14", class="#{ cc[16] > 0 ? 'strikethrough' : '' }") Stanford's Introduction to Computer Science + |   (24 hrs) + li + a(href="/challenges/15", class="#{ cc[15] > 0 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP + |   (30 mins) + li + a(href="/challenges/16", class="#{ cc[17] > 0 ? 'strikethrough' : '' }") Learn Regular Expressions + |   (1 hr) + li + a(href="/challenges/17", class="#{ cc[5] > 0 ? 'strikethrough' : '' }") Start Your First Pair Programming Session + |   (30 mins | Pair) + li + a(href="/challenges/18", class="#{ cc[17] > 0 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte + |   (15 hrs | Pair) + li + a(href="/challenges/19", class="#{ cc[18] > 0 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course + |   (1 hr) + li + a(href="/challenges/20", class="#{ cc[19] > 0 ? 'strikethrough' : '' }") Stanford's SQL Mini-course + |   (4 hrs | Pair) + li + a(href="/challenges/21", class="#{ cc[20] > 0 ? 'strikethrough' : '' }") Stanford's JSON Mini-course + |   (1 hrs | Pair) + li + a(href="/challenges/22", class="#{ cc[21] > 0 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte + |   (15 hrs | Pair) + li + a.disabled(href="/challenges/23", class="#{ cc[22] > 0 ? 'strikethrough' : '' }") Build an Interview Question Machine + |   (5 hrs | Pair) + li + a.disabled(href="/challenges/24", class="#{ cc[23] > 0 ? 'strikethrough' : '' }") Build a Text-based Adventure + |   (5 hrs | Pair) + li + a.disabled(href="/challenges/25", class="#{ cc[24] > 0 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte + |   (15 hrs | Pair) + li + a.disabled(href="/challenges/26", class="#{ cc[25] > 0 ? 'strikethrough' : '' }") Code School's Try Git + |   (30 mins) + li + a.disabled(href="/challenges/27", class="#{ cc[26] > 0 ? 'strikethrough' : '' }") Install Node.js + |   (1 hr) + li + a.disabled(href="/challenges/28", class="#{ cc[27] > 0 ? 'strikethrough' : '' }") Clone a Github Repo + |   (15 mins) + li + a.disabled(href="/challenges/29", class="#{ cc[28] > 0 ? 'strikethrough' : '' }") Deploy an app to Heroku + |   (15 mins) + li + a.disabled(href="/challenges/30", class="#{ cc[29] > 0 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS + |   (5 hrs) + li + a.disabled(href="/challenges/31", class="#{ cc[30] > 0 ? 'strikethrough' : '' }") Try MongoDB + |   (30 mins) + li + a.disabled(href="/challenges/32", class="#{ cc[31] > 0 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API + |   (1 hr) + li + a.disabled(href="/challenges/33", class="#{ cc[32] > 0 ? 'strikethrough' : '' }") Build your first API + |   (10 hrs | Pair) + li + a.disabled(href="/challenges/34", class="#{ cc[33] > 0 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping + |   (10 hrs | Pair) + li + a.disabled(href="/challenges/35", class="#{ cc[34] > 0 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS + |   (5 hrs) + li + a.disabled(href="/challenges/36", class="#{ cc[35] > 0 ? 'strikethrough' : '' }") Reverse Engineer SnapChat + |   (50 hrs | Pair) + li + a.disabled(href="/challenges/37", class="#{ cc[36] > 0 ? 'strikethrough' : '' }") Reverse Engineer Reddit + |   (50 hrs | Pair) + li + a.disabled(href="/challenges/38", class="#{ cc[37] > 0 ? 'strikethrough' : '' }") Reverse Engineer Pintrest + |   (50 hrs | Pair) + li + a.disabled(href="/challenges/39", class="#{ cc[38] > 0 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project + |   (150 hrs | Pair) + li + a.disabled(href="/challenges/40", class="#{ cc[39] > 0 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project + |   (150 hrs | Pair) + li + a.disabled(href="/challenges/41", class="#{ cc[40] > 0 ? 'strikethrough' : '' }") Crack the Coding Interview + |   (5 hrs) \ No newline at end of file diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index 471aceef084..4170e392c60 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -20,7 +20,7 @@ img(src='#{user.profile.picture}') else img(src='#{user.gravatar(60)}') - //| #{user.profile.name || user.email || user.id} [ #{Object.keys(user.challengesHash).length} ]  + | #{user.profile.name || user.email || user.id} [ #{Object.keys(user.challengesHash).length} ]  i.caret ul.dropdown-menu li From 456c8459671a2e7a528e0eb82bf62fd1c49b5d1e Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 26 Nov 2014 22:00:28 -0800 Subject: [PATCH 6/9] reached a stopping point, trying to fix a production bug --- app.js | 31 +++++++++++++------------------ controllers/home.js | 3 ++- views/partials/navbar.jade | 4 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/app.js b/app.js index 5f57bf1a4e3..947edb57cf9 100644 --- a/app.js +++ b/app.js @@ -168,24 +168,19 @@ app.get('/account/unlink/:provider', userController.getOauthUnlink); */ app.post('/completed_challenge', function(req, res) { console.log(req.user); - - User.findById(req.user.id, function (err, user) { - if (err) { - console.log(err); - res.status(500); - return res.send('something went wrong'); - } - user.challengesHash[parseInt(req.body.cn)] = Math.round(+new Date()/1000); - user.save(function(err, newDats) { - if (err) { - console.log(err); - res.status(500); - return res.send('something went wrong'); - } - console.log('Suer', user); - res.status(200).send('saved'); - }); - }); + req.user.challengesHash[parseInt(req.body.cn)] = Math.round(+new Date() / 1000); + req.user.challengesCompleted = function() { + var completed = []; + for (i = 0; i < h.length; i++) { + if (h[i] > 0) { + completed.push(i); + } + return completed; + } + } + req.user.save(); + console.log(req.user.challengesHash); + console.log(req.user.challengesCompleted); }); /** diff --git a/controllers/home.js b/controllers/home.js index f1bab63f941..b29d5ac6987 100644 --- a/controllers/home.js +++ b/controllers/home.js @@ -6,7 +6,8 @@ exports.index = function(req, res) { if (req.user) { if (req.user.challengesCompleted.length > 0) { - nextChallenge = Math.max.apply(Math, req.user.challengesCompleted) + 1; + Object.values(req.user.challengesHash); + nextChallenge = Math.max.apply(Math, req.user.challengesHash) + 1; res.redirect("challenges/" + nextChallenge); } else { res.redirect("challenges/0"); diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index 4170e392c60..486ad6d731d 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -20,8 +20,8 @@ img(src='#{user.profile.picture}') else img(src='#{user.gravatar(60)}') - | #{user.profile.name || user.email || user.id} [ #{Object.keys(user.challengesHash).length} ]  - i.caret + | #{user.profile.name || user.email || user.id} [ #{user.completedChallengeCount)} ]  + i.caret ul.dropdown-menu li a(href='/') From 07ba7e4fcbb6b77742200a6efbb8fee939b08990 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Thu, 4 Dec 2014 12:06:17 -0800 Subject: [PATCH 7/9] continue work on challengeshash --- app.js | 6 +++--- config/passport.js | 8 ++++---- controllers/challenges.js | 3 ++- controllers/home.js | 1 - views/partials/navbar.jade | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index 5fcd7d7c3ca..0c7ab23611e 100644 --- a/app.js +++ b/app.js @@ -165,20 +165,20 @@ app.get('/account/unlink/:provider', userController.getOauthUnlink); * API examples routes. */ app.post('/completed_challenge', function(req, res) { - console.log(req.user); req.user.challengesHash[parseInt(req.body.cn)] = Math.round(+new Date() / 1000); req.user.challengesCompleted = function() { var completed = []; + var h = req.user.challengesHash; for (i = 0; i < h.length; i++) { + console.log(h[i] > 0) if (h[i] > 0) { + console.log(h[i]); completed.push(i); } return completed; } } req.user.save(); - console.log(req.user.challengesHash); - console.log(req.user.challengesCompleted); }); /** diff --git a/config/passport.js b/config/passport.js index 517462d41c3..18816ac4e95 100644 --- a/config/passport.js +++ b/config/passport.js @@ -77,10 +77,10 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok user.save(function(err) { done(err, user); }); - if (!user.email) { - res.redirect('/account'); - req.flash('errors', { msg: 'OK, you are signed in. Please add your email address to your profile.' }); - } + //if (!user.email) { + // res.redirect('/account'); + // req.flash('errors', { msg: 'OK, you are signed in. Please add your email address to your profile.' }); + //} }); } })); diff --git a/controllers/challenges.js b/controllers/challenges.js index e7f951f0cc7..9d0b30291d7 100644 --- a/controllers/challenges.js +++ b/controllers/challenges.js @@ -19,7 +19,8 @@ exports.returnChallenge = function(req, res, next) { video: c.video, time: c.time, steps: c.steps, - cc: req.user.challengesHash + cc: req.user.challengesCompleted, + ch: req.user.challengesHash }); }); }; \ No newline at end of file diff --git a/controllers/home.js b/controllers/home.js index b29d5ac6987..df6ff23c8c9 100644 --- a/controllers/home.js +++ b/controllers/home.js @@ -6,7 +6,6 @@ exports.index = function(req, res) { if (req.user) { if (req.user.challengesCompleted.length > 0) { - Object.values(req.user.challengesHash); nextChallenge = Math.max.apply(Math, req.user.challengesHash) + 1; res.redirect("challenges/" + nextChallenge); } else { diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index 486ad6d731d..f27bf1d06f7 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -20,7 +20,7 @@ img(src='#{user.profile.picture}') else img(src='#{user.gravatar(60)}') - | #{user.profile.name || user.email || user.id} [ #{user.completedChallengeCount)} ]  + | #{user.profile.name || user.email || user.id} [ #{user.challengesCompleted.length} ]  i.caret ul.dropdown-menu li From 177dc900cf2ec8f6f49b92a78edb9fac5ee25e19 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Fri, 5 Dec 2014 20:44:42 -0800 Subject: [PATCH 8/9] made parallel 'points' infrastructure --- app.js | 21 ++- controllers/challenges.js | 3 +- models/User.js | 251 +++++++-------------------------- public/js/main.js | 9 +- views/account/profile.jade | 3 +- views/partials/challenges.jade | 86 +++++------ views/partials/navbar.jade | 4 +- 7 files changed, 110 insertions(+), 267 deletions(-) diff --git a/app.js b/app.js index 0c7ab23611e..49ca9c49762 100644 --- a/app.js +++ b/app.js @@ -163,21 +163,18 @@ app.get('/account/unlink/:provider', userController.getOauthUnlink); /** * API examples routes. + * accepts a post request. the challenge id req.body.challengeNumber + * and updates user.challengesHash & user.challengesCompleted + * */ app.post('/completed_challenge', function(req, res) { - req.user.challengesHash[parseInt(req.body.cn)] = Math.round(+new Date() / 1000); - req.user.challengesCompleted = function() { - var completed = []; - var h = req.user.challengesHash; - for (i = 0; i < h.length; i++) { - console.log(h[i] > 0) - if (h[i] > 0) { - console.log(h[i]); - completed.push(i); - } - return completed; - } + req.user.challengesHash[parseInt(req.body.challengeNumber)] = Math.round(+new Date() / 1000); + var ch = req.user.challengesHash; + var p = 0; + for (k in ch) { + if (ch[k] > 0) { p += 1} } + req.user.points = p; req.user.save(); }); diff --git a/controllers/challenges.js b/controllers/challenges.js index 9d0b30291d7..e7f951f0cc7 100644 --- a/controllers/challenges.js +++ b/controllers/challenges.js @@ -19,8 +19,7 @@ exports.returnChallenge = function(req, res, next) { video: c.video, time: c.time, steps: c.steps, - cc: req.user.challengesCompleted, - ch: req.user.challengesHash + cc: req.user.challengesHash }); }); }; \ No newline at end of file diff --git a/models/User.js b/models/User.js index d9598ffe775..eaa6ed8672d 100644 --- a/models/User.js +++ b/models/User.js @@ -14,208 +14,59 @@ var userSchema = new mongoose.Schema({ instagram: String, linkedin: String, tokens: Array, + points: { type: Number, default: 0 }, challengesCompleted: { type: Array, default: [] }, challengesHash: { - 0: { - type: Number, - default: 0, - }, - 1: { - type: Number, - default: 0, - }, - 2: { - type: Number, - default: 0, - }, - 3: { - type: Number, - default: 0, - }, - 4: { - type: Number, - default: 0, - }, - 5: { - type: Number, - default: 0, - }, - 6: { - type: Number, - default: 0, - }, - 7: { - type: Number, - default: 0, - }, - 8: { - type: Number, - default: 0, - }, - 9: { - type: Number, - default: 0, - }, - 10: { - type: Number, - default: 0, - }, - 11: { - type: Number, - default: 0, - }, - 12: { - type: Number, - default: 0, - }, - 13: { - type: Number, - default: 0, - }, - 14: { - type: Number, - default: 0, - }, - 15: { - type: Number, - default: 0, - }, - 16: { - type: Number, - default: 0, - }, - 17: { - type: Number, - default: 0, - }, - 18: { - type: Number, - default: 0, - }, - 19: { - type: Number, - default: 0, - }, - 20: { - type: Number, - default: 0, - }, - 21: { - type: Number, - default: 0, - }, - 22: { - type: Number, - default: 0, - }, - 23: { - type: Number, - default: 0, - }, - 24: { - type: Number, - default: 0, - }, - 25: { - type: Number, - default: 0, - }, - 26: { - type: Number, - default: 0, - }, - 27: { - type: Number, - default: 0, - }, - 28: { - type: Number, - default: 0, - }, - 29: { - type: Number, - default: 0, - }, - 30: { - type: Number, - default: 0, - }, - 31: { - type: Number, - default: 0, - }, - 32: { - type: Number, - default: 0, - }, - 33: { - type: Number, - default: 0, - }, - 34: { - type: Number, - default: 0, - }, - 35: { - type: Number, - default: 0, - }, - 36: { - type: Number, - default: 0, - }, - 37: { - type: Number, - default: 0, - }, - 38: { - type: Number, - default: 0, - }, - 39: { - type: Number, - default: 0, - }, - 40: { - type: Number, - default: 0, - }, - 41: { - type: Number, - default: 0, - }, - 42: { - type: Number, - default: 0, - }, - 43: { - type: Number, - default: 0, - }, - 44: { - type: Number, - default: 0, - }, - 45: { - type: Number, - default: 0, - }, - 46: { - type: Number, - default: 0, - }, - 47: { - type: Number, - default: 0, - }, - 48: { - type: Number, - default: 0, - }, - 49: { - type: Number, - default: 0, - } + 0: { type: Number, default: 0 }, + 1: { type: Number, default: 0 }, + 2: { type: Number, default: 0 }, + 3: { type: Number, default: 0 }, + 4: { type: Number, default: 0 }, + 5: { type: Number, default: 0 }, + 6: { type: Number, default: 0 }, + 7: { type: Number, default: 0 }, + 8: { type: Number, default: 0 }, + 9: { type: Number, default: 0 }, + 10: { type: Number, default: 0 }, + 11: { type: Number, default: 0 }, + 12: { type: Number, default: 0 }, + 13: { type: Number, default: 0 }, + 14: { type: Number, default: 0 }, + 15: { type: Number, default: 0 }, + 16: { type: Number, default: 0 }, + 17: { type: Number, default: 0 }, + 18: { type: Number, default: 0 }, + 19: { type: Number, default: 0 }, + 20: { type: Number, default: 0 }, + 21: { type: Number, default: 0 }, + 22: { type: Number, default: 0 }, + 23: { type: Number, default: 0 }, + 24: { type: Number, default: 0 }, + 25: { type: Number, default: 0 }, + 26: { type: Number, default: 0 }, + 27: { type: Number, default: 0 }, + 28: { type: Number, default: 0 }, + 29: { type: Number, default: 0 }, + 30: { type: Number, default: 0 }, + 31: { type: Number, default: 0 }, + 32: { type: Number, default: 0 }, + 33: { type: Number, default: 0 }, + 34: { type: Number, default: 0 }, + 35: { type: Number, default: 0 }, + 36: { type: Number, default: 0 }, + 37: { type: Number, default: 0 }, + 38: { type: Number, default: 0 }, + 39: { type: Number, default: 0 }, + 40: { type: Number, default: 0 }, + 41: { type: Number, default: 0 }, + 42: { type: Number, default: 0 }, + 43: { type: Number, default: 0 }, + 44: { type: Number, default: 0 }, + 45: { type: Number, default: 0 }, + 46: { type: Number, default: 0 }, + 47: { type: Number, default: 0 }, + 48: { type: Number, default: 0 }, + 49: { type: Number, default: 0 } }, profile: { name: { type: String, default: '' }, diff --git a/public/js/main.js b/public/js/main.js index a4aed45a491..c4d98b043da 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -20,14 +20,11 @@ $(document).ready(function() { $('#complete-dialog').modal('show'); l = location.pathname.split('/'); cn = l[l.length - 1] + console.log(cn); $.ajax({ type: 'POST', - data: {cn: cn}, - url: '/completed_challenge/', - success: function(data) { - console.log('success'); - console.log(JSON.stringify(data)); - } + data: {challengeNumber: cn}, + url: '/completed_challenge/' }); }); diff --git a/views/account/profile.jade b/views/account/profile.jade index 45c77cd68d5..4eaf6f71a96 100644 --- a/views/account/profile.jade +++ b/views/account/profile.jade @@ -35,8 +35,7 @@ block content h1 Completed Challenges ul - //each val, index in user.challengesHash - //li= index + ': ' + val + h3 Danger Zone button.btn.btn-danger.confirm-deletion span.ion-trash-b diff --git a/views/partials/challenges.jade b/views/partials/challenges.jade index c253483f006..127bf2e0c30 100644 --- a/views/partials/challenges.jade +++ b/views/partials/challenges.jade @@ -4,133 +4,133 @@ ol(start='0') h4 Web Design li - a(href="/challenges/0", class="#{ cc.indexOf(0) > -1 ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp + a(href="/challenges/0", class="#{ cc[0] > 0 ? 'strikethrough' : '' }") A One-minute Introduction to Free Code Camp |   (1 min) li - a(href="/challenges/1", class="#{ cc.indexOf(1) > -1 ? 'strikethrough' : '' }") Enter the Free Code Camp Chat Room + a(href="/challenges/1", class="#{ cc[1] > 0 ? 'strikethrough' : '' }") Enter the Free Code Camp Chat Room |   (10 mins) li - a(href="/challenges/2", class="#{ cc.indexOf(2) > -1 ? 'strikethrough' : '' }") Create a Website and Deploy it to the Internet + a(href="/challenges/2", class="#{ cc[2] > 0 ? 'strikethrough' : '' }") Create a Website and Deploy it to the Internet |   (5 mins) li - a(href="/challenges/3", class="#{ cc.indexOf(3) > -1 ? 'strikethrough' : '' }") Install Github's Atom Text Editor + a(href="/challenges/3", class="#{ cc[3] > 0 ? 'strikethrough' : '' }") Install Github's Atom Text Editor |   (5 mins) li - a(href="/challenges/4", class="#{ cc.indexOf(4) > -1 ? 'strikethrough' : '' }") Modify and Redeploy Your Website + a(href="/challenges/4", class="#{ cc[4] > 0 ? 'strikethrough' : '' }") Modify and Redeploy Your Website |   (5 mins) li - a(href="/challenges/5", class="#{ cc.indexOf(5) > -1 ? 'strikethrough' : '' }") Add Dynamic Content to your Website + a(href="/challenges/5", class="#{ cc[5] > 0 ? 'strikethrough' : '' }") Add Dynamic Content to your Website |   (10 mins) li - a(href="/challenges/6", class="#{ cc.indexOf(6) > -1 ? 'strikethrough' : '' }") Codecademy's HTML & CSS track + a(href="/challenges/6", class="#{ cc[6] > 0 ? 'strikethrough' : '' }") Codecademy's HTML & CSS track |   (7 hrs) li - a(href="/challenges/7", class="#{ cc.indexOf(7) > -1 ? 'strikethrough' : '' }") Experiment with HTML and CSS in CodePen + a(href="/challenges/7", class="#{ cc[7] > 0 ? 'strikethrough' : '' }") Experiment with HTML and CSS in CodePen |   (10 mins) li - a(href="/challenges/8", class="#{ cc.indexOf(8) > -1 ? 'strikethrough' : '' }") Codecademy's jQuery track + a(href="/challenges/8", class="#{ cc[8] > 0 ? 'strikethrough' : '' }") Codecademy's jQuery track |   (3 hrs) li - a(href="/challenges/9", class="#{ cc.indexOf(9) > -1 ? 'strikethrough' : '' }") Code School's Try jQuery + a(href="/challenges/9", class="#{ cc[9] > 0 ? 'strikethrough' : '' }") Code School's Try jQuery |   (4 hrs) li - a(href="/challenges/10", class="#{ cc.indexOf(10) > -1 ? 'strikethrough' : '' }") Code School's Discover DevTools + a(href="/challenges/10", class="#{ cc[10] > 0 ? 'strikethrough' : '' }") Code School's Discover DevTools |   (2 hrs) li - a(href="/challenges/11", class="#{ cc.indexOf(11) > -1 ? 'strikethrough' : '' }") jQuery Exercises + a(href="/challenges/11", class="#{ cc[11] > 0 ? 'strikethrough' : '' }") jQuery Exercises |   (1 hr) li - a(href="/challenges/12", class="#{ cc.indexOf(12) > -1 ? 'strikethrough' : '' }") Customize Bootstrap with Bootswatch + a(href="/challenges/12", class="#{ cc[12] > 0 ? 'strikethrough' : '' }") Customize Bootstrap with Bootswatch |   (10 mins) li - a(href="/challenges/13", class="#{ cc.indexOf(13) > -1 ? 'strikethrough' : '' }") Inject Life with CSS Transformations + a(href="/challenges/13", class="#{ cc[13] > 0 ? 'strikethrough' : '' }") Inject Life with CSS Transformations |   (15 mins) h4 Computer Science and JavaScript li - a(href="/challenges/14", class="#{ cc.indexOf(14) > -1 ? 'strikethrough' : '' }") Codecademy's JavaScript track + a(href="/challenges/14", class="#{ cc[14] > 0 ? 'strikethrough' : '' }") Codecademy's JavaScript track |   (10 hrs) li - a(href="/challenges/15", class="#{ cc.indexOf(15) > -1 ? 'strikethrough' : '' }") Stanford's Introduction to Computer Science + a(href="/challenges/15", class="#{ cc[15] > 0 ? 'strikethrough' : '' }") Stanford's Introduction to Computer Science |   (24 hrs) li - a(href="/challenges/16", class="#{ cc.indexOf(16) > -1 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP + a(href="/challenges/16", class="#{ cc[16] > 0 ? 'strikethrough' : '' }") Get Help The Hacker Way with RSAP |   (30 mins) li - a(href="/challenges/17", class="#{ cc.indexOf(17) > -1 ? 'strikethrough' : '' }") Learn Regular Expressions + a(href="/challenges/17", class="#{ cc[17] > 0 ? 'strikethrough' : '' }") Learn Regular Expressions |   (1 hr) li - a(href="/challenges/18", class="#{ cc.indexOf(18) > -1 ? 'strikethrough' : '' }") Start Your First Pair Programming Session + a(href="/challenges/18", class="#{ cc[18] > 0 ? 'strikethrough' : '' }") Start Your First Pair Programming Session |   (30 mins | Pair) li - a(href="/challenges/19", class="#{ cc.indexOf(19) > -1 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte + a(href="/challenges/19", class="#{ cc[19] > 0 ? 'strikethrough' : '' }") Easy Algorithm Scripting Challenges on Coderbyte |   (15 hrs | Pair) li - a(href="/challenges/20", class="#{ cc.indexOf(20) > -1 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course + a(href="/challenges/20", class="#{ cc[20] > 0 ? 'strikethrough' : '' }") Stanford's Relational Databases Mini-course |   (1 hr) li - a(href="/challenges/21", class="#{ cc.indexOf(21) > -1 ? 'strikethrough' : '' }") Stanford's SQL Mini-course + a(href="/challenges/21", class="#{ cc[21] > 0 ? 'strikethrough' : '' }") Stanford's SQL Mini-course |   (4 hrs | Pair) li - a(href="/challenges/22", class="#{ cc.indexOf(22) > -1 ? 'strikethrough' : '' }") Stanford's JSON Mini-course + a(href="/challenges/22", class="#{ cc[22] > 0 ? 'strikethrough' : '' }") Stanford's JSON Mini-course |   (1 hrs | Pair) li - a(href="/challenges/23", class="#{ cc.indexOf(23) > -1 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte + a(href="/challenges/23", class="#{ cc[23] > 0 ? 'strikethrough' : '' }") Medium Algorithm Scripting Challenges on Coderbyte |   (15 hrs | Pair) li - a.disabled(href="/challenges/24", class="#{ cc.indexOf(24) > -1 ? 'strikethrough' : '' }") Build an Interview Question Machine + a.disabled(href="/challenges/24", class="#{ cc[24] > 0 ? 'strikethrough' : '' }") Build an Interview Question Machine |   (5 hrs | Pair) li - a.disabled(href="/challenges/25", class="#{ cc.indexOf(25) > -1 ? 'strikethrough' : '' }") Build a Text-based Adventure + a.disabled(href="/challenges/25", class="#{ cc[25] > 0 ? 'strikethrough' : '' }") Build a Text-based Adventure |   (5 hrs | Pair) li - a.disabled(href="/challenges/26", class="#{ cc.indexOf(26) > -1 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte + a.disabled(href="/challenges/26", class="#{ cc[26] > 0 ? 'strikethrough' : '' }") Hard Algorithm Scripting Challenges on Coderbyte |   (15 hrs | Pair) h4 Full Stack JavaScript Development li - a.disabled(href="/challenges/27", class="#{ cc.indexOf(27) > -1 ? 'strikethrough' : '' }") Code School's Try Git + a.disabled(href="/challenges/27", class="#{ cc[27] > 0 ? 'strikethrough' : '' }") Code School's Try Git |   (30 mins) li - a.disabled(href="/challenges/28", class="#{ cc.indexOf(28) > -1 ? 'strikethrough' : '' }") Install Node.js + a.disabled(href="/challenges/28", class="#{ cc[28] > 0 ? 'strikethrough' : '' }") Install Node.js |   (1 hr) li - a.disabled(href="/challenges/29", class="#{ cc.indexOf(29) > -1 ? 'strikethrough' : '' }") Clone a Github Repo + a.disabled(href="/challenges/29", class="#{ cc[29] > 0 ? 'strikethrough' : '' }") Clone a Github Repo |   (15 mins) li - a.disabled(href="/challenges/30", class="#{ cc.indexOf(30) > -1 ? 'strikethrough' : '' }") Deploy an app to Heroku + a.disabled(href="/challenges/30", class="#{ cc[30] > 0 ? 'strikethrough' : '' }") Deploy an app to Heroku |   (15 mins) li - a.disabled(href="/challenges/31", class="#{ cc.indexOf(31) > -1 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS + a.disabled(href="/challenges/31", class="#{ cc[31] > 0 ? 'strikethrough' : '' }") Code School's Real-time web with Node.JS |   (5 hrs) li - a.disabled(href="/challenges/32", class="#{ cc.indexOf(32) > -1 ? 'strikethrough' : '' }") Try MongoDB + a.disabled(href="/challenges/32", class="#{ cc[32] > 0 ? 'strikethrough' : '' }") Try MongoDB |   (30 mins) li - a.disabled(href="/challenges/33", class="#{ cc.indexOf(33) > -1 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API + a.disabled(href="/challenges/33", class="#{ cc[33] > 0 ? 'strikethrough' : '' }") Explore your Network with the LinkedIn API |   (1 hr) li - a.disabled(href="/challenges/34", class="#{ cc.indexOf(34) > -1 ? 'strikethrough' : '' }") Build your first API + a.disabled(href="/challenges/34", class="#{ cc[34] > 0 ? 'strikethrough' : '' }") Build your first API |   (10 hrs | Pair) li - a.disabled(href="/challenges/35", class="#{ cc.indexOf(35) > -1 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping + a.disabled(href="/challenges/35", class="#{ cc[35] > 0 ? 'strikethrough' : '' }") Aggregate Data with Chron Jobs and Screen Scraping |   (10 hrs | Pair) li - a.disabled(href="/challenges/36", class="#{ cc.indexOf(36) > -1 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS + a.disabled(href="/challenges/36", class="#{ cc[36] > 0 ? 'strikethrough' : '' }") Code School's Shaping up with Angular.JS |   (5 hrs) li - a.disabled(href="/challenges/37", class="#{ cc.indexOf(37) > -1 ? 'strikethrough' : '' }") Reverse Engineer SnapChat + a.disabled(href="/challenges/37", class="#{ cc[37] > 0 ? 'strikethrough' : '' }") Reverse Engineer SnapChat |   (50 hrs | Pair) li - a.disabled(href="/challenges/38", class="#{ cc.indexOf(38) > -1 ? 'strikethrough' : '' }") Reverse Engineer Reddit + a.disabled(href="/challenges/38", class="#{ cc[38] > 0 ? 'strikethrough' : '' }") Reverse Engineer Reddit |   (50 hrs | Pair) li - a.disabled(href="/challenges/39", class="#{ cc.indexOf(39) > -1 ? 'strikethrough' : '' }") Reverse Engineer Pintrest + a.disabled(href="/challenges/39", class="#{ cc[39] > 0 ? 'strikethrough' : '' }") Reverse Engineer Pintrest |   (50 hrs | Pair) li - a.disabled(href="/challenges/40", class="#{ cc.indexOf(40) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project + a.disabled(href="/challenges/40", class="#{ cc[40] > 0 ? 'strikethrough' : '' }") Help a Nonprofit: Team Project |   (150 hrs | Pair) li - a.disabled(href="/challenges/41", class="#{ cc.indexOf(41) > -1 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project + a.disabled(href="/challenges/41", class="#{ cc[41] > 0 ? 'strikethrough' : '' }") Help a Nonprofit: Solo Project |   (150 hrs | Pair) li - a.disabled(href="/challenges/42", class="#{ cc.indexOf(42) > -1 ? 'strikethrough' : '' }") Crack the Coding Interview + a.disabled(href="/challenges/42", class="#{ cc[42] > 0 ? 'strikethrough' : '' }") Crack the Coding Interview |   (5 hrs) \ No newline at end of file diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index f27bf1d06f7..b300af60219 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -20,8 +20,8 @@ img(src='#{user.profile.picture}') else img(src='#{user.gravatar(60)}') - | #{user.profile.name || user.email || user.id} [ #{user.challengesCompleted.length} ]  - i.caret + | #{user.profile.name || user.email || user.id} [ #{user.points} ] + i.caret ul.dropdown-menu li a(href='/') From bedddde945410b9f6a6ac3ca580fc39332d1ee66 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Fri, 5 Dec 2014 23:10:02 -0800 Subject: [PATCH 9/9] make the profile page look better --- controllers/user.js | 5 +- package.json | 7 +- public/css/main.less | 8 ++ views/account/profile.jade | 180 ++++++++++++++++++++++++++++++++++++- views/partials/faq.jade | 7 +- 5 files changed, 199 insertions(+), 8 deletions(-) diff --git a/controllers/user.js b/controllers/user.js index 44224a98b5b..2f12bca1e68 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -5,6 +5,7 @@ var nodemailer = require('nodemailer'); var passport = require('passport'); var User = require('../models/User'); var secrets = require('../config/secrets'); +var moment = require('moment'); /** * GET /login @@ -118,7 +119,9 @@ exports.postSignup = function(req, res, next) { exports.getAccount = function(req, res) { res.render('account/profile', { - title: 'Manage your Free Code Camp Account' + title: 'Manage your Free Code Camp Account', + cc: req.user.challengesHash, + moment: moment }); }; diff --git a/package.json b/package.json index c5375c698a3..78f57b4b148 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "connect-mongo": "^0.4.1", "cookie-parser": "^1.3.3", "csso": "^1.3.11", + "dateformat": "^1.0.11", "dotenv": "^0.4.0", "errorhandler": "^1.3.0", "express": "^4.10.4", @@ -34,11 +35,12 @@ "lastfm": "^0.9.2", "less": "^1.7.5", "lodash": "^2.4.1", - "newrelic": "^1.13.3", "lusca": "^1.0.2", "method-override": "^2.3.0", + "moment": "^2.8.4", "mongoose": "^3.8.19", "morgan": "^1.5.0", + "newrelic": "^1.13.3", "node-foursquare": "^0.2.1", "node-linkedin": "^0.3.4", "nodemailer": "^1.3.0", @@ -51,8 +53,9 @@ "passport-local": "^1.0.0", "passport-oauth": "^1.0.0", "passport-twitter": "^1.0.2", - "sitemap": "^0.7.4", "request": "^2.49.0", + "sitemap": "^0.7.4", + "strftime": "^0.8.2", "stripe": "^3.0.2", "tumblr.js": "^0.0.4", "twilio": "^1.9.0", diff --git a/public/css/main.less b/public/css/main.less index 1fe4a5b8bee..81d9e007772 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -274,4 +274,12 @@ ul { .scroll-lock { overflow: hidden; height: 100%; +} + +.table { + margin-left: -16px; +} + +thead { + font-size: 150%; } \ No newline at end of file diff --git a/views/account/profile.jade b/views/account/profile.jade index 4eaf6f71a96..862668c8347 100644 --- a/views/account/profile.jade +++ b/views/account/profile.jade @@ -34,8 +34,184 @@ block content | Update my profile h1 Completed Challenges - ul - + .col-xs-12 + table.table.table-striped + thead + tr + th Challenge + th Date Finished + if cc[0] > 0 + tr + td A One-minute Introduction to Free Code Camp + td=moment(cc[0], 'X').format("MMM DD, YYYY") + if cc[1] > 0 + tr + td Enter the Free Code Camp Chat Room + td=moment(cc[1], 'X').format("MMM DD, YYYY") + if cc[2] > 0 + tr + td Create a Website and Deploy it to the Internet + td=moment(cc[2], 'X').format("MMM DD, YYYY") + if cc[3] > 0 + tr + td Install Github's Atom Text Editor + td=moment(cc[3], 'X').format("MMM DD, YYYY") + if cc[4] > 0 + tr + td Modify and Redeploy Your Website + td=moment(cc[4], 'X').format("MMM DD, YYYY") + if cc[5] > 0 + tr + td Add Dynamic Content to your Website + td=moment(cc[5], 'X').format("MMM DD, YYYY") + if cc[6] > 0 + tr + td Codecademy's HTML & CSS track + td=moment(cc[6], 'X').format("MMM DD, YYYY") + if cc[7] > 0 + tr + td Experiment with HTML and CSS in CodePen + td=moment(cc[7], 'X').format("MMM DD, YYYY") + if cc[8] > 0 + tr + td Codecademy's jQuery track + td=moment(cc[8], 'X').format("MMM DD, YYYY") + if cc[9] > 0 + tr + td Code School's Try jQuery + td=moment(cc[9], 'X').format("MMM DD, YYYY") + if cc[10] > 0 + tr + td Code School's Discover DevTools + td=moment(cc[10], 'X').format("MMM DD, YYYY") + if cc[11] > 0 + tr + td jQuery Exercises + td=moment(cc[11], 'X').format("MMM DD, YYYY") + if cc[12] > 0 + tr + td Customize Bootstrap with Bootswatch + td=moment(cc[12], 'X').format("MMM DD, YYYY") + if cc[13] > 0 + tr + td Inject Life with CSS Transformations + td=moment(cc[13], 'X').format("MMM DD, YYYY") + if cc[14] > 0 + tr + td Codecademy's JavaScript track + td=moment(cc[14], 'X').format("MMM DD, YYYY") + if cc[15] > 0 + tr + td Stanford's Introduction to Computer Science + td=moment(cc[15], 'X').format("MMM DD, YYYY") + if cc[16] > 0 + tr + td Get Help The Hacker Way with RSAP + td=moment(cc[16], 'X').format("MMM DD, YYYY") + if cc[17] > 0 + tr + td Learn Regular Expressions + td=moment(cc[17], 'X').format("MMM DD, YYYY") + if cc[18] > 0 + tr + td Start Your First Pair Programming Session + td=moment(cc[18], 'X').format("MMM DD, YYYY") + if cc[19] > 0 + tr + td Easy Algorithm Scripting Challenges on Coderbyte + td=moment(cc[19], 'X').format("MMM DD, YYYY") + if cc[20] > 0 + tr + td Stanford's Relational Databases Mini-course + td=moment(cc[20], 'X').format("MMM DD, YYYY") + if cc[21] > 0 + tr + td Stanford's SQL Mini-course + td=moment(cc[21], 'X').format("MMM DD, YYYY") + if cc[22] > 0 + tr + td Stanford's JSON Mini-course + td=moment(cc[22], 'X').format("MMM DD, YYYY") + if cc[23] > 0 + tr + td Medium Algorithm Scripting Challenges on Coderbyte + td=moment(cc[23], 'X').format("MMM DD, YYYY") + if cc[24] > 0 + tr + td Build an Interview Question Machine + td=moment(cc[24], 'X').format("MMM DD, YYYY") + if cc[25] > 0 + tr + td Build a Text-based Adventure + td=moment(cc[25], 'X').format("MMM DD, YYYY") + if cc[26] > 0 + tr + td Hard Algorithm Scripting Challenges on Coderbyte + td=moment(cc[26], 'X').format("MMM DD, YYYY") + if cc[27] > 0 + tr + td Code School's Try Git + td=moment(cc[27], 'X').format("MMM DD, YYYY") + if cc[28] > 0 + tr + td Install Node.js + td=moment(cc[28], 'X').format("MMM DD, YYYY") + if cc[29] > 0 + tr + td Clone a Github Repo + td=moment(cc[29], 'X').format("MMM DD, YYYY") + if cc[30] > 0 + tr + td Deploy an app to Heroku + td=moment(cc[30], 'X').format("MMM DD, YYYY") + if cc[31] > 0 + tr + td Code School's Real-time web with Node.JS + td=moment(cc[31], 'X').format("MMM DD, YYYY") + if cc[32] > 0 + tr + td Try MongoDB + td=moment(cc[32], 'X').format("MMM DD, YYYY") + if cc[33] > 0 + tr + td Explore your Network with the LinkedIn API + td=moment(cc[33], 'X').format("MMM DD, YYYY") + if cc[34] > 0 + tr + td Build your first API + td=moment(cc[34], 'X').format("MMM DD, YYYY") + if cc[35] > 0 + tr + td Aggregate Data with Chron Jobs and Screen Scraping + td=moment(cc[35], 'X').format("MMM DD, YYYY") + if cc[36] > 0 + tr + td Code School's Shaping up with Angular.JS + td=moment(cc[36], 'X').format("MMM DD, YYYY") + if cc[37] > 0 + tr + td Reverse Engineer SnapChat + td=moment(cc[37], 'X').format("MMM DD, YYYY") + if cc[38] > 0 + tr + td Reverse Engineer Reddit + td=moment(cc[38], 'X').format("MMM DD, YYYY") + if cc[39] > 0 + tr + td Reverse Engineer Pintrest + td=moment(cc[39], 'X').format("MMM DD, YYYY") + if cc[40] > 0 + tr + td Help a Nonprofit: Team Project + td=moment(cc[40], 'X').format("MMM DD, YYYY") + if cc[41] > 0 + tr + td Help a Nonprofit: Solo Project + td=moment(cc[41], 'X').format("MMM DD, YYYY") + if cc[42] > 0 + tr + td Crack the Coding Interview + td=moment(cc[42], 'X').format("MMM DD, YYYY") h3 Danger Zone button.btn.btn-danger.confirm-deletion span.ion-trash-b diff --git a/views/partials/faq.jade b/views/partials/faq.jade index 1f7fe1b04a3..e2cb2d9aa95 100644 --- a/views/partials/faq.jade +++ b/views/partials/faq.jade @@ -36,9 +36,10 @@ ul p.landing-p It takes about 1,000 hours of coding to develop the skills you'll need to get an entry level software engineering job. Many in-person coding bootcamps jam all this into 12 weeks of intensive study. Free Code Camp is fully online, and there will always be other people at your skill level that you can pair program with, so you can learn at your own pace. Here are some example coding schedules: table.table - th Time budgeted - th Hours per week - th Weeks to complete + thead + th Time budgeted + th Hours per week + th Weeks to complete tr.info td Weekends td 10 hours/week