merge master in ux-improvements
This commit is contained in:
2
app.js
2
app.js
@ -401,6 +401,8 @@ app.get('/account/api', userController.getAccountAngular);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
app.get('/api/github', resourcesController.githubCalls);
|
app.get('/api/github', resourcesController.githubCalls);
|
||||||
|
app.get('/api/blogger', resourcesController.bloggerCalls);
|
||||||
|
app.get('/api/trello', resourcesController.trelloCalls);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bonfire related routes
|
* Bonfire related routes
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
var _ = require('lodash'),
|
var _ = require('lodash'),
|
||||||
|
<<<<<<< HEAD
|
||||||
debug = require('debug')('freecc:cntr:bonfires'),
|
debug = require('debug')('freecc:cntr:bonfires'),
|
||||||
Bonfire = require('./../models/Bonfire'),
|
Bonfire = require('./../models/Bonfire'),
|
||||||
User = require('./../models/User'),
|
User = require('./../models/User'),
|
||||||
resources = require('./resources'),
|
resources = require('./resources'),
|
||||||
R = require('ramda');
|
R = require('ramda');
|
||||||
|
=======
|
||||||
|
debug = require('debug')('freecc:cntr:bonfires'),
|
||||||
|
Bonfire = require('./../models/Bonfire'),
|
||||||
|
User = require('./../models/User'),
|
||||||
|
resources = require('./resources'),
|
||||||
|
MDNlinks = require('./../seed_data/bonfireMDNlinks');
|
||||||
|
>>>>>>> upstream/master
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bonfire controller
|
* Bonfire controller
|
||||||
@ -95,11 +103,33 @@ exports.returnIndividualBonfire = function(req, res, next) {
|
|||||||
return res.redirect('/bonfires');
|
return res.redirect('/bonfires');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
bonfire = bonfire.pop();
|
bonfire = bonfire.pop();
|
||||||
var dashedNameFull = bonfire.name.toLowerCase().replace(/\s/g, '-');
|
var dashedNameFull = bonfire.name.toLowerCase().replace(/\s/g, '-');
|
||||||
if (dashedNameFull != dashedName) {
|
if (dashedNameFull != dashedName) {
|
||||||
return res.redirect('../bonfires/' + dashedNameFull);
|
return res.redirect('../bonfires/' + dashedNameFull);
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
res.render('bonfire/show', {
|
||||||
|
completedWith: null,
|
||||||
|
title: bonfire.name,
|
||||||
|
dashedName: dashedName,
|
||||||
|
name: bonfire.name,
|
||||||
|
difficulty: Math.floor(+bonfire.difficulty),
|
||||||
|
brief: bonfire.description[0],
|
||||||
|
details: bonfire.description.slice(1),
|
||||||
|
tests: bonfire.tests,
|
||||||
|
challengeSeed: bonfire.challengeSeed,
|
||||||
|
cc: !!req.user,
|
||||||
|
points: req.user ? req.user.points : undefined,
|
||||||
|
verb: resources.randomVerb(),
|
||||||
|
phrase: resources.randomPhrase(),
|
||||||
|
compliment: resources.randomCompliment(),
|
||||||
|
bonfires: bonfire,
|
||||||
|
bonfireHash: bonfire._id,
|
||||||
|
MDNkeys: bonfire.MDNlinks,
|
||||||
|
MDNlinks: getMDNlinks(bonfire.MDNlinks)
|
||||||
|
>>>>>>> upstream/master
|
||||||
|
|
||||||
res.render('bonfire/show', {
|
res.render('bonfire/show', {
|
||||||
completedWith: null,
|
completedWith: null,
|
||||||
@ -157,6 +187,23 @@ function randomString() {
|
|||||||
return randomstring;
|
return randomstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to populate the MDN links array.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getMDNlinks(links) {
|
||||||
|
// takes in an array of links, which are strings
|
||||||
|
var populatedLinks = [];
|
||||||
|
|
||||||
|
// for each key value, push the corresponding link from the MDNlinks object into a new array
|
||||||
|
links.forEach(function(value, index) {
|
||||||
|
populatedLinks.push(MDNlinks[value]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return populatedLinks;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -161,6 +161,21 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
trelloCalls: function(req, res, next) {
|
||||||
|
request('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(err, status, trello) {
|
||||||
|
if (err) { return next(err); }
|
||||||
|
trello = (status && status.statusCode === 200) ? (JSON.parse(trello)) : "Can't connect to to Trello";
|
||||||
|
res.end(JSON.stringify(trello));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
bloggerCalls: function(req, res, next) {
|
||||||
|
request('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (err, status, blog) {
|
||||||
|
if (err) { return next(err); }
|
||||||
|
blog = (status && status.statusCode === 200) ? JSON.parse(blog) : "Can't connect to Blogger";
|
||||||
|
res.end(JSON.stringify(blog));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
about: function(req, res, next) {
|
about: function(req, res, next) {
|
||||||
if (req.user) {
|
if (req.user) {
|
||||||
if (!req.user.profile.picture || req.user.profile.picture === "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png") {
|
if (!req.user.profile.picture || req.user.profile.picture === "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png") {
|
||||||
@ -168,54 +183,8 @@ module.exports = {
|
|||||||
req.user.save();
|
req.user.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var date1 = new Date('10/15/2014');
|
var date1 = new Date("10/15/2014");
|
||||||
var date2 = new Date();
|
var date2 = new Date();
|
||||||
var progressTimestamps = req.user.progressTimestamps;
|
|
||||||
var now = Date.now() || 0;
|
|
||||||
|
|
||||||
if (req.user.pointsNeedMigration) {
|
|
||||||
var challengesHash = req.user.challengesHash;
|
|
||||||
for (var key in challengesHash) {
|
|
||||||
if (challengesHash[key] > 0) {
|
|
||||||
req.user.progressTimestamps.push(challengesHash[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var oldChallengeKeys = R.keys(req.user.challengesHash);
|
|
||||||
|
|
||||||
var updatedTimesFromOldChallenges = oldChallengeKeys.map(function(timeStamp) {
|
|
||||||
if (timeStamp.toString().length !== 13) {
|
|
||||||
timeStamp *= 1000;
|
|
||||||
}
|
|
||||||
return timeStamp;
|
|
||||||
});
|
|
||||||
|
|
||||||
var newTimeStamps = R.map(function(timeStamp) {
|
|
||||||
if (timeStamp.toString().length !== 13) {
|
|
||||||
timeStamp *= 1000;
|
|
||||||
}
|
|
||||||
return timeStamp;
|
|
||||||
}, req.user.progressTimestamps);
|
|
||||||
|
|
||||||
req.user.progressTimestamps = newTimeStamps;
|
|
||||||
|
|
||||||
|
|
||||||
req.user.completedCoursewares = Array.zip(updatedTimesFromOldChallenges, coursewares,
|
|
||||||
function(left, right) {
|
|
||||||
return ({
|
|
||||||
completedDate: left.timeStamp,
|
|
||||||
_id: right._id,
|
|
||||||
name: right.name
|
|
||||||
});
|
|
||||||
}).filter(function(elem) {
|
|
||||||
return elem.completedDate !== 0;
|
|
||||||
});
|
|
||||||
req.user.pointsNeedMigration = false;
|
|
||||||
req.user.save();
|
|
||||||
}
|
|
||||||
if (progressTimestamps[progressTimestamps.length - 1] <= (now - 43200)) {
|
|
||||||
req.user.progressTimestamps.push(now);
|
|
||||||
}
|
|
||||||
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
|
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
|
||||||
var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
||||||
var announcements = resources.announcements;
|
var announcements = resources.announcements;
|
||||||
@ -244,6 +213,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
randomPhrase: function() {
|
randomPhrase: function() {
|
||||||
var phrases = resources.phrases;
|
var phrases = resources.phrases;
|
||||||
return phrases[Math.floor(Math.random() * phrases.length)];
|
return phrases[Math.floor(Math.random() * phrases.length)];
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"announcements": [
|
"announcements": [
|
||||||
["We'll live-stream our Camp-wide Meeting Saturday, March 27 at Noon EST. We'll show some of Free Code Camp's new features, and campers will show what they're building.", "http://twitch.tv/freecodecamp"],
|
|
||||||
["Some of Code School's courses are no longer free. We're switching to NodeSchool.io for our Node.js and Express.js challenges.", "http://freecodecamp.com/nodeschool-challenges"],
|
["Some of Code School's courses are no longer free. We're switching to NodeSchool.io for our Node.js and Express.js challenges.", "http://freecodecamp.com/nodeschool-challenges"],
|
||||||
["Screen Hero is now free on Windows and Mac! Follow these special instructions to install it.", "http://freecodecamp.com/install-screenhero"]
|
["Screen Hero is now free on Windows and Mac! Follow these special instructions to install it.", "http://freecodecamp.com/install-screenhero"]
|
||||||
],
|
],
|
||||||
|
@ -15,7 +15,8 @@ var bonfireSchema = new mongoose.Schema({
|
|||||||
difficulty: String,
|
difficulty: String,
|
||||||
description: Array,
|
description: Array,
|
||||||
tests: Array,
|
tests: Array,
|
||||||
challengeSeed: String
|
challengeSeed: String,
|
||||||
|
MDNlinks: [String]
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = mongoose.model('Bonfire', bonfireSchema);
|
module.exports = mongoose.model('Bonfire', bonfireSchema);
|
||||||
|
66
seed_data/bonfireMDNlinks.js
Normal file
66
seed_data/bonfireMDNlinks.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// MDN Links
|
||||||
|
|
||||||
|
/* These links are for Bonfires. Each key/value pair is used to render a Bonfire with approrpiate links.
|
||||||
|
|
||||||
|
|
||||||
|
The text of the key is what the link text will be, e.g. <a href="https://developer ...">Global Array Object</a>
|
||||||
|
General convention is to use the page title of the MDN reference page.
|
||||||
|
*/
|
||||||
|
var links =
|
||||||
|
{
|
||||||
|
// ========= GLOBAL OBJECTS
|
||||||
|
"Global Array Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||||
|
"Global Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
|
||||||
|
"Global String Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||||
|
"Boolean Objects" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
|
||||||
|
|
||||||
|
// ========= PROPERTIES/MISC
|
||||||
|
"String.length" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length",
|
||||||
|
"Arguments object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments",
|
||||||
|
|
||||||
|
// ========== OBJECT METHODS
|
||||||
|
"Object.getOwnPropertyNames()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames",
|
||||||
|
"Object.keys()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys",
|
||||||
|
"Object.hasOwnProperty()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty",
|
||||||
|
|
||||||
|
|
||||||
|
// ======== STRING METHODS
|
||||||
|
"String.charAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt",
|
||||||
|
"String.charCodeAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt",
|
||||||
|
"String.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat",
|
||||||
|
"String.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf",
|
||||||
|
"String.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf",
|
||||||
|
"String.match()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match",
|
||||||
|
"String.replace()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace",
|
||||||
|
"String.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice",
|
||||||
|
"String.split()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split",
|
||||||
|
"String.substring()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring",
|
||||||
|
"String.substr()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr",
|
||||||
|
"String.toLowerCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase",
|
||||||
|
"String.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString",
|
||||||
|
"String.toUpperCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase",
|
||||||
|
// ======== ARRAY METHODS
|
||||||
|
"Array.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat",
|
||||||
|
"Array.every()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every",
|
||||||
|
"Array.filter()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter",
|
||||||
|
"Array.forEach()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach",
|
||||||
|
"Array.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf",
|
||||||
|
"Array.join()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join",
|
||||||
|
"Array.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf",
|
||||||
|
"Array.map()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map",
|
||||||
|
"Array.pop()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop",
|
||||||
|
"Array.push()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push",
|
||||||
|
"Array.reduce()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce",
|
||||||
|
"Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse",
|
||||||
|
"Array.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice",
|
||||||
|
"Array.some()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some",
|
||||||
|
"Array.sort()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort",
|
||||||
|
"Array.splice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice",
|
||||||
|
"Array.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString",
|
||||||
|
|
||||||
|
// ======== GENERAL JAVASCRIPT REFERENCES
|
||||||
|
"Arithmetic Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators",
|
||||||
|
"Comparison Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators"
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = links;
|
@ -31,7 +31,8 @@
|
|||||||
"You may need to turn the string into an array before you can reverse it.",
|
"You may need to turn the string into an array before you can reverse it.",
|
||||||
"Your result must be a string."
|
"Your result must be a string."
|
||||||
],
|
],
|
||||||
"challengeSeed": "function reverseString(str) {\n return str;\r\n}\n\nreverseString('hello');"
|
"challengeSeed": "function reverseString(str) {\n return str;\r\n}\n\nreverseString('hello');",
|
||||||
|
"MDNlinks" : ["Global String Object", "String.split()", "Array.reverse()", "Array.join()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a302f7aae1aa3152a5b413bc",
|
"_id": "a302f7aae1aa3152a5b413bc",
|
||||||
@ -49,7 +50,8 @@
|
|||||||
"Factorials are often represented with the shorthand notation n!",
|
"Factorials are often represented with the shorthand notation n!",
|
||||||
"For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f"
|
"For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f"
|
||||||
],
|
],
|
||||||
"challengeSeed": "function factorialize(num) {\n return num;\r\n}\n\nfactorialize(5);"
|
"challengeSeed": "function factorialize(num) {\n return num;\r\n}\n\nfactorialize(5);",
|
||||||
|
"MDNlinks" : ["Arithmetic Operators"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "aaa48de84e1ecc7c742e1124",
|
"_id": "aaa48de84e1ecc7c742e1124",
|
||||||
@ -70,7 +72,8 @@
|
|||||||
"assert.deepEqual(palindrome(\"never odd or even\"), true);",
|
"assert.deepEqual(palindrome(\"never odd or even\"), true);",
|
||||||
"assert.deepEqual(palindrome(\"nope\"), false);"
|
"assert.deepEqual(palindrome(\"nope\"), false);"
|
||||||
],
|
],
|
||||||
"challengeSeed": "function palindrome(str) {\n // Good luck!\n return true;\n}\n\n\n\npalindrome(\"eye\");"
|
"challengeSeed": "function palindrome(str) {\n // Good luck!\n return true;\n}\n\n\n\npalindrome(\"eye\");",
|
||||||
|
"MDNlinks" : ["String.replace()", "String.toLowerCase()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a26cbbe9ad8655a977e1ceb5",
|
"_id": "a26cbbe9ad8655a977e1ceb5",
|
||||||
@ -87,7 +90,8 @@
|
|||||||
"expect(findLongestWord('May the force be with you')).to.equal(5);",
|
"expect(findLongestWord('May the force be with you')).to.equal(5);",
|
||||||
"expect(findLongestWord('Google do a barrel roll')).to.equal(6);",
|
"expect(findLongestWord('Google do a barrel roll')).to.equal(6);",
|
||||||
"expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);"
|
"expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.split()", "String.length"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "ab6137d4e35944e21037b769",
|
"_id": "ab6137d4e35944e21037b769",
|
||||||
@ -103,7 +107,8 @@
|
|||||||
"expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");",
|
"expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");",
|
||||||
"expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");",
|
"expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");",
|
||||||
"expect(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");"
|
"expect(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.charAt()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a789b3483989747d63b0e427",
|
"_id": "a789b3483989747d63b0e427",
|
||||||
@ -119,7 +124,8 @@
|
|||||||
"expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');",
|
"expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');",
|
||||||
"(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);",
|
"(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);",
|
||||||
"assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));"
|
"assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Comparison Operators"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "acda2fb1324d9b0fa741e6b5",
|
"_id": "acda2fb1324d9b0fa741e6b5",
|
||||||
@ -134,7 +140,8 @@
|
|||||||
"assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');",
|
"assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');",
|
||||||
"assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string');",
|
"assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string');",
|
||||||
"assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string');"
|
"assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.substr()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "afcc8d540bea9ea2669306b6",
|
"_id": "afcc8d540bea9ea2669306b6",
|
||||||
@ -148,7 +155,8 @@
|
|||||||
"assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');",
|
"assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');",
|
||||||
"assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');",
|
"assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');",
|
||||||
"assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');"
|
"assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Global String Object"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "ac6993d51946422351508a41",
|
"_id": "ac6993d51946422351508a41",
|
||||||
@ -163,7 +171,8 @@
|
|||||||
"expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');",
|
"expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');",
|
||||||
"assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');",
|
"assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');",
|
||||||
"assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');"
|
"assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["String.slice()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a9bd25c716030ec90084d8a1",
|
"_id": "a9bd25c716030ec90084d8a1",
|
||||||
@ -177,7 +186,8 @@
|
|||||||
"assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');",
|
"assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');",
|
||||||
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
|
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
|
||||||
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');"
|
"assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.push()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "ab31c21b530c0dafa9e241ee",
|
"_id": "ab31c21b530c0dafa9e241ee",
|
||||||
@ -191,7 +201,8 @@
|
|||||||
"assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');",
|
"assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');",
|
||||||
"assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements when n < 1');",
|
"assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements when n < 1');",
|
||||||
"assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array when n >= array.length');"
|
"assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array when n >= array.length');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.slice()", "Array.splice()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "af2170cad53daa0770fabdea",
|
"_id": "af2170cad53daa0770fabdea",
|
||||||
@ -210,7 +221,8 @@
|
|||||||
"expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;",
|
"expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;",
|
||||||
"expect(mutation(['Mary', 'Army'])).to.be.true;",
|
"expect(mutation(['Mary', 'Army'])).to.be.true;",
|
||||||
"expect(mutation(['Alien', 'line'])).to.be.true;"
|
"expect(mutation(['Alien', 'line'])).to.be.true;"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.sort()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "adf08ec01beb4f99fc7a68f2",
|
"_id": "adf08ec01beb4f99fc7a68f2",
|
||||||
@ -225,7 +237,8 @@
|
|||||||
"assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');",
|
"assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');",
|
||||||
"assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');",
|
"assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');",
|
||||||
"assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');"
|
"assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Boolean Objects", "Array.filter()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id":"a8e512fbe388ac2f9198f0fa",
|
"_id":"a8e512fbe388ac2f9198f0fa",
|
||||||
@ -238,7 +251,8 @@
|
|||||||
"tests":[
|
"tests":[
|
||||||
"assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');",
|
"assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');",
|
||||||
"assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');"
|
"assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Global Object", "Object.hasOwnProperty()", "Object.keys()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id":"a39963a4c10bc8b4d4f06d7e",
|
"_id":"a39963a4c10bc8b4d4f06d7e",
|
||||||
@ -251,7 +265,8 @@
|
|||||||
"tests": [
|
"tests": [
|
||||||
"assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');",
|
"assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');",
|
||||||
"assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');"
|
"assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');"
|
||||||
]
|
],
|
||||||
|
"MDNlinks" : ["Array.filter()"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": "a24c1a4622e3c05097f71d67",
|
"_id": "a24c1a4622e3c05097f71d67",
|
||||||
|
@ -73,9 +73,14 @@ block content
|
|||||||
.col-xs-12
|
.col-xs-12
|
||||||
for sentence in details
|
for sentence in details
|
||||||
p!= sentence
|
p!= sentence
|
||||||
|
#MDN-links
|
||||||
|
h4 Here are some helpful links.
|
||||||
|
for link, index in MDNlinks
|
||||||
|
ul: li: a(href=""+link, target="_blank") !{MDNkeys[index]}
|
||||||
#less-info.btn.btn-primary.btn-block.btn-primary-ghost
|
#less-info.btn.btn-primary.btn-block.btn-primary-ghost
|
||||||
span.ion-arrow-up-b
|
span.ion-arrow-up-b
|
||||||
| Less information
|
| Less information
|
||||||
|
|
||||||
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
||||||
#showAllButton.btn.btn-info.btn-big.btn-block Show all bonfires
|
#showAllButton.btn.btn-info.btn-big.btn-block Show all bonfires
|
||||||
br
|
br
|
||||||
@ -93,6 +98,7 @@ block content
|
|||||||
var started = Math.floor(Date.now());
|
var started = Math.floor(Date.now());
|
||||||
var _ = R;
|
var _ = R;
|
||||||
var dashed = !{JSON.stringify(dashedName)};
|
var dashed = !{JSON.stringify(dashedName)};
|
||||||
|
|
||||||
.col-xs-12.col-sm-12.col-md-8
|
.col-xs-12.col-sm-12.col-md-8
|
||||||
#mainEditorPanel
|
#mainEditorPanel
|
||||||
form.code
|
form.code
|
||||||
@ -140,3 +146,19 @@ block content
|
|||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
.modal-body
|
.modal-body
|
||||||
include ../partials/bonfires
|
include ../partials/bonfires
|
||||||
|
|
||||||
|
script.
|
||||||
|
$.ajax({
|
||||||
|
url: 'https://api-ssl.bitly.com/v3/shorten?access_token=75e7931a19befaafcf108021b6d597e554b2c5c3&longUrl=http%3A%2F%2Ffreecodecamp.com%2Fbonfires%2F' + dashed + '&format=txt'
|
||||||
|
})
|
||||||
|
.success(
|
||||||
|
function (data) {
|
||||||
|
console.log(data);
|
||||||
|
url = "https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Bonfire:%20#{name}&url=" + data + "&hashtags=LearnToCode, JavaScript";
|
||||||
|
$('.btn-twitter').attr('href', url);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||||
|
if (!MDNlinks.length) {
|
||||||
|
$('#MDN-links').addClass('collapse');
|
||||||
|
}
|
||||||
|
@ -78,21 +78,21 @@ block content
|
|||||||
<iframe src="http://ghbtns.com/github-btn.html?user=freecodecamp&repo=freecodecamp&type=watch&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe>
|
<iframe src="http://ghbtns.com/github-btn.html?user=freecodecamp&repo=freecodecamp&type=watch&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe>
|
||||||
.col-xs-12.col-sm-12.col-md-6
|
.col-xs-12.col-sm-12.col-md-6
|
||||||
include ../partials/faq
|
include ../partials/faq
|
||||||
#announcementModal.modal(tabindex='-1')
|
//#announcementModal.modal(tabindex='-1')
|
||||||
.modal-dialog
|
// .modal-dialog
|
||||||
.modal-content
|
// .modal-content
|
||||||
.modal-header.challenge-list-header Camp-wide Meeting on Saturday at Noon EST
|
// .modal-header.challenge-list-header Camp-wide Meeting on Saturday at Noon EST
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
// a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
.modal-body
|
// .modal-body
|
||||||
h3.text-left We'll live-stream some of Free Code Camp's new features, and campers will show what they're building. Live Saturday, March 28 at Noon EST on our  
|
// h3.text-left We'll live-stream some of Free Code Camp's new features, and campers will show what they're building. Live Saturday, March 28 at Noon EST on our  
|
||||||
a(href='http://twitch.tv/freecodecamp', target='_blank') Twitch.tv channel
|
// a(href='http://twitch.tv/freecodecamp', target='_blank') Twitch.tv channel
|
||||||
| .
|
// | .
|
||||||
a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://twitch.tv/freecodecamp', target='_blank') Take me to Twitch so I can follow Free Code Camp
|
// a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://twitch.tv/freecodecamp', target='_blank') Take me to Twitch so I can follow Free Code Camp
|
||||||
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up!
|
// a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up!
|
||||||
script.
|
//script.
|
||||||
$(document).ready(function() {
|
// $(document).ready(function() {
|
||||||
if (!localStorage || !localStorage.campWideMeeting) {
|
// if (!localStorage || !localStorage.campWideMeeting) {
|
||||||
$('#announcementModal').modal('show');
|
// $('#announcementModal').modal('show');
|
||||||
localStorage.campWideMeeting = "true";
|
// localStorage.campWideMeeting = "true";
|
||||||
}
|
// }
|
||||||
});
|
// });
|
Reference in New Issue
Block a user