From cf941c3666ca6bdafdb07321b694a40e552a8228 Mon Sep 17 00:00:00 2001 From: letalumil Date: Mon, 16 Feb 2015 10:02:35 +0300 Subject: [PATCH 01/22] Fix 'Cash Register' bonfire bug. Closes #103 --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 9af6ce4be4..776bcc0636 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -546,7 +546,7 @@ "expect(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", "expect(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');", - "assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 80.00], ['TEN', 10.00], ['FIVE', 5], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');", + "assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');", "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), 'Insufficient Funds', 'insufficient funds');", "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), \"Closed\", 'cash-in-drawer equals change');" ] From 9dd1558f1c06419925c90e71efd075f858f87ba0 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Sun, 15 Feb 2015 23:59:03 -0800 Subject: [PATCH 02/22] update the about page and make it the root --- app.js | 10 +++ controllers/challenges.js | 22 ++++++- controllers/home.js | 14 +--- controllers/resources.js | 75 ++++++++++++---------- public/css/lib/bootstrap/variables.less | 6 +- public/css/main.less | 13 ++++ seed_data/challenges.json | 2 +- seed_data/coursewares.json | 32 +++++++++- views/partials/about.jade | 42 ++++++------ views/partials/blog.jade | 30 +++------ views/partials/faq.jade | 5 +- views/partials/stats.jade | 85 ++++++++++++------------- views/resources/learn-to-code.jade | 49 ++++++++++++-- 13 files changed, 240 insertions(+), 145 deletions(-) diff --git a/app.js b/app.js index 632edb58f8..f32d521677 100644 --- a/app.js +++ b/app.js @@ -168,6 +168,7 @@ app.use(helmet.contentSecurityPolicy({ '*.vimeo.com', '*.twitter.com', '*.rafflecopter.com', + '*.ghbtns.com' ].concat(trusted), reportOnly: false, // set to true if you only want to report errors setAllHeaders: false, // set to true if you want to set all headers @@ -255,10 +256,19 @@ app.post( passportConf.isAuthenticated, userController.updateProgress ); + +/** + * Challenge related routes + */ +app.get( + '/challenges/', + challengesController.returnNextChallenge +); app.get( '/challenges/:challengeNumber', challengesController.returnChallenge ); + app.all('/account', passportConf.isAuthenticated); app.get('/account/api', userController.getAccountAngular); diff --git a/controllers/challenges.js b/controllers/challenges.js index 9de4496a4c..a0d3f3f52f 100644 --- a/controllers/challenges.js +++ b/controllers/challenges.js @@ -9,7 +9,27 @@ var _ = require('lodash'), var highestChallengeNumber = 53; -exports.returnChallenge = function(req, res, next) { + +exports.returnNextChallenge = function(req, res) { + if (req.user) { + ch = req.user.challengesHash; + if (req.user.challengesHash[0] > 0) { + var max = Object.keys(ch).reduce(function(max, key) { + return (max === undefined || ch[key] > ch[max]) ? +key : max; + }); + nextChallenge = max + 1; + res.redirect('challenges/' + nextChallenge); + } else { + res.redirect('challenges/0'); + } + } else { + res.render('home', { + title: 'Learn to Code and Become a Software Engineer', + }); + } +}; + +exports.returnChallenge = function(req, res) { var challengeNumber = parseInt(req.params.challengeNumber) || 0; if (challengeNumber > highestChallengeNumber) { req.flash('errors', { diff --git a/controllers/home.js b/controllers/home.js index 3105d1ea10..e2e752e423 100644 --- a/controllers/home.js +++ b/controllers/home.js @@ -5,20 +5,10 @@ exports.index = function(req, res) { if (req.user) { - ch = req.user.challengesHash; - if (req.user.challengesHash[0] > 0) { - var max = Object.keys(ch).reduce(function(max, key) { - return (max === undefined || ch[key] > ch[max]) ? +key : max; - }); - nextChallenge = max + 1; - res.redirect('challenges/' + nextChallenge); - } else { - res.redirect('challenges/0'); - } + res.redirect('/learn-to-code') } else { res.render('home', { - title: 'Learn to Code and Become a Software Engineer', - landingPage: true + title: 'Learn to Code and Become a Software Engineer' }); } }; diff --git a/controllers/resources.js b/controllers/resources.js index d0a5a458b9..84dc9913bf 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -102,48 +102,57 @@ module.exports = { var date2 = new Date(); var timeDiff = Math.abs(date2.getTime() - date1.getTime()); var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24)); + var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 }; client.get('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(trello, res2) { - client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function(blogger, res3) { - var nonprofitProjects = (JSON.parse(trello)).length || 27; - var blog = JSON.parse(blogger); - User.count({'points': {'$gt': 2}}, function (err, c3) { - if (err) { - debug('User err: ', err); - next(err); - } - User.count({'points': {'$gt': 9}}, function (err, c10) { - if (err) { - debug('User err: ', err); - next(err); - } - User.count({'points': {'$gt': 29}}, function (err, c30) { + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls', githubHeaders, function(pulls, res3) { + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues', githubHeaders, function(issues, res4) { + client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blogger, res5) { + var nonprofitProjects = (JSON.parse(trello)).length || 27; + var pulls = pulls ? (JSON.parse(pulls)).length : 0; + var issues = issues ? (JSON.parse(issues)).length : 0; + var blog = JSON.parse(blogger); + User.count({'points': {'$gt': 2}}, function (err, c3) { if (err) { debug('User err: ', err); next(err); } - User.count({'points': {'$gt': 53}}, function (err, all) { + User.count({'points': {'$gt': 9}}, function (err, c10) { if (err) { debug('User err: ', err); next(err); } - res.render('resources/learn-to-code', { - title: 'About Free Code Camp and Our Team of Volunteers', - daysRunning: daysRunning, - nonprofitProjects: nonprofitProjects, - c3: c3, - c10: c10, - c30: c30, - all: all, - blog1Title: blog["items"][0]["title"], - blog1Link: blog["items"][0]["url"], - blog2Title: blog["items"][1]["title"], - blog2Link: blog["items"][1]["url"], - blog3Title: blog["items"][2]["title"], - blog3Link: blog["items"][2]["url"], - blog4Title: blog["items"][3]["title"], - blog4Link: blog["items"][3]["url"], - blog5Title: blog["items"][4]["title"], - blog5Link: blog["items"][4]["url"] + User.count({'points': {'$gt': 29}}, function (err, c30) { + if (err) { + debug('User err: ', err); + next(err); + } + User.count({'points': {'$gt': 53}}, function (err, all) { + if (err) { + debug('User err: ', err); + next(err); + } + res.render('resources/learn-to-code', { + title: 'About Free Code Camp and Our Team of Volunteers', + daysRunning: daysRunning, + nonprofitProjects: nonprofitProjects, + pulls: pulls, + issues: issues, + c3: c3, + c10: c10, + c30: c30, + all: all, + blog1Title: blog["items"][0]["title"], + blog1Link: blog["items"][0]["url"], + blog2Title: blog["items"][1]["title"], + blog2Link: blog["items"][1]["url"], + blog3Title: blog["items"][2]["title"], + blog3Link: blog["items"][2]["url"], + blog4Title: blog["items"][3]["title"], + blog4Link: blog["items"][3]["url"], + blog5Title: blog["items"][4]["title"], + blog5Link: blog["items"][4]["url"] + }); + }); }); }); }); diff --git a/public/css/lib/bootstrap/variables.less b/public/css/lib/bootstrap/variables.less index e6d916a76a..3de76507c7 100755 --- a/public/css/lib/bootstrap/variables.less +++ b/public/css/lib/bootstrap/variables.less @@ -717,9 +717,9 @@ @panel-success-border: @state-success-border; @panel-success-heading-bg: @state-success-bg; -@panel-info-text: @state-info-text; -@panel-info-border: @state-info-border; -@panel-info-heading-bg: @state-info-bg; +@panel-info-text: #eee; +@panel-info-border: darken(#4a2b0f, 5%); +@panel-info-heading-bg: #4a2b0f; @panel-warning-text: @state-warning-text; @panel-warning-border: @state-warning-border; diff --git a/public/css/main.less b/public/css/main.less index 50058c04f5..eef9b6b785 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -374,6 +374,11 @@ ul { display: block; } +.next-challenge-button { + max-width: 1500px; + margin:0 auto; +} + .btn-big { font-size: 30px; } @@ -690,6 +695,14 @@ iframe.iphone { font-size: 0px; } +.stats-text { + font-size: 26px; + line-height: 150%; +} + +.github-button-container { + padding-top: 5px; +} //uncomment this to see the dimensions of all elements outlined in red //* { diff --git a/seed_data/challenges.json b/seed_data/challenges.json index 84cad0c051..7286158d48 100644 --- a/seed_data/challenges.json +++ b/seed_data/challenges.json @@ -400,7 +400,7 @@ "Try an intelligent Google query that involves JavaScript and filters for this year (since JavaScript changes).", "Go to http://stackoverflow.com/ and view the recent questions.", "Go to http://webchat.freenode.net/ and create an IRC account.", - "Join the #JavaScript chat room and introduce yourself as a Free Code Camp student.", + "Join the #LearnJavaScript chat room and introduce yourself as a Free Code Camp student.", "Finally, we have a special chat room specifically for getting help with tools you learn through Free Code Camp Challenges. Go to https://gitter.im/FreeCodeCamp/Help. Keep this chat open while you work on the remaining challenges.", "Now you have several ways of getting help when you're stuck." ] diff --git a/seed_data/coursewares.json b/seed_data/coursewares.json index 21454b1d0a..130b89d9d8 100644 --- a/seed_data/coursewares.json +++ b/seed_data/coursewares.json @@ -419,6 +419,36 @@ "challengeType": 0 }, + { + "_id" : "bad87fee1348bd9aedf08811", + "name": "Use rgb Codes for Precise Colors", + "difficulty" : "0.17", + "description": [ + "Change the red-text class's color rgb value to be red.", + "Another way to represent color in CSS is with rgb, or red-green-blue notation.", + "For each of the three colors, you specify a value between 0 and 256.", + "For example, black is rgb(0, 0, 0), white is rgb(255, 255, 255), bright green is rgb(0, 255, 0). You can also get less intense colors by using values lower than 255. For example, light green is rgb(0, 123, 0).", + "If you think about it, this is just as precise as using hex code, because 16 times 16 is 256. In practice, most developers use hex code since it's faster to say out loud and to type.", + "We'll use 6-digit hex code in all our challenges going forward, but it's good to be aware of this rgb notation." + ], + "tests": [ + "expect($('h2')).to.have.css('color', 'rgb(255, 0, 0)');", + "expect($('h2')).to.have.class('red-text');" + ], + "challengeSeed": [ + "", + "", + "

hello world

", + "

cat photo app

", + "

lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

" + ], + "challengeType": 0 + }, + { "_id" : "bad87fee1348bd9aedf08810", "name": "Use Hex Codes for Precise Colors", @@ -478,7 +508,7 @@ { "_id" : "bad87fee1348bd9aedf08811", - "name": "Use rgb Codes for Precise Colors", + "name": "Set the Alpha of a Color with rgba", "difficulty" : "0.17", "description": [ "Change the red-text class's color rgb value to be red.", diff --git a/views/partials/about.jade b/views/partials/about.jade index 429e3a2850..33663d77f0 100644 --- a/views/partials/about.jade +++ b/views/partials/about.jade @@ -1,4 +1,4 @@ -.panel.panel-primary +.panel.panel-info .panel-heading.landing-panel-heading.text-center Our Team of Volunteer Camp Counselors .panel-body .landing-panel-body.text-center @@ -12,121 +12,121 @@ } }); #shuffle - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Ammar Shah h4.negative-10.text-nowrap Community Builder img.profile-image(src='https://s3.amazonaws.com/freecodecamp/ammar-shah.jpg' alt="Ammar Shah's picture") h4.text-nowrap Karachi, Pakistan p.negative-10 "I code whenever I'm not sleeping or in school. Making computers obey me is a dream come true." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Branden Byers h4.negative-10.text-nowrap Instructional Designer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/branden-byers.jpg' alt="Branden Byers picture") h4.text-nowrap Madison, Wisconsin p.negative-10 "Cookbook author and stay-at-home-dad. Started coding as a kid, got distracted, but now I'm back in full JavaScript force!" - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Michael Johnson h4.negative-10.text-nowrap Nonprofit Coordinator img.profile-image(src='https://s3.amazonaws.com/freecodecamp/michael-johnson.jpeg' alt="Michael Johnson's picture") h4.text-nowrap Washington, D.C. p.negative-10 "I’m a recent Harvard University graduate who took a pass on Wall Street to code for a cause, and help others do the same." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Berkeley Martinez h4.negative-10.text-nowrap JavaScript Engineer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/berkeley-martinez.jpg' alt="Berkeley Martinez's picture") h4.text-nowrap San Francisco, California p.negative-10 "Former mechanical engineer. Coding is pure creation. I can fly, but only once." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Mychael Zuniga h4.negative-10.text-nowrap JavaScript Engineer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/mychael-zuniga.jpg' alt="Mychael Zuniga's picture") h4.text-nowrap San Diego, California p.negative-10 "I'm a college student who turned to code as an avenue for creative expression. I love political science and economics." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Jeanette Casteñeta h4.negative-10.text-nowrap Product Manager img.profile-image(src='https://s3.amazonaws.com/freecodecamp/jeanette-casteneta.jpg' alt="Jeanette Casteñeta's picture") h4.text-nowrap San Francisco, California p.negative-10 "Home-ec diva. I can envision a dress, then stitch it together. Now I'm learning how to do the same thing with code." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Darryl Dixon h4.negative-10.text-nowrap Community Builder img.profile-image(src='https://s3.amazonaws.com/freecodecamp/darryl-dixon.jpg' alt="Darryl Dixon's picture") h4.text-nowrap Newport News, Virginia p.negative-10 "I'm a self-taught graphic designer. I'm learning web development here and want you to learn with me." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Kathy O'Driscoll h4.negative-10.text-nowrap Community Builder img.profile-image(src='https://s3.amazonaws.com/freecodecamp/kathy-odriscoll.jpg' alt="Kathy O'Driscoll's picture") h4.text-nowrap Los Angeles, California p.negative-10 "Mother and grandmother. All my life I've dabbled in getting machines to do my bidding. Now it's becoming my career." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Ryan Malm h4.negative-10.text-nowrap Visual Designer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/ryan-malm.jpg' alt="Ryan Malm's picture") h4.text-nowrap Omaha, Nebraska p.negative-10 "I love origami, piano, and playing minecraft with my kids. My JavaScript grows stronger every day." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Charles Watson h4.negative-10.text-nowrap JavaScript Engineer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/charles-watson.jpg' alt="Charles Watson's picture") h4.text-nowrap Minneapolis, Minnesota p.negative-10 "I skipped college. I build iOS apps. I love the obstacles and puzzles that coding presents me." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Quincy Larson h4.negative-10.text-nowrap Instructional Designer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/quincy-larson.jpg' alt="Quincy Larson's picture") h4.text-nowrap San Francisco, California p.negative-10 "I worked as a school director in China before learning to code. It's clear that everyone can - and should - learn to code." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Mark Howard h4.negative-10.text-nowrap Digital Marketer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/mark-howard.jpg' alt="Mark Howard's picture") h4.text-nowrap San Diego, California p.negative-10 "I enjoy helping people, at scale. Code is the best way to do that." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Nathan Leniz h4.negative-10.text-nowrap JavaScript Engineer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/nathan-leniz.jpg' alt="Nathan Leniz's picture") h4.text-nowrap Seoul, South Korea p.negative-10 "I learned to code for the games, and stayed for the algorithms." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Jason Rueckert h4.negative-10.text-nowrap Live Content Manager img.profile-image(src='https://s3.amazonaws.com/freecodecamp/jason-rueckert.jpg' alt="Jason Rueckert's picture") h4.text-nowrap Seattle, Washington p.negative-10 "My high school job was testing basketball shoes for Nike. I learned code to work smarter, not harder. I have no thyroid." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Christopher Nguyen h4.negative-10.text-nowrap QA Engineer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/christopher-nguyen.jpg' alt="Christopher Nguyen's picture") h4.text-nowrap Seattle, Washington p.negative-10 "Morning Owl. Code is an equalizer. Barriers exist everywhere, but if you can say 'hello world', the world will say hello back." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Dominic Jones h4.negative-10.text-nowrap Community Builder img.profile-image(src='https://s3.amazonaws.com/freecodecamp/dominic-jones.jpg' alt="Dominic Jones's picture") h4.text-nowrap York, Pennsylvania p.negative-10 "Born with Sickle Cell Anemia. Professional writer, working on becoming a professional code writer." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap James McShane h4.negative-10.text-nowrap JavaScript Engineer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/james-mcshane.jpg' alt="James McShane's picture") h4.text-nowrap Minneapolis, Minnesota p.negative-10 "I just bought our first house, ending a 10 year streak of moving each year. I've used code to solve problems since I was a child." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Ellie Adam h4.negative-10.text-nowrap Visual Designer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/ellie-adam.jpg' alt="Eliie Adam's picture") h4.text-nowrap Seattle, Washington p.negative-10 "I photograph birds and flowers. I'm a designer who recently decided to learn coding and front end web developement." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Kamal Sharif h4.negative-10.text-nowrap JavaScript Engineer img.profile-image(src='https://s3.amazonaws.com/freecodecamp/kamal-sharif.jpg' alt="Kamal Sharif's picture") h4.text-nowrap Dhaka, Bangladesh p.negative-10 "I build applications that help other people improve their own lives." - .col-xs-12.col-sm-4.col-md-3.team-member + .col-xs-12.col-sm-12.col-md-12.col-lg-6.team-member h3.negative-10.text-nowrap Patrick Ly h4.negative-10.text-nowrap Community Builder img.profile-image(src='https://s3.amazonaws.com/freecodecamp/patrick-ly.jpg' alt="Patrick Ly's picture") diff --git a/views/partials/blog.jade b/views/partials/blog.jade index a8a47e2473..946a659966 100644 --- a/views/partials/blog.jade +++ b/views/partials/blog.jade @@ -1,20 +1,10 @@ -.panel.panel-primary - .panel-heading.landing-panel-heading.text-center Our Blog and Tweets - .panel-body - .landing-panel-body.text-center - .row - .col-xs-12.col-sm-12.col-md-6 - h2 - a(href=blog1Link)= blog1Title - h2 - a(href=blog2Link)= blog2Title - h2 - a(href=blog3Link)= blog3Title - h2 - a(href=blog4Link)= blog4Title - h2 - a(href=blog5Link)= blog5Title - .col-xs-12.col-sm-12.col-md-6 - a.twitter-timeline(data-dnt='true', href='https://twitter.com/FreeCodeCamp', data-widget-id='560847186548621312') Tweets by @FreeCodeCamp - script. - !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); \ No newline at end of file +h2 + a(href=blog1Link)= blog1Title +h2 + a(href=blog2Link)= blog2Title +h2 + a(href=blog3Link)= blog3Title +h2 + a(href=blog4Link)= blog4Title +h2 + a(href=blog5Link)= blog5Title \ No newline at end of file diff --git a/views/partials/faq.jade b/views/partials/faq.jade index 569969a62e..6b55904968 100644 --- a/views/partials/faq.jade +++ b/views/partials/faq.jade @@ -1,4 +1,4 @@ -.panel.panel-primary +.panel.panel-info .panel-heading.landing-panel-heading.text-center Frequently Asked Questions .panel-body .landing-panel-body @@ -16,11 +16,12 @@ p.landing-p Then you'll learn computer science and the art of programming: ul li.landing-p • JavaScript - the one programming language that all web browsers use - li.landing-p • Git - a version control system for saving and sharing your projects li.landing-p • Algorithms - step-by-step recipes for getting things done + li.landing-p • Automated Testing - write tests to test the limits of your code p.landing-p You'll spend the last half of Free Code Camp using Agile Methodologies and Full Stack JavaScript to build projects for nonprofits: ul li.landing-p • Agile - a set of software development principles that focus the design and production of a project on the needs of its users + li.landing-p • Git - a version control system for saving and sharing your projects li.landing-p • MongoDB - a popular non-relational database li.landing-p • Angular.js - a tool for making exciting web interfaces li.landing-p • Express.js - a powerful web development framework diff --git a/views/partials/stats.jade b/views/partials/stats.jade index a7ede7f9f8..7cebe88e30 100644 --- a/views/partials/stats.jade +++ b/views/partials/stats.jade @@ -1,46 +1,39 @@ -.panel.panel-primary - .panel-heading.landing-panel-heading.text-center Free Code Camp Stats - .panel-body - .landing-panel-body.text-center - .row - .col-xs-6.text-right - h2 Days since we Launched: - .col-xs-6.text-left - h2 - = daysRunning - .row - .col-xs-6.text-right - h2 Nonprofit Projects: - .col-xs-6.text-left - h2 - =nonprofitProjects - |   - a(href="https://trello.com/b/BA3xVpz9/nonprofit-projects") (view) - .row - .col-xs-6.text-right - h2 Campers with at least... - .col-xs-6 - .row - .col-xs-6.text-right - h2 3 Points: - .col-xs-6.text-left - h2 - = c3 - .row - .col-xs-6.text-right - h2 10 Points: - .col-xs-6.text-left - h2 - = c10 - .row - .col-xs-6.text-right - h2 30 Points: - .col-xs-6.text-left - h2 - = c30 - .row - .col-xs-6.text-right - h2 All 54 Points: - .col-xs-6.text-left - h2 - = all \ No newline at end of file +h2.stats-text + .row + .col-xs-6.text-right Days since we launched: + .col-xs-6.text-left= daysRunning + .row + .col-xs-6.text-right Nonprofit Projects: + .col-xs-6.text-left= nonprofitProjects + |   + a(href="https://trello.com/b/BA3xVpz9/nonprofit-projects") (view) + .row + .col-xs-6.text-right Open Issues: + .col-xs-6.text-left= pulls + |   + a(href="https://github.com/freecodecamp/freecodecamp/issues") (view) + .row + .col-xs-6.text-right Pull Requests: + .col-xs-6.text-left= pulls + |   + a(href="https://github.com/freecodecamp/freecodecamp/pulls") (view) + .row + .col-xs-6.text-right Campers with at least... + .col-xs-4 + .row + .col-xs-6.text-right 3 Points: + .col-xs-6.text-left= c3 + .row + .col-xs-6.text-right 10 Points: + .col-xs-6.text-left= c10 + .row + .col-xs-6.text-right 30 Points: + .col-xs-6.text-left= c30 + .row + .col-xs-6.text-right All 54 Points: + .col-xs-6.text-left= all + .row + .col-xs-6.text-right Star our project here: + .col-xs-6.text-left.github-button-container + html. + \ No newline at end of file diff --git a/views/resources/learn-to-code.jade b/views/resources/learn-to-code.jade index 12c1d64b61..9b09218e92 100644 --- a/views/resources/learn-to-code.jade +++ b/views/resources/learn-to-code.jade @@ -1,8 +1,47 @@ -extends ../layout +extends ../layout-wide block content + img.img-responsive.img-center(src='https://s3.amazonaws.com/freecodecamp/wide-social-banner.png') + br + a.btn.btn-big.btn-block.btn-primary.next-challenge-button(href="/challenges/") Take me to my next challenge + br script. var challengeName = 'Learn to code' - include ../partials/stats - include ../partials/blog - include ../partials/about - include ../partials/faq \ No newline at end of file + .row + .col-xs-12.col-sm-12.col-md-6 + include ../partials/faq + .col-xs-12.col-sm-12.col-md-6 + .panel.panel-info + .panel-heading.landing-panel-heading.text-center Stats + .panel-body + .landing-panel-body + include ../partials/stats + .panel.panel-info + .panel-heading.landing-panel-heading.text-center Blog + .panel-body + .landing-panel-body.text-center + include ../partials/blog + .panel.panel-info + .panel-heading.landing-panel-heading.text-center Tweets + .panel-body + .landing-panel-body.text-center + a.twitter-timeline(data-dnt='true', href='https://twitter.com/FreeCodeCamp', data-widget-id='560847186548621312') Tweets by @FreeCodeCamp + script. + !function (d, s, id) { + var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; + if (!d.getElementById(id)) { + js = d.createElement(s); + js.id = id; + js.src = p + "://platform.twitter.com/widgets.js"; + fjs.parentNode.insertBefore(js, fjs); + } + }(document, "script", "twitter-wjs"); + .text-center + html. + + + include ../partials/about From 762ee8aa2605ed4591885eb80cbcf2d9ddfe801f Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 16 Feb 2015 01:21:40 -0800 Subject: [PATCH 03/22] fix about view to render data from github --- controllers/resources.js | 10 +++++----- views/partials/stats.jade | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/resources.js b/controllers/resources.js index 84dc9913bf..28d432eefa 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -104,12 +104,12 @@ module.exports = { var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24)); var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 }; client.get('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(trello, res2) { - client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls', githubHeaders, function(pulls, res3) { - client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues', githubHeaders, function(issues, res4) { - client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blogger, res5) { + client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blogger, res5) { + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(pulls, res3) { + pulls = Object.keys(JSON.parse(pulls)).length || "Can't connect to github"; + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(issues, res4) { var nonprofitProjects = (JSON.parse(trello)).length || 27; - var pulls = pulls ? (JSON.parse(pulls)).length : 0; - var issues = issues ? (JSON.parse(issues)).length : 0; + issues = Object.keys(JSON.parse(issues)).length - pulls || "Can't connect to github"; var blog = JSON.parse(blogger); User.count({'points': {'$gt': 2}}, function (err, c3) { if (err) { diff --git a/views/partials/stats.jade b/views/partials/stats.jade index 7cebe88e30..266366c25b 100644 --- a/views/partials/stats.jade +++ b/views/partials/stats.jade @@ -9,7 +9,7 @@ h2.stats-text a(href="https://trello.com/b/BA3xVpz9/nonprofit-projects") (view) .row .col-xs-6.text-right Open Issues: - .col-xs-6.text-left= pulls + .col-xs-6.text-left= issues |   a(href="https://github.com/freecodecamp/freecodecamp/issues") (view) .row From 5628b4489916b43a23c7b907f9acd0456f931b96 Mon Sep 17 00:00:00 2001 From: letalumil Date: Mon, 16 Feb 2015 19:36:18 +0300 Subject: [PATCH 04/22] Fix 'Inventory Update' bonfire. Closes #105 --- seed_data/bonfires.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 776bcc0636..8b9b95f867 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -558,14 +558,14 @@ "description": [ "Compare and update inventory stored in a 2d array against a second 2d array of a fresh delivery. Update current inventory item quantity, and if an item cannot be found, add the new item and quantity into the inventory array in alphabetical order." ], - "challengeSeed": "function inventory(arr1, arr2) {\n // All inventory must be accounted for or you're fired!\r\n return arr1;\r\n}\n\n// Example inventory lists\r\nvar curInv = [\r\n [21, 'Bowling Ball'],\r\n [2, 'Dirty Sock'],\r\n [1, 'Hair pin'],\r\n [5, 'Microphone']\r\n];\r\n\r\nvar newInv = [\r\n [2, 'Hair Pin'],\r\n [3, 'Half-Eaten Apple'],\r\n [67, 'Bowling Ball'],\r\n [7, 'Toothpaste']\r\n];\r\n\r\ninventory(curInv, newInv);", + "challengeSeed": "function inventory(arr1, arr2) {\n // All inventory must be accounted for or you're fired!\r\n return arr1;\r\n}\n\n// Example inventory lists\r\nvar curInv = [\r\n [21, 'Bowling Ball'],\r\n [2, 'Dirty Sock'],\r\n [1, 'Hair Pin'],\r\n [5, 'Microphone']\r\n];\r\n\r\nvar newInv = [\r\n [2, 'Hair Pin'],\r\n [3, 'Half-Eaten Apple'],\r\n [67, 'Bowling Ball'],\r\n [7, 'Toothpaste']\r\n];\r\n\r\ninventory(curInv, newInv);", "tests": [ - "expect(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']])).to.be.a('array');", - "assert.equal(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]).length, 6);", - "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[88, 'Bowling Ball'], [2, 'Dirty Sock'], [3, 'Hair pin'], [3, 'Half-Eaten Apple'], [5, 'Microphone'], [7, 'Toothpaste']]);", - "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair pin'], [5, 'Microphone']], []), [[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair pin'], [5, 'Microphone']]);", - "assert.deepEqual(inventory([], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]);", - "assert.deepEqual(inventory([[0, 'Bowling Ball'], [0, 'Dirty Sock'], [0, 'Hair pin'], [0, 'Microphone']], [[1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [1, 'Bowling Ball'], [1, 'Toothpaste']]), [[1, 'Bowling Ball'], [1, 'Dirty Sock'], [1, 'Hair pin'], [1, 'Half-Eaten Apple'], [1, 'Microphone'], [1, 'Toothpaste']]);" + "expect(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']])).to.be.a('array');", + "assert.equal(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]).length, 6);", + "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[88, 'Bowling Ball'], [2, 'Dirty Sock'], [3, 'Hair Pin'], [3, 'Half-Eaten Apple'], [5, 'Microphone'], [7, 'Toothpaste']]);", + "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], []), [[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']]);", + "assert.deepEqual(inventory([], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[67, 'Bowling Ball'], [2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [7, 'Toothpaste']]);", + "assert.deepEqual(inventory([[0, 'Bowling Ball'], [0, 'Dirty Sock'], [0, 'Hair Pin'], [0, 'Microphone']], [[1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [1, 'Bowling Ball'], [1, 'Toothpaste']]), [[1, 'Bowling Ball'], [0, 'Dirty Sock'], [1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [0, 'Microphone'], [1, 'Toothpaste']]);" ] } ] From d279ac6d1b253af7a7786bf37a736b2486c77ef6 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 16 Feb 2015 17:48:42 -0800 Subject: [PATCH 05/22] add announcements and make the github api calls more robust --- controllers/resources.js | 58 ++++++++++++++---------------- controllers/resources.json | 5 +++ views/account/account.jade | 2 +- views/partials/navbar.jade | 2 +- views/partials/stats.jade | 9 ++--- views/resources/learn-to-code.jade | 10 ++++++ 6 files changed, 47 insertions(+), 39 deletions(-) diff --git a/controllers/resources.js b/controllers/resources.js index 28d432eefa..278d47a982 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -104,13 +104,15 @@ module.exports = { var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24)); var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 }; client.get('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(trello, res2) { - client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blogger, res5) { + trello = trello ? (JSON.parse(trello)).length : "Can't connecto to Trello"; + client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blog, res5) { + var blog = blog.length > 100 ? JSON.parse(blog) : ""; client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(pulls, res3) { pulls = Object.keys(JSON.parse(pulls)).length || "Can't connect to github"; client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(issues, res4) { - var nonprofitProjects = (JSON.parse(trello)).length || 27; - issues = Object.keys(JSON.parse(issues)).length - pulls || "Can't connect to github"; - var blog = JSON.parse(blogger); + issues = ((pulls === parseInt(pulls)) && issues) ? Object.keys(JSON.parse(issues)).length - pulls : "Can't connect to GitHub"; + var announcements = resources.announcements; + debug('here', announcements); User.count({'points': {'$gt': 2}}, function (err, c3) { if (err) { debug('User err: ', err); @@ -121,37 +123,31 @@ module.exports = { debug('User err: ', err); next(err); } - User.count({'points': {'$gt': 29}}, function (err, c30) { + User.count({'points': {'$gt': 53}}, function (err, all) { if (err) { debug('User err: ', err); next(err); } - User.count({'points': {'$gt': 53}}, function (err, all) { - if (err) { - debug('User err: ', err); - next(err); - } - res.render('resources/learn-to-code', { - title: 'About Free Code Camp and Our Team of Volunteers', - daysRunning: daysRunning, - nonprofitProjects: nonprofitProjects, - pulls: pulls, - issues: issues, - c3: c3, - c10: c10, - c30: c30, - all: all, - blog1Title: blog["items"][0]["title"], - blog1Link: blog["items"][0]["url"], - blog2Title: blog["items"][1]["title"], - blog2Link: blog["items"][1]["url"], - blog3Title: blog["items"][2]["title"], - blog3Link: blog["items"][2]["url"], - blog4Title: blog["items"][3]["title"], - blog4Link: blog["items"][3]["url"], - blog5Title: blog["items"][4]["title"], - blog5Link: blog["items"][4]["url"] - }); + res.render('resources/learn-to-code', { + title: 'About Free Code Camp and Our Team of Volunteers', + daysRunning: daysRunning, + nonprofitProjects: trello, + pulls: pulls, + issues: issues, + c3: c3, + c10: c10, + all: all, + blog1Title: blog ? blog["items"][0]["title"] : "Can't connect to Blogger", + blog1Link: blog ? blog["items"][0]["url"] : "http://blog.freecodecamp.com", + blog2Title: blog ? blog["items"][1]["title"] : "Can't connect to Blogger", + blog2Link: blog ? blog["items"][1]["url"] : "http://blog.freecodecamp.com", + blog3Title: blog ? blog["items"][2]["title"] : "Can't connect to Blogger", + blog3Link: blog ? blog["items"][2]["url"] : "http://blog.freecodecamp.com", + blog4Title: blog ? blog["items"][3]["title"] : "Can't connect to Blogger", + blog4Link: blog ? blog["items"][3]["url"] : "http://blog.freecodecamp.com", + blog5Title: blog ? blog["items"][4]["title"] : "Can't connect to Blogger", + blog5Link: blog ? blog["items"][4]["url"] : "http://blog.freecodecamp.com", + announcements: announcements }); }); }); diff --git a/controllers/resources.json b/controllers/resources.json index 1a7e038db6..2b70e46b58 100644 --- a/controllers/resources.json +++ b/controllers/resources.json @@ -1,4 +1,9 @@ { + "announcements": [ + ["Screen Hero is now free on Windows and Mac! Follow these special instructions to install it.", "http://freecodecamp.com/challenges/34"], + ["Bonfire is now live with 30+ challenges! If you haven't started CoderByte, do these instead.", "http://freecodecamp.com/bonfires"], + ["Once you finish all the challenges, come to our Nonprofit Project Office Hours every Monday and Thursday Night at 9 pm EST", "https://gitter.im/FreeCodeCamp/NonprofitProjects"] + ], "questions": [{ "question": "Time Complexity of Accessing Array Index (int a = ARR[5];)", "answer": "O(1)" diff --git a/views/account/account.jade b/views/account/account.jade index 8bff89c285..25a0c9c063 100644 --- a/views/account/account.jade +++ b/views/account/account.jade @@ -274,7 +274,7 @@ block content .col-xs-12 if (user.profile.username) a.btn.btn-lg.btn-block.btn-info.btn-link-social(href='/#{user.profile.username}') Check out my Public Profile - a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/') Take me to my current challenge + a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/challenges') Take me to my current challenge a.btn.btn-lg.btn-block.btn-warning.btn-link-social(href='/logout') Sign out br - if (!user.google || !user.facebook || /*!user.github ||*/ !user.linkedin || !user.twitter) diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index a8f9f3ce20..d57af2b098 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -13,7 +13,7 @@ a(href='/challenges/0') Challenges - else li - a(href='/') Challenges + a(href='/challenges') Challenges - if (!cc || (cc && cc[1] < 1)) li a(href='/challenges/1') Chat diff --git a/views/partials/stats.jade b/views/partials/stats.jade index 266366c25b..452ca3deae 100644 --- a/views/partials/stats.jade +++ b/views/partials/stats.jade @@ -6,17 +6,17 @@ h2.stats-text .col-xs-6.text-right Nonprofit Projects: .col-xs-6.text-left= nonprofitProjects |   - a(href="https://trello.com/b/BA3xVpz9/nonprofit-projects") (view) + a(href="https://trello.com/b/BA3xVpz9/nonprofit-projects") (view them) .row .col-xs-6.text-right Open Issues: .col-xs-6.text-left= issues |   - a(href="https://github.com/freecodecamp/freecodecamp/issues") (view) + a(href="https://github.com/freecodecamp/freecodecamp/issues") (create one) .row .col-xs-6.text-right Pull Requests: .col-xs-6.text-left= pulls |   - a(href="https://github.com/freecodecamp/freecodecamp/pulls") (view) + a(href="https://github.com/freecodecamp/freecodecamp/pulls") (create one) .row .col-xs-6.text-right Campers with at least... .col-xs-4 @@ -26,9 +26,6 @@ h2.stats-text .row .col-xs-6.text-right 10 Points: .col-xs-6.text-left= c10 - .row - .col-xs-6.text-right 30 Points: - .col-xs-6.text-left= c30 .row .col-xs-6.text-right All 54 Points: .col-xs-6.text-left= all diff --git a/views/resources/learn-to-code.jade b/views/resources/learn-to-code.jade index 9b09218e92..647d64498e 100644 --- a/views/resources/learn-to-code.jade +++ b/views/resources/learn-to-code.jade @@ -8,6 +8,16 @@ block content var challengeName = 'Learn to code' .row .col-xs-12.col-sm-12.col-md-6 + .panel.panel-info + .panel-heading.landing-panel-heading.text-center Announcements + .panel-body + .landing-panel-body.text-center + for announcement in announcements + h2 + if (announcement.length > 1) + a(href=announcement[1])= announcement[0] + else + = announcement[0] include ../partials/faq .col-xs-12.col-sm-12.col-md-6 .panel.panel-info From 03f8ddf6c06b6530343c1bf2e8117d46b0ba1926 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 16 Feb 2015 17:56:01 -0800 Subject: [PATCH 06/22] slight changes to announcements and remove errant debug statement. --- controllers/resources.js | 1 - controllers/resources.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/resources.js b/controllers/resources.js index 278d47a982..76212e52ca 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -112,7 +112,6 @@ module.exports = { client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(issues, res4) { issues = ((pulls === parseInt(pulls)) && issues) ? Object.keys(JSON.parse(issues)).length - pulls : "Can't connect to GitHub"; var announcements = resources.announcements; - debug('here', announcements); User.count({'points': {'$gt': 2}}, function (err, c3) { if (err) { debug('User err: ', err); diff --git a/controllers/resources.json b/controllers/resources.json index 2b70e46b58..588d00b428 100644 --- a/controllers/resources.json +++ b/controllers/resources.json @@ -2,7 +2,7 @@ "announcements": [ ["Screen Hero is now free on Windows and Mac! Follow these special instructions to install it.", "http://freecodecamp.com/challenges/34"], ["Bonfire is now live with 30+ challenges! If you haven't started CoderByte, do these instead.", "http://freecodecamp.com/bonfires"], - ["Once you finish all the challenges, come to our Nonprofit Project Office Hours every Monday and Thursday Night at 9 pm EST", "https://gitter.im/FreeCodeCamp/NonprofitProjects"] + ["Once you finish all the challenges, we welcome you to attend our Nonprofit Project Office Hours every Monday and Thursday Night at 9 pm EST.", "https://gitter.im/FreeCodeCamp/NonprofitProjects"] ], "questions": [{ "question": "Time Complexity of Accessing Array Index (int a = ARR[5];)", From 44ea0039f697ccf942b62bb6d80f03ffa50b39f0 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 16 Feb 2015 18:31:40 -0800 Subject: [PATCH 07/22] fix a button link issue --- views/resources/learn-to-code.jade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/resources/learn-to-code.jade b/views/resources/learn-to-code.jade index 647d64498e..75b36aa28b 100644 --- a/views/resources/learn-to-code.jade +++ b/views/resources/learn-to-code.jade @@ -2,7 +2,7 @@ extends ../layout-wide block content img.img-responsive.img-center(src='https://s3.amazonaws.com/freecodecamp/wide-social-banner.png') br - a.btn.btn-big.btn-block.btn-primary.next-challenge-button(href="/challenges/") Take me to my next challenge + a.btn.btn-big.btn-block.btn-primary.next-challenge-button(href="/challenges") Take me to my next challenge br script. var challengeName = 'Learn to code' @@ -21,7 +21,7 @@ block content include ../partials/faq .col-xs-12.col-sm-12.col-md-6 .panel.panel-info - .panel-heading.landing-panel-heading.text-center Stats + .panel-heading.landing-panel-heading.text-center Statistics .panel-body .landing-panel-body include ../partials/stats From 8e209d6bcaabe41065f21641df2762c18c8fb620 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Mon, 16 Feb 2015 23:35:02 -0800 Subject: [PATCH 08/22] start refactoring the learn-to-code view to use ajax --- app.js | 8 +++ controllers/resources.js | 105 ++++++++++++++++++++----------------- seed_data/coursewares.json | 88 ++++++++++++++++--------------- views/partials/blog.jade | 26 +++++---- views/partials/stats.jade | 72 ++++++++++++------------- 5 files changed, 161 insertions(+), 138 deletions(-) diff --git a/app.js b/app.js index f32d521677..1fb7d533f3 100644 --- a/app.js +++ b/app.js @@ -272,6 +272,14 @@ app.get( app.all('/account', passportConf.isAuthenticated); app.get('/account/api', userController.getAccountAngular); +/** + * API routes + */ + +app.get('/api/github', resourcesController.githubCalls); +app.get('/api/blogger', resourcesController.bloggerCalls); +app.get('/api/trello', resourcesController.trelloCalls); + /** * Bonfire related routes */ diff --git a/controllers/resources.js b/controllers/resources.js index 76212e52ca..468364e790 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -96,61 +96,68 @@ module.exports = { title: 'JavaScript in your Inbox' }); }, + githubCalls: function(req, res) { + var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 }; + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(pulls, res3) { + pulls = Object.keys(JSON.parse(pulls)).length || "Can't connect to github"; + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function (issues, res4) { + issues = ((pulls === parseInt(pulls)) && issues) ? Object.keys(JSON.parse(issues)).length - pulls : "Can't connect to GitHub"; + res.send({"issues": issues, "pulls" : pulls}); + }); + }); + }, + trelloCalls: function(req, res) { + client.get('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(trello, res2) { + trello = trello ? (JSON.parse(trello)).length : "Can't connecto to Trello"; + res.send({"trello": trello}); + }); + }, + bloggerCalls: function(req, res) { + client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blog, res5) { + var blog = blog.length > 100 ? JSON.parse(blog) : ""; + res.send({ + blog1Title: blog ? blog["items"][0]["title"] : "Can't connect to Blogger", + blog1Link: blog ? blog["items"][0]["url"] : "http://blog.freecodecamp.com", + blog2Title: blog ? blog["items"][1]["title"] : "Can't connect to Blogger", + blog2Link: blog ? blog["items"][1]["url"] : "http://blog.freecodecamp.com", + blog3Title: blog ? blog["items"][2]["title"] : "Can't connect to Blogger", + blog3Link: blog ? blog["items"][2]["url"] : "http://blog.freecodecamp.com", + blog4Title: blog ? blog["items"][3]["title"] : "Can't connect to Blogger", + blog4Link: blog ? blog["items"][3]["url"] : "http://blog.freecodecamp.com", + blog5Title: blog ? blog["items"][4]["title"] : "Can't connect to Blogger", + blog5Link: blog ? blog["items"][4]["url"] : "http://blog.freecodecamp.com" + }); + }); + }, about: function(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 githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 }; - client.get('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(trello, res2) { - trello = trello ? (JSON.parse(trello)).length : "Can't connecto to Trello"; - client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blog, res5) { - var blog = blog.length > 100 ? JSON.parse(blog) : ""; - client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(pulls, res3) { - pulls = Object.keys(JSON.parse(pulls)).length || "Can't connect to github"; - client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(issues, res4) { - issues = ((pulls === parseInt(pulls)) && issues) ? Object.keys(JSON.parse(issues)).length - pulls : "Can't connect to GitHub"; - var announcements = resources.announcements; - User.count({'points': {'$gt': 2}}, function (err, c3) { - if (err) { - debug('User err: ', err); - next(err); - } - User.count({'points': {'$gt': 9}}, function (err, c10) { - if (err) { - debug('User err: ', err); - next(err); - } - User.count({'points': {'$gt': 53}}, function (err, all) { - if (err) { - debug('User err: ', err); - next(err); - } - res.render('resources/learn-to-code', { - title: 'About Free Code Camp and Our Team of Volunteers', - daysRunning: daysRunning, - nonprofitProjects: trello, - pulls: pulls, - issues: issues, - c3: c3, - c10: c10, - all: all, - blog1Title: blog ? blog["items"][0]["title"] : "Can't connect to Blogger", - blog1Link: blog ? blog["items"][0]["url"] : "http://blog.freecodecamp.com", - blog2Title: blog ? blog["items"][1]["title"] : "Can't connect to Blogger", - blog2Link: blog ? blog["items"][1]["url"] : "http://blog.freecodecamp.com", - blog3Title: blog ? blog["items"][2]["title"] : "Can't connect to Blogger", - blog3Link: blog ? blog["items"][2]["url"] : "http://blog.freecodecamp.com", - blog4Title: blog ? blog["items"][3]["title"] : "Can't connect to Blogger", - blog4Link: blog ? blog["items"][3]["url"] : "http://blog.freecodecamp.com", - blog5Title: blog ? blog["items"][4]["title"] : "Can't connect to Blogger", - blog5Link: blog ? blog["items"][4]["url"] : "http://blog.freecodecamp.com", - announcements: announcements - }); - }); - }); - }); + var announcements = resources.announcements; + User.count({'points': {'$gt': 2}}, function (err, c3) { + if (err) { + debug('User err: ', err); + next(err); + } + User.count({'points': {'$gt': 9}}, function (err, c10) { + if (err) { + debug('User err: ', err); + next(err); + } + User.count({'points': {'$gt': 53}}, function (err, all) { + if (err) { + debug('User err: ', err); + next(err); + } + res.render('resources/learn-to-code', { + title: 'About Free Code Camp and Our Team of Volunteers', + daysRunning: daysRunning, + c3: c3, + c10: c10, + all: all, + announcements: announcements }); }); }); diff --git a/seed_data/coursewares.json b/seed_data/coursewares.json index 130b89d9d8..716f24acb2 100644 --- a/seed_data/coursewares.json +++ b/seed_data/coursewares.json @@ -1,45 +1,5 @@ [ - { - "_id" : "bd7123d8c441eddfaeb5bdef", - "name": "Learn how Free Code Camp Works", - "difficulty": 9.99, - "description": [ - "Watch this 90 second video, or simply read this summary:", - "Welcome to Free Code Camp. We're a community of busy people learning to code.", - "We built this community because learning to code is hard. But anyone who can stay motivated can learn to code. And the best way to stay motivated is to code with friends.", - "To maximize accessibility, all our challenges are self-paced, browser-based, and free.", - "All of us start with the same 100 hours of interactive coding challenges. These cover Computer Science and databases. They also cover in-demand JavaScript tools like jQuery, Node.js and MongoDB.", - "Once we have a basic understanding of web development, we'll spend another 900 hours putting that theory into practice. We'll build full stack solutions for nonprofits.", - "By the end of this process, we'll be good at coding. We'll have a portfolio of apps with happy users to prove it. We'll also have an alumni network of fellow coders and nonprofits ready to serve as references.", - "If you make it through Free Code Camp, you will be able to get a coding job. There are far more job openings out there than there are qualified coders to fill them.", - "Also, for every pure coding job, there are at least 5 additional jobs that require some coding skills. So even if you decide not to pursue coding as a career, you'll still walk away with a valuable job skill.", - "There are 3 keys to succeeding in our community: do the challenges, make friends, and find a routine.", - "Now it's time to join our chatroom. Click the \"Go to my next challenge\" button to move on to your next challenge." - ], - "tests": [ - "" - ], - "challengeSeed": [ - "114486344" - ], - "challengeType" : 2 - }, - { - "_id": "bd7123c8c441eddfaeb5bdef", - "name": "Meet Booleans", - "difficulty": "9.999", - "description": [ - "Return true" - ], - "tests": [ - "expect(welcomeToBooleans()).to.be.a(\"boolean\");", - "expect(welcomeToBooleans()).to.be.true;" - ], - "challengeSeed": [ - "function welcomeToBooleans() {\n // Good luck!\n return false;\n}\n\nwelcomeToBooleans();" - ], - "challengeType": 1 - }, + { "_id" : "bd7123c8c441eddfaeb5bdef", "name": "Start our Challenges", @@ -1323,7 +1283,7 @@ }, { - "_id" : "bad87fee1348cd8acef08812", + "_id" : "bae87fee1348cd8acef08812", "name": "Color a Bootstrap Button with Button Primary", "difficulty" : "0.38", "description": [ @@ -1332,7 +1292,8 @@ "Note that these buttons still need the btn class." ], "tests": [ - "expect($('.btn-block').length).to.eql(2);" + "expect($('.btn-block').length).to.eql(2);", + "expect($('.btn-primary').length).to.eql(2);" ], "challengeSeed": [ "