From 817276ab9623c1f92abbf94353f41fafdbb8a7ff Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 17 Aug 2015 02:18:27 +0530 Subject: [PATCH 001/538] Added test cases for Bonfire: Where do I belong Checks for proper positioning of element based on proper sorting order. --- seed/challenges/basic-bonfires.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 6f1cf7b9d4..1712f90492 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -664,7 +664,11 @@ ], "tests": [ "expect(where([10, 20, 30, 40, 50], 35)).to.equal(3);", - "expect(where([10, 20, 30, 40, 50], 30)).to.equal(2);" + "expect(where([10, 20, 30, 40, 50], 30)).to.equal(2);", + "expect(where([40, 60], 50)).to.equal(1);", + "expect(where([5, 3, 20, 3], 3)).to.equal(0);", + "expect(where([2, 20, 10], 1)).to.equal(0);", + "expect(where([2, 5, 10], 15)).to.equal(3);" ], "type": "bonfire", "challengeType": 5, From b4afc3430a0c364242fc1399fcf2e64b1bf53e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADnez?= Date: Sun, 16 Aug 2015 21:11:36 +0000 Subject: [PATCH 002/538] Fixed #1090 --- seed/challenges/html5-and-css.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index 4d4ae95cad..e25c317578 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -867,8 +867,8 @@ "tests": [ "assert($(\"img\").hasClass(\"smaller-image\"), 'Your img element should have the class smaller-image.')", "assert($(\"img\").hasClass(\"thick-green-border\"), 'Your img element should have the class thick-green-border.')", - "assert($(\"img\").hasClass(\"thick-green-border\") && parseInt($(\"img\").css(\"border-top-width\")), 'Give your image a border width of 10px.')", - "assert(new RegExp(\"solid\", \"gi\").test(editor), 'Give your image a border style of solid.')", + "assert($(\"img\").hasClass(\"thick-green-border\") && parseInt($(\"img\").css(\"border-top-width\"), 10) === 10, 'Give your image a border width of 10px.')", + "assert($(\"img\").css(\"border-right-style\") === \"solid\", 'Give your image a border style of solid.')", "assert($(\"img\").css(\"border-left-color\") === \"rgb(0, 128, 0)\", 'The border around your img element should be green.')" ], "challengeSeed": [ From 2fade59319e08b26941261ecbbbd7206b0fe23e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADnez?= Date: Mon, 17 Aug 2015 16:01:51 +0000 Subject: [PATCH 003/538] Changed test case for Waypoint: target elements by id --- seed/challenges/jquery.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/jquery.json b/seed/challenges/jquery.json index f2dfcb08e1..cd059066b1 100644 --- a/seed/challenges/jquery.json +++ b/seed/challenges/jquery.json @@ -161,7 +161,7 @@ ], "tests": [ "assert($(\"#target3\").hasClass(\"animated\"), 'Select the buttonelement with the id of target3 and use the jQuery addClass() function to give it the class of animated.');", - "assert($(\"#target3\").hasClass(\"fadeOut\") || $(\"#target3\").hasClass(\"fadeout\"), 'Target the element with the id target3 and use the jQuery addClass() function to give it the class fadeOut.')", + "assert(($(\"#target3\").hasClass(\"fadeOut\") || $(\"#target3\").hasClass(\"fadeout\")) && editor.match(/\\$\\(.#target3.\\)/g), 'Target the element with the id target3 and use the jQuery addClass() function to give it the class fadeOut.');", "assert(!editor.match(/class.*animated/g), 'Only use jQuery to add these classes to the element.')" ], "challengeSeed": [ From 8e705b14ecd649f62eae6d862bf97b3f2783efcd Mon Sep 17 00:00:00 2001 From: Ionut Costica Date: Wed, 19 Aug 2015 15:43:39 +0300 Subject: [PATCH 004/538] Fix for Issue #2179, #2141, #2077, #1999 Fixes #2179, #2141, #2077, #1999 --- seed/challenges/basic-javascript.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 1096e02868..de249f003a 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -16,9 +16,9 @@ "Try creating one of each." ], "tests":[ - "assert(editor.getValue().match(/(\\/\\/)...../g), 'Create a \\/\\/ style comment that contains at least five letters');", - "assert(editor.getValue().match(/(\\/\\*)...../g), 'Create a \/\\* \\*\/ style comment that contains at least five letters.');", - "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the comment with a \\*\/');" + "assert(editor.getValue().match(/(\\/\\/)...../g), 'Create a // style comment that contains at least five letters');", + "assert(editor.getValue().match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'Create a /* */ style comment that contains at least five letters.');", + "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the comment with a */');" ], "challengeSeed":[ ], From 23139ff45fbe0a936fff2d8d9e927b1fb3bce5c4 Mon Sep 17 00:00:00 2001 From: Mark Surnin Date: Thu, 20 Aug 2015 12:01:38 +0500 Subject: [PATCH 005/538] Added a test for factorial(0) to be equal to 1. --- seed/challenges/basic-bonfires.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 6f1cf7b9d4..84f92e15dd 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -90,7 +90,8 @@ "expect(factorialize(5)).to.be.a(\"Number\");", "expect(factorialize(5)).to.equal(120);", "expect(factorialize(10)).to.equal(3628800);", - "expect(factorialize(20)).to.equal(2432902008176640000);" + "expect(factorialize(20)).to.equal(2432902008176640000);", + "expect(factorialize(0)).to.equal(1);" ], "difficulty": "1.02", "description": [ From 636e16d5221fb59414875a89dffcdd4417a47cd3 Mon Sep 17 00:00:00 2001 From: Ionut Costica Date: Fri, 21 Aug 2015 15:18:40 +0300 Subject: [PATCH 006/538] [Waypoint: Remove Classes from an element with jQuery] usually expected to not validate if using removeClass() without parameters Added extra test to the waypoint to check if `.removeClass` was used with the `"btn-default"` parameter as most people expect to have to do (and are confused when the code validates before they've finished writing their function, as seen by the myriad of issues opened about it). Closes #2302 Closes #2402 Closes #2301 Closes #2197 Closes #2160 Closes #1923 Closes #1898 --- seed/challenges/jquery.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seed/challenges/jquery.json b/seed/challenges/jquery.json index aecaf645a6..99a8984a85 100644 --- a/seed/challenges/jquery.json +++ b/seed/challenges/jquery.json @@ -314,7 +314,8 @@ ], "tests": [ "assert($(\".btn-default\").length === 0, 'Remove the btn-default class from all of your button elements.')", - "assert(editor.match(/btn btn-default/g), 'Only use jQuery to remove this class from the element.')" + "assert(editor.match(/btn btn-default/g), 'Only use jQuery to remove this class from the element.')", + "assert(editor.match(/\\.[\\v\\s]*removeClass[\\s\\v]*\\([\\s\\v]*('|\")\\s*btn-default\\s*('|\")[\\s\\v]*\\)/gm), 'Only remove the btn-default class.'" ], "challengeSeed": [ "fccss", From 0132a1afcae227ea80934ae61e64e0c7d2c81bc5 Mon Sep 17 00:00:00 2001 From: Jakob Dahl Date: Fri, 21 Aug 2015 17:45:30 +0200 Subject: [PATCH 007/538] 2324 for id attributes to be under relevant parents --- seed/challenges/bootstrap.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/seed/challenges/bootstrap.json b/seed/challenges/bootstrap.json index da7a510236..a447d6bffa 100644 --- a/seed/challenges/bootstrap.json +++ b/seed/challenges/bootstrap.json @@ -1949,8 +1949,8 @@ "Give the well on the left the id of left-well. Give the well on the right the id of right-well." ], "tests": [ - "assert($(\"#left-well\") && $(\"#left-well\").length > 0, 'Give your left well the id of left-well.')", - "assert($(\"#right-well\") && $(\"#right-well\").length > 0, 'Give your right well the id of right-well.')" + "assert($(\".col-xs-6\").children(\"#left-well\") && $(\".col-xs-6\").children(\"#left-well\").length > 0, 'Give your left well the id of left-well.')", + "assert($(\".col-xs-6\").children(\"#right-well\") && $(\".col-xs-6\").children(\"#right-well\").length > 0, 'Give your right well the id of right-well.')" ], "challengeSeed": [ "
", @@ -2046,12 +2046,12 @@ "Give each of your buttons a unique id like, starting with target1 and ending with target6." ], "tests": [ - "assert($(\"#target1\") && $(\"#target1\").length > 0, 'One button element should have the id target1.')", - "assert($(\"#target2\") && $(\"#target2\").length > 0, 'One button element should have the id target2.')", - "assert($(\"#target3\") && $(\"#target3\").length > 0, 'One button element should have the id target3.')", - "assert($(\"#target4\") && $(\"#target4\").length > 0, 'One button element should have the id target4.')", - "assert($(\"#target5\") && $(\"#target5\").length > 0, 'One button element should have the id target5.')", - "assert($(\"#target6\") && $(\"#target6\").length > 0, 'One button element should have the id target6.')" + "assert($(\"#left-well\").children(\"#target1\") && $(\"#left-well\").children(\"#target1\").length > 0, 'One button element should have the id target1.')", + "assert($(\"#left-well\").children(\"#target2\") && $(\"#left-well\").children(\"#target2\").length > 0, 'One button element should have the id target2.')", + "assert($(\"#left-well\").children(\"#target3\") && $(\"#left-well\").children(\"#target3\").length > 0, 'One button element should have the id target3.')", + "assert($(\"#right-well\").children(\"#target4\") && $(\"#right-well\").children(\"#target4\").length > 0, 'One button element should have the id target4.')", + "assert($(\"#right-well\").children(\"#target5\") && $(\"#right-well\").children(\"#target5\").length > 0, 'One button element should have the id target5.')", + "assert($(\"#right-well\").children(\"#target6\") && $(\"#right-well\").children(\"#target6\").length > 0, 'One button element should have the id target6.')" ], "challengeSeed": [ "
", From c5c68c252c4980b9b0489874a8b44500960533c8 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 22 Aug 2015 19:05:41 +0530 Subject: [PATCH 008/538] Correct Sift through Text with Regular Expressions - Change information text - Change regular expression - Change code in editor - Change assertion --- seed/challenges/basic-javascript.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index ac835890ea..82e1dfb639 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -999,18 +999,17 @@ "difficulty":"9.984", "description":[ "Regular expressions are used to find certain words or patterns inside of strings.", - "For example, if we wanted to find the number of times the word the occurred in the string The dog chased the cat, we could use the following regular expression: \/the+\/gi", + "For example, if we wanted to find the word the in the string The dog chased the cat, we could use the following regular expression: \/the\/gi", "Let's break this down a bit:", "the is the pattern we want to match.", - "+ means we want to find one or more occurrences of this pattern.", - "g means that we want to search the entire string for this pattern.", + "g means that we want to search the entire string for this pattern instead of just the first match.", "i means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.", - "Regular expressions are usually surrounded by / symbols.", - "Let's try selecting all the occurrences of the word and in the string George Boole and Alan Turing went to the shop and got some milk. We can do this by replacing the .+ part of our regular expression with the current regular expression with the word and." + "Regular expressions are written by surrounding the pattern with a / symbol.", + "Let's try selecting all the occurrences of the word and in the string George Boole and Alan Turing went to the shop and got some milk. We can do this by replacing the ... part of our regular expression with the current regular expression with the word and." ], "tests":[ "assert(test==2, 'Your regular expression should find two occurrences of the word and');", - "assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used regular expressions to find the word and');" + "assert(editor.getValue().match(/\\/and\\/gi/), 'You should have used regular expressions to find the word and');" ], "challengeSeed":[ "var test = (function() {", @@ -1018,7 +1017,7 @@ " var expressionToGetMilk = /milk/gi;", " // Only change code below this line.", "", - " var expression = /.+/gi;", + " var expression = /.../gi;", "", " // Only change code above this line.", " // We use this function to show you the value of your variable in your output box.", From 67158e876db1da0ed05dddd9e5557ee840b676b1 Mon Sep 17 00:00:00 2001 From: ahstro Date: Sun, 23 Aug 2015 15:18:17 +0200 Subject: [PATCH 009/538] Check all children instead of just one in 'Target Children with jQuery' --- seed/challenges/jquery.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/jquery.json b/seed/challenges/jquery.json index 8576e4bc0d..75de836abf 100644 --- a/seed/challenges/jquery.json +++ b/seed/challenges/jquery.json @@ -679,7 +679,7 @@ "Here's an example of how you would use the children() function: $(\"#left-well\").children().css(\"color\", \"blue\")" ], "tests": [ - "assert($(\"#target6\").css(\"color\") === 'rgb(0, 128, 0)', 'Your target6 element should have green text.')", + "assert($(\"#right-well\").children().css(\"color\") === 'rgb(0, 128, 0)', 'All children of #right-well should have green text.')", "assert(editor.match(/\\.children\\(\\)\\.css/g), 'You should use the children() function to modify these elements.')", "assert(editor.match(/
/g), 'Only use jQuery to add these classes to the element.')" ], From 59bb244286dd514748ba22b6277969e709fdc0c0 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 23 Aug 2015 13:10:30 -0700 Subject: [PATCH 010/538] start refactoring bonfire tests --- seed/challenges/basic-bonfires.json | 172 ++++++++++++++-------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 539ce1d349..6ec7aa958b 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -13,8 +13,8 @@ "Make this function return true no matter what." ], "tests": [ - "expect(meetBonfire()).to.be.a(\"boolean\");", - "expect(meetBonfire()).to.be.true;" + "assert(typeof(meetBonfire()) === \"boolean\", 'The result should be a Boolean value of true or false.');", + "assert(meetBonfire() === true, 'Your meetBonfire() function should return true.');" ], "challengeSeed": [ "function meetBonfire(argument) {", @@ -46,10 +46,10 @@ "title": "Reverse a String", "difficulty": "1.01", "tests": [ - "expect(reverseString('hello')).to.be.a('String');", - "expect(reverseString('hello')).to.equal('olleh');", - "expect(reverseString('Howdy')).to.equal('ydwoH');", - "expect(reverseString('Greetings from Earth')).to.equal('htraE morf sgniteerG');" + "assert(typeof(reverseString('hello')) === \"string\", 'reverseString() should return a string.');", + "assert(reverseString('hello') === 'olleh', '\"hello\" should become \"olleh\".');", + "assert(reverseString('Howdy') === 'ydwoH', '\"Howdy\" should become \"ydwoH\".');", + "assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG', '\"Greetings from Earth\" should return \"htraE morf sgniteerG\".');" ], "description": [ "Reverse the provided string.", @@ -62,7 +62,7 @@ " return str;", "}", "", - "reverseString('hello');" + "reverseString('hello', '');" ], "MDNlinks": [ "Global String Object", @@ -87,10 +87,10 @@ "id": "a302f7aae1aa3152a5b413bc", "title": "Factorialize a Number", "tests": [ - "expect(factorialize(5)).to.be.a(\"Number\");", - "expect(factorialize(5)).to.equal(120);", - "expect(factorialize(10)).to.equal(3628800);", - "expect(factorialize(20)).to.equal(2432902008176640000);" + "assert(typeof(factorialize(5)) === \"number\", 'factorialize() should return a number.');", + "assert(factorialize(5) === 120, '5 should return 120.');", + "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", + "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" ], "difficulty": "1.02", "description": [ @@ -105,7 +105,7 @@ " return num;", "}", "", - "factorialize(5);" + "factorialize(5, '');" ], "MDNlinks": [ "Arithmetic Operators" @@ -135,14 +135,14 @@ "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "tests": [ - "expect(palindrome(\"eye\")).to.be.a(\"boolean\");", - "assert.deepEqual(palindrome(\"eye\"), true);", - "assert.deepEqual(palindrome(\"race car\"), true);", - "assert.deepEqual(palindrome(\"not a palindrome\"), false);", - "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true);", - "assert.deepEqual(palindrome(\"never odd or even\"), true);", - "assert.deepEqual(palindrome(\"nope\"), false);", - "assert.deepEqual(palindrome(\"almostomla\"), false);" + "assert(palindrome(\"eye\")) === \"boolean\", '');", + "assert.deepEqual(palindrome(\"eye\"), true, '');", + "assert.deepEqual(palindrome(\"race car\"), true, '');", + "assert.deepEqual(palindrome(\"not a palindrome\"), false, '');", + "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true, '');", + "assert.deepEqual(palindrome(\"never odd or even\"), true, '');", + "assert.deepEqual(palindrome(\"nope\"), false, '');", + "assert.deepEqual(palindrome(\"almostomla\"), false, '');" ], "challengeSeed": [ "function palindrome(str) {", @@ -152,7 +152,7 @@ "", "", "", - "palindrome(\"eye\");" + "palindrome(\"eye\", '');" ], "MDNlinks": [ "String.replace()", @@ -185,15 +185,15 @@ " return str.length;", "}", "", - "findLongestWord('The quick brown fox jumped over the lazy dog');" + "findLongestWord('The quick brown fox jumped over the lazy dog', '');" ], "tests": [ - "expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.be.a('Number');", - "expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.equal(6);", - "expect(findLongestWord('May the force be with you')).to.equal(5);", - "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 if we try a super-long word such as otorhinolaryngology')).to.equal(19);" + "assert(findLongestWord('The quick brown fox jumped over the lazy dog')) === 'Number', '');", + "assert(findLongestWord('The quick brown fox jumped over the lazy dog') === 6, '');", + "assert(findLongestWord('May the force be with you') === 5, '');", + "assert(findLongestWord('Google do a barrel roll') === 6, '');", + "assert(findLongestWord('What is the average airspeed velocity of an unladen swallow') === 8, '');", + "assert(findLongestWord('What if we try a super-long word such as otorhinolaryngology') === 19, '');" ], "MDNlinks": [ "String.split()", @@ -226,13 +226,13 @@ " return str;", "}", "", - "titleCase(\"I'm a little tea pot\");" + "titleCase(\"I'm a little tea pot\", '');" ], "tests": [ - "expect(titleCase(\"I'm a little tea pot\")).to.be.a('String');", - "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(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");" + "assert(titleCase(\"I'm a little tea pot\")) === 'String', '');", + "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '');", + "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '');", + "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '');" ], "MDNlinks": [ "String.charAt()" @@ -266,12 +266,12 @@ " return arr;", "}", "", - "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);" + "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], '');" ], "tests": [ - "expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');", - "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,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, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', '');", + "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,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]), '');" ], "MDNlinks": [ "Comparison Operators" @@ -304,14 +304,14 @@ " return str;", "}", "", - "end('Bastian', 'n');" + "end('Bastian', 'n', '');" ], "tests": [ - "assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');", - "assert.strictEqual(end('Connor', 'n'), false, 'should equal false if target does not equal end of string');", - "assert.strictEqual(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification'), false, 'should equal false if target does not equal 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('Bastian', 'n'), true, 'should equal true if target equals end of string', '');", + "assert.strictEqual(end('Connor', 'n'), false, 'should equal false if target does not equal end of string', '');", + "assert.strictEqual(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification'), false, 'should equal false if target does not equal 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', '');" ], "MDNlinks": [ "String.substr()" @@ -343,12 +343,12 @@ " return str;", "}", "", - "repeat('abc', 3);" + "repeat('abc', 3, '');" ], "tests": [ - "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', -2), '', 'should return an empty string for negative numbers');" + "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', -2), '', 'should return an empty string for negative numbers', '');" ], "MDNlinks": [ "Global String Object" @@ -381,13 +381,13 @@ " return str;", "}", "", - "truncate('A-tisket a-tasket A green and yellow basket', 11);" + "truncate('A-tisket a-tasket A green and yellow basket', 11, '');" ], "tests": [ - "expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');", - "expect(truncate('Peter Piper picked a peck of pickled peppers', 14)).to.eqls('Peter Piper...');", - "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(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...', '');", + "assert(truncate('Peter Piper picked a peck of pickled peppers', 14)).to.eqls('Peter Piper...', '');", + "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', '');" ], "MDNlinks": [ "String.slice()" @@ -419,13 +419,13 @@ " return arr;", "}", "", - "chunk(['a', 'b', 'c', 'd'], 2);" + "chunk(['a', 'b', 'c', 'd'], 2, '');" ], "tests": [ - "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], 2), [[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(['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], 2), [[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', '');" ], "MDNlinks": [ "Array.push()" @@ -457,12 +457,12 @@ " return arr;", "}", "", - "slasher([1, 2, 3], 2);" + "slasher([1, 2, 3], 2, '');" ], "tests": [ - "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');", - "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array');" + "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', '');", + "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array', '');" ], "MDNlinks": [ "Array.slice()", @@ -497,17 +497,17 @@ " return arr;", "}", "", - "mutation(['hello', 'hey']);" + "mutation(['hello', 'hey'], '');" ], "tests": [ - "expect(mutation(['hello', 'hey'])).to.be.false;", - "expect(mutation(['hello', 'Hello'])).to.be.true;", - "expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", - "expect(mutation(['Mary', 'Army'])).to.be.true;", - "expect(mutation(['Mary', 'Aarmy'])).to.be.true;", - "expect(mutation(['Alien', 'line'])).to.be.true;", - "expect(mutation(['floor', 'for'])).to.be.true;", - "expect(mutation(['hello', 'neo'])).to.be.false;" + "assert(mutation(['hello', 'hey'])).to.be.false;", + "assert(mutation(['hello', 'Hello'])).to.be.true;", + "assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", + "assert(mutation(['Mary', 'Army'])).to.be.true;", + "assert(mutation(['Mary', 'Aarmy'])).to.be.true;", + "assert(mutation(['Alien', 'line'])).to.be.true;", + "assert(mutation(['floor', 'for'])).to.be.true;", + "assert(mutation(['hello', 'neo'])).to.be.false;" ], "MDNlinks": [ "Array.indexOf()" @@ -540,12 +540,12 @@ " return arr;", "}", "", - "bouncer([7, 'ate', '', false, 9]);" + "bouncer([7, 'ate', '', false, 9], '');" ], "tests": [ - "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([false, null, 0]), [], 'should return empty array if all elements are falsey');" + "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([false, null, 0]), [], 'should return empty array if all elements are falsey', '');" ], "MDNlinks": [ "Boolean Objects", @@ -579,11 +579,11 @@ " return arr;", "}", "", - "where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });" + "where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }, '');" ], "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([{ '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([{ 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', '');" ], "MDNlinks": [ "Global Object", @@ -617,14 +617,14 @@ " return arr;", "}", "", - "destroyer([1, 2, 3, 1, 2, 3], 2, 3);" + "destroyer([1, 2, 3, 1, 2, 3], 2, 3, '');" ], "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, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');", - "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], 'should accept more than two additional arguments');", - "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], 'should remove correct values from an array');", - "assert.deepEqual(destroyer(['tree', 'hamburger', 53], 'tree', 53), ['hamburger'], 'should handle NaN-elements');" + "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([3, 5, 1, 2, 2], 2, 3, 5), [1], 'should accept more than two additional arguments', '');", + "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], 'should remove correct values from an array', '');", + "assert.deepEqual(destroyer(['tree', 'hamburger', 53], 'tree', 53), ['hamburger'], 'should handle NaN-elements', '');" ], "MDNlinks": [ "Arguments object", @@ -658,14 +658,14 @@ " return num;", "}", "", - "where([40, 60], 50);" + "where([40, 60], 50, '');" ], "MDNlinks": [ "Array.sort()" ], "tests": [ - "expect(where([10, 20, 30, 40, 50], 35)).to.equal(3);", - "expect(where([10, 20, 30, 40, 50], 30)).to.equal(2);" + "assert(where([10, 20, 30, 40, 50], 35) === 3, '');", + "assert(where([10, 20, 30, 40, 50], 30) === 2, '');" ], "type": "bonfire", "challengeType": 5, From e4896eb0c0c95dd4fd7e4299c40ab490a6e32c24 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 23 Aug 2015 15:18:40 -0700 Subject: [PATCH 011/538] continue refactor of tests --- seed/challenges/basic-bonfires.json | 64 ++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 6ec7aa958b..0cc2ff53c4 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -14,7 +14,7 @@ ], "tests": [ "assert(typeof(meetBonfire()) === \"boolean\", 'The result should be a Boolean value of true or false.');", - "assert(meetBonfire() === true, 'Your meetBonfire() function should return true.');" + "assert(meetBonfire() === true, 'Your meetBonfire() function should return true.');" ], "challengeSeed": [ "function meetBonfire(argument) {", @@ -87,17 +87,17 @@ "id": "a302f7aae1aa3152a5b413bc", "title": "Factorialize a Number", "tests": [ - "assert(typeof(factorialize(5)) === \"number\", 'factorialize() should return a number.');", - "assert(factorialize(5) === 120, '5 should return 120.');", - "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", - "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" + "assert(typeof(factorialize(5)) === \"number\", 'factorialize() should return a number.');", + "assert(factorialize(5) === 120, '5 should return 120.');", + "assert(factorialize(10) === 3628800, '10 should return 3,628,800.');", + "assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');" ], "difficulty": "1.02", "description": [ "Return the factorial of the provided integer.", "If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.", - "Factorials are often represented with the shorthand notation n!", - "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f", + "Factorials are often represented with the shorthand notation n!", + "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120", "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ @@ -135,14 +135,14 @@ "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "tests": [ - "assert(palindrome(\"eye\")) === \"boolean\", '');", - "assert.deepEqual(palindrome(\"eye\"), true, '');", - "assert.deepEqual(palindrome(\"race car\"), true, '');", - "assert.deepEqual(palindrome(\"not a palindrome\"), false, '');", - "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true, '');", - "assert.deepEqual(palindrome(\"never odd or even\"), true, '');", - "assert.deepEqual(palindrome(\"nope\"), false, '');", - "assert.deepEqual(palindrome(\"almostomla\"), false, '');" + "assert(typeof(palindrome(\"eye\")) === \"boolean\", 'palindrome() should return a boolean.');", + "assert(palindrome(\"eye\") === true, '\"eye\" should return true.');", + "assert(palindrome(\"race car\") === true, '\"race car\" should return true.');", + "assert(palindrome(\"not a palindrome\") === false, '\"not a palindrome\" should return false.');", + "assert(palindrome(\"A man, a plan, a canal. Panama\") === true, '\"A man, a plan, a canal. Panama\" should return true.');", + "assert(palindrome(\"never odd or even\") === true, '\"never odd or even\" should return true.');", + "assert(palindrome(\"nope\") === false, '\"nope\" should return false.');", + "assert(palindrome(\"almostomla\") === false, '\"almostomla\" should return false.');" ], "challengeSeed": [ "function palindrome(str) {", @@ -152,7 +152,7 @@ "", "", "", - "palindrome(\"eye\", '');" + "palindrome(\"eye\");" ], "MDNlinks": [ "String.replace()", @@ -185,15 +185,15 @@ " return str.length;", "}", "", - "findLongestWord('The quick brown fox jumped over the lazy dog', '');" + "findLongestWord('The quick brown fox jumped over the lazy dog');" ], "tests": [ - "assert(findLongestWord('The quick brown fox jumped over the lazy dog')) === 'Number', '');", - "assert(findLongestWord('The quick brown fox jumped over the lazy dog') === 6, '');", - "assert(findLongestWord('May the force be with you') === 5, '');", - "assert(findLongestWord('Google do a barrel roll') === 6, '');", - "assert(findLongestWord('What is the average airspeed velocity of an unladen swallow') === 8, '');", - "assert(findLongestWord('What if we try a super-long word such as otorhinolaryngology') === 19, '');" + "assert(typeOf(findLongestWord(\"The quick brown fox jumped over the lazy dog\")) === 'number', 'findLongestWord() should return a number.');", + "assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, '\"The quick brown fox jumped over the lazy dog\" should return 6.');", + "assert(findLongestWord(\"May the force be with you\") === 5, '\"May the force be with you\" should return 5.');", + "assert(findLongestWord(\"Google do a barrel roll\") === 6, '\"Google do a barrel roll\" should return 6.');", + "assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, '\"What is the average airspeed velocity of an unladen swallow\" should return 8.');", + "assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, '\"What if we try a super-long word such as otorhinolaryngology\" should return 18.');" ], "MDNlinks": [ "String.split()", @@ -229,7 +229,7 @@ "titleCase(\"I'm a little tea pot\", '');" ], "tests": [ - "assert(titleCase(\"I'm a little tea pot\")) === 'String', '');", + "assert(typeOf(titleCase(\"I'm a little tea pot\")) === 'String', 'titleCase() should return a string.');", "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '');", "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '');", "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '');" @@ -269,7 +269,7 @@ "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], '');" ], "tests": [ - "assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', '');", + "assert(typeOf(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', 'largestOfFour() should return an array.');", "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,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]), '');" ], @@ -422,10 +422,10 @@ "chunk(['a', 'b', 'c', 'd'], 2, '');" ], "tests": [ - "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], 2), [[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(chunk(['a', 'b', 'c', 'd'], 2) === [['a', 'b'], ['c', 'd']], 'chunk(['a', 'b', 'c', 'd'], 2) should return [['a', 'b'], ['c', 'd']].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], 'chunk([0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" ], "MDNlinks": [ "Array.push()" @@ -460,9 +460,9 @@ "slasher([1, 2, 3], 2, '');" ], "tests": [ - "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', '');", - "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array', '');" + "assert(slasher([1, 2, 3], 2) === [3]), 'slasher([1, 2, 3], 2), [3] should return [3].');", + "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", + "assert(slasher([1, 2, 3], 9) === []), 'slasher([1, 2, 3], 9) should return [].');" ], "MDNlinks": [ "Array.slice()", From c264ce6e9df616f9855e803c8d24504d7e9ef095 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 23 Aug 2015 18:02:58 -0700 Subject: [PATCH 012/538] continue refactoring bonfire tests --- seed/challenges/basic-bonfires.json | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 0cc2ff53c4..fe3ecac9d5 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -230,9 +230,9 @@ ], "tests": [ "assert(typeOf(titleCase(\"I'm a little tea pot\")) === 'String', 'titleCase() should return a string.');", - "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '');", - "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '');", - "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '');" + "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '\"I'm a little tea pot\" should return \"I'm A Little Tea Pot\"');", + "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '\"sHoRt AnD sToUt\" should return \"Short And Stout\"');", + "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '\"HERE IS MY HANDLE HERE IS MY SPOUT\" should return \"Here Is My Handle Here Is My Spout\"');" ], "MDNlinks": [ "String.charAt()" @@ -270,8 +270,8 @@ ], "tests": [ "assert(typeOf(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])) === 'array', 'largestOfFour() should return an array.');", - "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,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]), '');" + "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) === [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]] should return [27,5,39,1001].');", + "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000], '[[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]] should return [9,35,97,1000000].');" ], "MDNlinks": [ "Comparison Operators" @@ -307,11 +307,11 @@ "end('Bastian', 'n', '');" ], "tests": [ - "assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string', '');", - "assert.strictEqual(end('Connor', 'n'), false, 'should equal false if target does not equal end of string', '');", - "assert.strictEqual(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification'), false, 'should equal false if target does not equal 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(end('Bastian', 'n') === true, 'end(\"Bastian\", \"n\") should return true.');", + "assert(end('Connor', 'n') === false, 'end(\"Connor\", \"n\") should return false.');", + "assert(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification') === false, 'end(Walking on water and developing software from a specification are easy if both are frozen.', 'specification') should return false.');", + "assert(end('He has to give me a new name', 'name') === true, 'end(\"He has to give me a new name\", \"name\") should return true.');", + "assert(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain') === false, 'end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain') should return false.');" ], "MDNlinks": [ "String.substr()" @@ -346,9 +346,9 @@ "repeat('abc', 3, '');" ], "tests": [ - "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', -2), '', 'should return an empty string for negative numbers', '');" + "assert(repeat('*', 3) === '***', 'repeat(\"*\", 3) should return \"***\");", + "assert(repeat('abc', 3) === 'abcabcabc', 'repeat(\"abc\", 3) should return \"abcabcabc\".');", + "assert(repeat('abc', -2) === '', 'repeat(\"abc\", -2) should return \"\".');" ], "MDNlinks": [ "Global String Object" @@ -384,10 +384,10 @@ "truncate('A-tisket a-tasket A green and yellow basket', 11, '');" ], "tests": [ - "assert(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...', '');", - "assert(truncate('Peter Piper picked a peck of pickled peppers', 14)).to.eqls('Peter Piper...', '');", - "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(truncate('A-tisket a-tasket A green and yellow basket', 11) === 'A-tisket...', 'truncate(\"A-tisket a-tasket A green and yellow basket\", 11) should return \"A-tisket...\".');", + "assert(truncate('Peter Piper picked a peck of pickled peppers', 14) === 'Peter Piper...', 'truncate(\"Peter Piper picked a peck of pickled peppers\", 14) should return \"Peter Piper...\".);", + "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', 'truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) should return \"A-tisket a-tasket A green and yellow basket\".');", + "assert(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', 'truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2) should return \"A-tisket a-tasket A green and yellow basket\".);" ], "MDNlinks": [ "String.slice()" @@ -422,10 +422,10 @@ "chunk(['a', 'b', 'c', 'd'], 2, '');" ], "tests": [ - "assert(chunk(['a', 'b', 'c', 'd'], 2) === [['a', 'b'], ['c', 'd']], 'chunk(['a', 'b', 'c', 'd'], 2) should return [['a', 'b'], ['c', 'd']].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], 'chunk([0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].');", - "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" + "assert(chunk(['a', 'b', 'c', 'd'], 2) === [['a', 'b'], ['c', 'd']], 'chunk([\"a\", \"b\", \"c\", \"d\"], 2) should return [[\"a\", \"b\"], [\"c\", \"d\"]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 3) === [[0, 1, 2], [3, 4, 5]], 'chunk([0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 2) === [[0, 1], [2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 2) should return [[0, 1], [2, 3], [4, 5]].');", + "assert(chunk([0, 1, 2, 3, 4, 5], 4) === [[0, 1, 2, 3], [4, 5]], 'chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" ], "MDNlinks": [ "Array.push()" @@ -460,9 +460,9 @@ "slasher([1, 2, 3], 2, '');" ], "tests": [ - "assert(slasher([1, 2, 3], 2) === [3]), 'slasher([1, 2, 3], 2), [3] should return [3].');", - "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", - "assert(slasher([1, 2, 3], 9) === []), 'slasher([1, 2, 3], 9) should return [].');" + "assert(slasher([1, 2, 3], 2) === [3]), 'slasher([1, 2, 3], 2), [3] should return [3].');", + "assert(slasher([1, 2, 3], 0) === [1, 2, 3]), 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", + "assert(slasher([1, 2, 3], 9) === []), 'slasher([1, 2, 3], 9) should return [].');" ], "MDNlinks": [ "Array.slice()", From fbbbff2186299817b965e362dbc0a241f02692f7 Mon Sep 17 00:00:00 2001 From: Aryan Jabbari Date: Mon, 24 Aug 2015 23:11:21 -0400 Subject: [PATCH 013/538] Changed 'Show the Local Weather' wording to fix #2623 --- seed/challenges/basic-ziplines.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/basic-ziplines.json b/seed/challenges/basic-ziplines.json index 37e547c4e3..c1a6ec00f9 100644 --- a/seed/challenges/basic-ziplines.json +++ b/seed/challenges/basic-ziplines.json @@ -115,8 +115,8 @@ "Rule #3: Reverse engineer the example project's functionality, and also feel free to personalize it.", "Here are the user stories you must enable, and optional bonus user stories:", "User Story: As a user, I can see the weather in my current location.", - "Bonus User Story: As a user, I can see an icon depending on the temperature..", - "Bonus User Story: As a user, I see a different background image depending on the temperature (e.g. snowy mountain, hot desert).", + "Bonus User Story: As a user, I can see an icon depending on the weather.", + "Bonus User Story: As a user, I see a different background image (e.g. snowy mountain, hot desert) depending on the weather.", "Bonus User Story: As a user, I can push a button to toggle between Fahrenheit and Celsius.", "Remember to use Read-Search-Ask if you get stuck.", "When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen. If you pair programmed, you should also include the Free Code Camp username of your pair.", From 547fa9424f5faeed2647d64d452a564de20b1a6e Mon Sep 17 00:00:00 2001 From: sJhonny-e Date: Tue, 25 Aug 2015 18:12:17 +0300 Subject: [PATCH 014/538] changed regex for checking style element in challenge "Use CSS Selectors to Style Elements"; regex now allows opening style elements to have whitespace before closing '>', and also the allowed attributes (type, media etc..) --- seed/challenges/html5-and-css.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index b93a1de494..b81dbd4356 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -383,7 +383,7 @@ "assert(!$(\"h2\").attr(\"style\"), 'Remove the style attribute from your h2 element.')", "assert($(\"style\") && $(\"style\").length > 1, 'Create a style element.')", "assert($(\"h2\").css(\"color\") === \"rgb(0, 0, 255)\", 'Your h2 element should be blue.')", - "assert(editor.match(/<\\/style>/g) && editor.match(/<\\/style>/g).length === editor.match(/", "", "
", - "

CatPhotoApp

", + "

CatPhotoApp

", "", - "

Click here for cat photos.

", - "", - " ", + " ", "", " ", "
", From ccb88cadf35f7b9b174c05b9fe2dd4928752c758 Mon Sep 17 00:00:00 2001 From: Dmytro Yarmak Date: Tue, 8 Sep 2015 10:58:50 +0300 Subject: [PATCH 094/538] Add output block to "Iterate with JavaScript While Loops" challange --- seed/challenges/basic-javascript.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 11c6b67e72..f273197e75 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -859,8 +859,14 @@ ], "challengeSeed":[ "var myArray = [];", - "//Push the numbers zero through four to myArray", + "// Only change code below this line.", "", + "// Push the numbers zero through four to myArray using a \"while loop\".", + "", + "// Only change code above this line.", + "// We use this function to show you the value of your variable in your output box.", + "// You'll learn about functions soon.", + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}", "" ], "type": "waypoint", From 721ea81593e840607bbd8f02f14d18b3777687e9 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Tue, 8 Sep 2015 16:06:44 +0530 Subject: [PATCH 095/538] Add more falsy values --- seed/challenges/basic-bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 66ecefde0b..250e4a9a2a 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -549,7 +549,7 @@ "tests": [ "assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsy values');", "assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsy elements');", - "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsy');" + "assert.deepEqual(bouncer([false, null, 0, NaN, undefined, '']), [], 'should return empty array if all elements are falsy');" ], "MDNlinks": [ "Boolean Objects", From 8fd99e3350a8671a611fafdc74197f629f373086 Mon Sep 17 00:00:00 2001 From: bugron Date: Sun, 6 Sep 2015 14:41:55 +0400 Subject: [PATCH 096/538] removes unnecessary class --- server/views/coursewares/showHTML.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/views/coursewares/showHTML.jade b/server/views/coursewares/showHTML.jade index b5e4a72908..64a10cc314 100644 --- a/server/views/coursewares/showHTML.jade +++ b/server/views/coursewares/showHTML.jade @@ -49,7 +49,7 @@ block content var userLoggedIn = true; else .button-spacer - a.btn.signup-btn.btn-block.btn-block.negative-15(href='/login') Sign in so you can save your progress + a.btn.signup-btn.btn-block.btn-block(href='/login') Sign in so you can save your progress script. var userLoggedIn = false; .button-spacer From e0db3181d399007c010e8da85bef1147c0bae66f Mon Sep 17 00:00:00 2001 From: bugron Date: Tue, 8 Sep 2015 17:21:12 +0400 Subject: [PATCH 097/538] fixes an idle test and some text --- seed/challenges/basic-javascript.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index da1c55830e..f4c0377b50 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -974,13 +974,14 @@ "Create an if-else statement to return heads if the flip var is zero, or else return tails if it's not." ], "tests":[ - "assert((function(){if(myFunction() === \"heads\" || myFunction() === \"tails\"){return true;}else{return false;}})(), 'myFunction should either return heads or tails');", - "assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');", - "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');" + "assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'myFunction should either return heads or tails.');", + "assert((function(){var result = myFunction();if(result === 'heads' && flip === 0 || result === 'tails' && flip !== 0){return true;} else {return false;}})(), 'myFunction should return heads when flip equals 0 and tails when flip equals 1.');", + "assert(editor.getValue().match(/if/g).length >= 4, 'You should have created a new if statement.');", + "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement.');" ], "challengeSeed":[ + "var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", "function myFunction(){", - " var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", " // Create an if-else statement here to return \"heads\" if flip is 0. Otherwise return \"tails\".", "", " // Only change code below this line.", @@ -990,7 +991,7 @@ "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", - "(function(){return myFunction();})();" + "var result = myFunction();if(typeof(flip) !== \"undefined\" && typeof(flip) === \"number\" && typeof(result) !== \"undefined\" && typeof(result) === \"string\"){(function(y,z){return 'flip = ' + y.toString() + ', text = ' + z;})(flip, result);}" ], "type": "waypoint", "challengeType": 1 From 36acb95a0bd0c3de707ce53511529354a89d2292 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 8 Sep 2015 09:18:01 -0700 Subject: [PATCH 098/538] Update contributing to best practices removes mention of contributors group. mention git rebase article change to free code camps style guide over AirBnB's. --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e9ab6393c6..7590eccafe 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,9 @@ We welcome pull requests from Free Code Camp campers (our students) and seasoned 2. Pick an issue that nobody has claimed and start working on it. If your issue isn't on the board, open an issue. If you think you can fix it yourself, start working on it. Feel free to ask for help in our [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp). 3. Fork the project ([Need help with forking a project?](https://help.github.com/articles/fork-a-repo/)). You'll do all of your work on your forked copy. 4. Create a branch specific to the issue or feature you are working on. Push your work to that branch. ([Need help with branching?](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches)) -5. Name the branch something like `user-xxx` where `user` is your username and `xxx` is the issue number you are addressing. -6. You should have [ESLint running in your editor](http://eslint.org/docs/user-guide/integrations.html), and it will highlight anything doesn't conform to [AirBnB's JavaScript Style Guide](https://github.com/airbnb/javascript). Please do not ignore any linting errors, as they are meant to **help** you. Make sure none of your JavaScript is longer than 80 characters per line. -7. Once your code is ready, submit a pull request from your branch to Free Code Camp's `staging` branch. We'll do a quick code review and give you feedback, then iterate from there. -8. Once we accept one of your pull requests, one of the project owners (currently @quincylarson, @terakilobyte, and @berkeleytrue) will add you to our camper contributor group. +5. Name the branch something like `fix/xxx` or `feature/xxx` where `xxx` is a short description of the changes or feature you are attempting to add. For example `fix/email-login` whould be a branch where I fix something specific to email login. +6. You should have [ESLint running in your editor](http://eslint.org/docs/user-guide/integrations.html), and it will highlight anything doesn't conform to [Free Code Camp's JavaScript Style Guide](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Free-Code-Camp-JavaScript-Style-Guide) (you can find a summory of those rules [here](https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/.eslintrc). Please do not ignore any linting errors, as they are meant to **help** you and to ensure a clean and simple code base. Make sure none of your JavaScript is longer than 80 characters per line. +7. Once your code is ready, submit a pull request from your branch to Free Code Camp's `staging` branch. We'll do a quick code review and give you feedback, then iterate from there. It may also be helpful to read about git [rebasing](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/git-rebase). Prerequisites ------------- From e7382667268b79895c8b49c5f858d75337bd366e Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 8 Sep 2015 09:19:28 -0700 Subject: [PATCH 099/538] Add contributing guidelines from README --- CONTRIBUTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba4e245107..9511ab33cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,2 +1,12 @@ We're getting a lot of duplicate issues and bug reports that just aren't reporting actual bugs. So, before you submit your issue, please read the [Help I've Found a Bug](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Help-I've-Found-a-Bug) wiki page. + +We welcome pull requests from Free Code Camp campers (our students) and seasoned JavaScript developers alike! Follow these steps to contribute: + +1. Check our [public Waffle Board](https://waffle.io/freecodecamp/freecodecamp). +2. Pick an issue that nobody has claimed and start working on it. If your issue isn't on the board, open an issue. If you think you can fix it yourself, start working on it. Feel free to ask for help in our [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp). +3. Fork the project ([Need help with forking a project?](https://help.github.com/articles/fork-a-repo/)). You'll do all of your work on your forked copy. +4. Create a branch specific to the issue or feature you are working on. Push your work to that branch. ([Need help with branching?](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches)) +5. Name the branch something like `fix/xxx` or `feature/xxx` where `xxx` is a short description of the changes or feature you are attempting to add. For example `fix/email-login` whould be a branch where I fix something specific to email login. +6. You should have [ESLint running in your editor](http://eslint.org/docs/user-guide/integrations.html), and it will highlight anything doesn't conform to [Free Code Camp's JavaScript Style Guide](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Free-Code-Camp-JavaScript-Style-Guide) (you can find a summory of those rules [here](https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/.eslintrc). Please do not ignore any linting errors, as they are meant to **help** you and to ensure a clean and simple code base. Make sure none of your JavaScript is longer than 80 characters per line. +7. Once your code is ready, submit a pull request from your branch to Free Code Camp's `staging` branch. We'll do a quick code review and give you feedback, then iterate from there. It may also be helpful to read about git [rebasing](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/git-rebase). From d884aaa924e2f38808fcf332525525e8596a2cc8 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 8 Sep 2015 13:45:18 -0700 Subject: [PATCH 100/538] remove contributors list from package.json We now have over a hundred contributors and this should not be listed in the package.json --- package.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/package.json b/package.json index d35a1c4cf9..44833cc65d 100644 --- a/package.json +++ b/package.json @@ -14,16 +14,6 @@ "test": "mocha --compilers js:babel/register" }, "license": "(BSD-3-Clause AND CC-BY-SA-4.0)", - "contributors": [ - { - "name": "Quincy Larson", - "url": "https://github.com/QuincyLarson" - }, - { - "name": "Nathan Leniz", - "url": "https://github.com/terakilobyte" - } - ], "dependencies": { "accepts": "~1.2.5", "async": "~0.9.0", From b54b2de9abe67f68bef52fac53181fc7217fbc42 Mon Sep 17 00:00:00 2001 From: Aryan Jabbari Date: Sat, 5 Sep 2015 20:10:14 -0400 Subject: [PATCH 101/538] Clarifies instructions for shift() challenge; closes #1875 --- seed/challenges/basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 7c5df36b40..46fd8b5ac3 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -604,7 +604,7 @@ "difficulty": "9.9817", "description": [ "pop() always removes the last element of an array. What if you want to remove the first? That's where .shift() comes in.", - "Take the myArray array and shift() the first value off of it." + "Take the myArray array and shift() the first value off of it. Set myRemoved to the first value of myArray using shift()." ], "tests": [ "assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return true;}else{return false;}})(myArray), 'myArray should only have the last two values left([23, [\"dog\", 3]])');", From c57251a446eb09842783fb7f77fba38f43dd62af Mon Sep 17 00:00:00 2001 From: suhussai Date: Sun, 23 Aug 2015 12:52:59 -0600 Subject: [PATCH 102/538] Added link about Roman Numeral to MDNLinks section Added link mentioned in Waypoint description about Roman Numerals to MDNLinks in order to make it more apparent. Affects Waypoint 3 in Intermediate Algorithm Scripting. http://www.freecodecamp.com/challenges/bonfire-roman-numeral-converter closes #2557. --- seed/bonfireMDNlinks.js | 5 +++-- seed/challenges/intermediate-bonfires.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/seed/bonfireMDNlinks.js b/seed/bonfireMDNlinks.js index 0e0b0f89b1..4a5c6ea6b2 100644 --- a/seed/bonfireMDNlinks.js +++ b/seed/bonfireMDNlinks.js @@ -14,8 +14,9 @@ var links = "Permutations": "https://www.mathsisfun.com/combinatorics/combinations-permutations.html", "HTML Entities": "http://dev.w3.org/html5/html-author/charref", "Symmetric Difference": "https://www.youtube.com/watch?v=PxffSUQRkG4", - - // ========= GLOBAL OBJECTS + "Roman Numerals": "http://www.mathsisfun.com/roman-numerals.html", + + // ========= 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", diff --git a/seed/challenges/intermediate-bonfires.json b/seed/challenges/intermediate-bonfires.json index 80adf23020..c1ee08807d 100644 --- a/seed/challenges/intermediate-bonfires.json +++ b/seed/challenges/intermediate-bonfires.json @@ -113,6 +113,7 @@ "convert(36);" ], "MDNlinks": [ + "Roman Numerals", "Array.splice()", "Array.indexOf()", "Array.join()" From 1c618799b41ee8062da050d4636c29f11e6063f7 Mon Sep 17 00:00:00 2001 From: Aniruddh Agarwal Date: Wed, 9 Sep 2015 10:02:08 +0800 Subject: [PATCH 103/538] Fixed typo in Basic Javascript Waypoint Waypoint 'Sift through Text with Regular Expressions' had `...` in its description instead of `.`. Made the required changes. closes #3169 --- seed/challenges/basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 6b77ebac56..69b3a65487 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -1022,7 +1022,7 @@ "g means that we want to search the entire string for this pattern instead of just the first match.", "i means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.", "Regular expressions are written by surrounding the pattern with a / symbol.", - "Let's try selecting all the occurrences of the word and in the string George Boole and Alan Turing went to the shop and got some milk. We can do this by replacing the ... part of our regular expression with the current regular expression with the word and." + "Let's try selecting all the occurrences of the word and in the string George Boole and Alan Turing went to the shop and got some milk. We can do this by replacing the . part of our regular expression with the current regular expression with the word and." ], "tests":[ "assert(test==2, 'Your regular expression should find two occurrences of the word and');", From 9067154566cdef98253d42b368bd9232105bd47e Mon Sep 17 00:00:00 2001 From: Aniruddh Agarwal Date: Wed, 9 Sep 2015 11:52:21 +0800 Subject: [PATCH 104/538] Fix typo in basic-javascript waypoint Waypoint 'Invert Regular Expression Matches with JavaScript' had a semi-colon in the description for the regex example which is not needed. closes #3148 --- seed/challenges/basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index b7c5ea2dc2..b42dcf7db4 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -1109,7 +1109,7 @@ "title": "Invert Regular Expression Matches with JavaScript", "difficulty":"9.987", "description":[ - "Use /\\S/gi; to match everything that isn't a space in the string.", + "Use /\\S/gi to match everything that isn't a space in the string.", "You can invert any match by using the uppercase version of the selector \\s versus \\S for example." ], "tests":[ From 471236b8141d5b9658c6f1c8ae21d548e2f7593e Mon Sep 17 00:00:00 2001 From: Aniruddh Agarwal Date: Wed, 9 Sep 2015 11:44:53 +0800 Subject: [PATCH 105/538] Fixed wording error in HTML/CSS waypoint Waypoint 'Add Different Padding to Each Side of an Element' had a small wording error: the tests were missing `the` closes #3130 --- seed/challenges/html5-and-css.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index 29bb0cae22..f67197acf5 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -2842,10 +2842,10 @@ "Give the green box a padding of 40px on its top and left side, but only 20px on its bottom and right side." ], "tests": [ - "assert($(\".green-box\").css(\"padding-top\") === \"40px\", 'Your green-box class should give the top of elements 40px of padding.')", - "assert($(\".green-box\").css(\"padding-left\") === \"40px\", 'Your green-box class should give the left of elements 40px of padding.')", - "assert($(\".green-box\").css(\"padding-right\") === \"20px\", 'Your green-box class should give the right of elements 20px of padding.')", - "assert($(\".green-box\").css(\"padding-bottom\") === \"20px\", 'Your green-box class should give the bottom of elements 20px of padding.')" + "assert($(\".green-box\").css(\"padding-top\") === \"40px\", 'Your green-box class should give the top of the elements 40px of padding.')", + "assert($(\".green-box\").css(\"padding-left\") === \"40px\", 'Your green-box class should give the left of the elements 40px of padding.')", + "assert($(\".green-box\").css(\"padding-right\") === \"20px\", 'Your green-box class should give the right of the elements 20px of padding.')", + "assert($(\".green-box\").css(\"padding-bottom\") === \"20px\", 'Your green-box class should give the bottom of the elements 20px of padding.')" ], "challengeSeed": [ "", "", "

CatPhotoApp

", + "", "", "cat photos", "", + "", "", "", "

Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.

", From 7acdfaa09e53712743c40c82d6f59ccf991c55f6 Mon Sep 17 00:00:00 2001 From: junhaoyap Date: Sun, 18 Oct 2015 21:13:05 -0700 Subject: [PATCH 466/538] Add regex test for waypoint use CSS to be more strict --- seed/challenges/html5-and-css.json | 1 + 1 file changed, 1 insertion(+) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index c54d12541a..6b9436ea4d 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -435,6 +435,7 @@ "tests": [ "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your h2 element should be red.')", "assert($(\"h2\").hasClass(\"red-text\"), 'Your h2 element should have the class red-text.')", + "assert(editor.match(/\\.red-text\\s*\\{\\s*color:\\s*red;\\s*\\}/g), 'Your stylesheet should declare a red-text class and have its color set to red.')", "assert($(\"h2\").attr(\"style\") === undefined, 'Do not use inline style declarations like style=\"color: red\" in your h2 element.')" ], "challengeSeed": [ From 7f2f3885f8843d8fee3be3a0254abe2f0d5e3ace Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 19 Oct 2015 21:55:29 -0700 Subject: [PATCH 467/538] change blog links to lead to medium subdomain --- README.md | 2 +- common/app/components/Footer/links.json | 2 +- server/boot/a-extendUser.js | 4 ++-- server/views/challengeMap/show.jade | 2 +- server/views/partials/footer.jade | 26 ++++++++++++------------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9b0c87d631..91176090b0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Our campers (students) start by working through our free, self-paced, browser-ba 80% of our campers are over 25, and nearly a fifth of our campers are women. -This code is running live at [FreeCodeCamp.com](http://www.FreeCodeCamp.com). We also have [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp), a [blog](http://blog.freecodecamp.com), and even a [Twitch.tv channel](http://twitch.tv/freecodecamp). +This code is running live at [FreeCodeCamp.com](http://www.FreeCodeCamp.com). We also have [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp), a [blog](http://medium.freecodecamp.com), and even a [Twitch.tv channel](http://twitch.tv/freecodecamp). [Join our community here](http://www.freecodecamp.com/signin). diff --git a/common/app/components/Footer/links.json b/common/app/components/Footer/links.json index 92199b127f..8089a868e4 100644 --- a/common/app/components/Footer/links.json +++ b/common/app/components/Footer/links.json @@ -2,7 +2,7 @@ { "className": "ion-speakerphone", "content": " Blog ", - "href": "http://blog.freecodecamp.com", + "href": "http://medium.freecodecamp.com", "target": "_blank" }, { diff --git a/server/boot/a-extendUser.js b/server/boot/a-extendUser.js index e93f741250..25cc14bf0a 100644 --- a/server/boot/a-extendUser.js +++ b/server/boot/a-extendUser.js @@ -72,9 +72,9 @@ module.exports = function(app) { 'Feel free to email us at this address if you have ', 'any questions about Free Code Camp.\n', 'And if you have a moment, check out our blog: ', - 'blog.freecodecamp.com.\n\n', + 'medium.freecodecamp.com.\n\n', 'Good luck with the challenges!\n\n', - '- the Free Code Camp Volunteer Team' + '- the Free Code Camp Team' ].join('') }; diff --git a/server/views/challengeMap/show.jade b/server/views/challengeMap/show.jade index 9712a09579..2be0974b8c 100644 --- a/server/views/challengeMap/show.jade +++ b/server/views/challengeMap/show.jade @@ -122,7 +122,7 @@ block content .button-spacer .row .col-xs-12.col-sm-8.col-md-6.col-sm-offset-3.col-md-offset-2.hidden - a.btn.btn-lg.btn-block.signup-btn.map-challenge-block-share Section complete. Share your Portfolio with your friends. + a.btn.btn-lg.btn-block.signup-btn.map-challenge-block-share Section complete. Share your code portfolio with your friends. .hidden(id="#{challengeBlock.name}") script. var username = !{JSON.stringify(user && user.username || '')}; diff --git a/server/views/partials/footer.jade b/server/views/partials/footer.jade index 025b59a647..6a84724a13 100644 --- a/server/views/partials/footer.jade +++ b/server/views/partials/footer.jade @@ -1,25 +1,25 @@ .fcc-footer .col-xs-12.hidden-xs.hidden-sm - a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank')  Blog   - a.ion-social-github(href="http://github.com/freecodecamp", target='_blank')  GitHub   - a.ion-social-twitch-outline(href="/twitch")  Twitch  - a.ion-social-linkedin(href="https://www.linkedin.com/edu/school?id=166029", target='_blank')  LinkedIn  + a.ion-speakerphone(href='//medium.freecodecamp.com', target='_blank')  Blog   + a.ion-social-github(href="//github.com/freecodecamp", target='_blank')  GitHub   + a.ion-social-linkedin(href="//www.linkedin.com/edu/school?id=166029", target='_blank')  LinkedIn  + a.ion-social-twitter(href="//twitter.com/freecodecamp", target='_blank')  Twitter   a.ion-social-facebook(href="//facebook.com/freecodecamp")  Facebook   - a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank')  Twitter   + a.ion-social-twitch-outline(href="//twitch.tv/freecodecamp", target='_blank')  Twitch  a.ion-locked(href="//github.com/FreeCodeCamp/freecodecamp/wiki/Free-Code-Camp's-Privacy-Policy")  Privacy   .col-xs-12.visible-xs.visible-sm - a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank') + a.ion-speakerphone(href='//medium.freecodecamp.com', target='_blank') span.sr-only Free Code Camp's Blog - a.ion-social-github(href="http://github.com/freecodecamp", target='_blank') + a.ion-social-github(href="//github.com/freecodecamp", target='_blank') span.sr-only Free Code Camp on GitHub - a.ion-social-twitch-outline(href="/twitch") - span.sr-only Free Code Camp Live Pair Programming on Twitch.tv - a.ion-social-linkedin(href="https://www.linkedin.com/edu/school?id=166029", target='_blank') + a.ion-social-linkedin(href="//www.linkedin.com/edu/school?id=166029", target='_blank') span.sr-only Free Code Camp LinkedIn Alumni Network - a.ion-social-facebook(href="//facebook.com/freecodecamp") - span.sr-only Free Code Camp local groups on Facebook - a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank') + a.ion-social-twitter(href="//twitter.com/freecodecamp", target='_blank') span.sr-only Free Code Camp on Twitter + a.ion-social-facebook(href="//facebook.com/freecodecamp", target='_blank') + span.sr-only Free Code Camp local groups on Facebook + a.ion-social-twitch-outline(href="/twitch", target='_blank') + span.sr-only Free Code Camp Live Pair Programming on Twitch.tv a.ion-locked(href="//github.com/FreeCodeCamp/freecodecamp/wiki/Free-Code-Camp's-Privacy-Policy") span.sr-only Free Code Camp's Privacy Policy From 0522ec8b13bd2174b56a0dfcb30759303a53349f Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 20 Oct 2015 19:53:08 -0700 Subject: [PATCH 468/538] Fix first start for new devs also removes job seed --- README.md | 25 ++++++------ package.json | 2 + seed/index.js | 98 ++++++++++------------------------------------ seed/nonprofits.js | 29 ++++++++++++++ 4 files changed, 66 insertions(+), 88 deletions(-) create mode 100644 seed/nonprofits.js diff --git a/README.md b/README.md index 91176090b0..d0b791bb74 100644 --- a/README.md +++ b/README.md @@ -54,19 +54,23 @@ The easiest way to get started is to clone the repository: # Get the latest snapshot git clone --depth=1 https://github.com/freecodecamp/freecodecamp.git freecodecamp +# Change directory cd freecodecamp # Install NPM dependencies npm install +# Install Gulp globally +npm install -g gulp + +# Install Bower globally +npm install -g bower + # Install Bower dependencies bower install # Create a .env file and populate it with the necessary API keys and secrets: touch .env - -# Install Gulp globally -npm install -g gulp ``` Edit your `.env` file with the following API keys accordingly (if you only use email login, only the `MONGOHQ_URL`, `SESSION_SECRET`, `MANDRILL_USER` and `MANDRILL_PASSWORD` fields are necessary. Keep in mind if you want to use more services you'll have to get your own API keys for those services. @@ -107,20 +111,19 @@ DEBUG=true ``` ```bash -# Start the mongo server +# Start the mongo server in a seperate terminal mongod -# Create your mongo database. -# Type "mongo" in your terminal to access the mongo shell -use freecodecamp -# Exit the mongo shell with control + d - -# Seed your database with the challenges -node seed/ +# Initialize Free Code Camp +# This will seed the database for the first time. +# This command should only be run once. +npm run init # start the application gulp ``` +Now navigate to your browser and open http://localhost:3001 +Congradulations! You did it! License ------- diff --git a/package.json b/package.json index 06d6a933ce..9a765dc44f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "url": "https://github.com/freecodecamp/freecodecamp.git" }, "scripts": { + "init": "npm run create-rev && echo '\n\nseeding database\n\n' && node seed && node seed/nonprofits", + "create-rev": "test ! -e server/rev-manifest.json && echo 'creating manifest' && touch server/rev-manifest.json && echo '{}' >> server/rev-manifest.json", "build": "gulp build", "start": "babel-node server/server.js", "prestart-production": "bower cache clean && bower install && gulp build", diff --git a/seed/index.js b/seed/index.js index 464242c26e..8300b97245 100644 --- a/seed/index.js +++ b/seed/index.js @@ -1,55 +1,34 @@ /* eslint-disable no-process-exit */ require('babel/register'); require('dotenv').load(); + var fs = require('fs'), + Rx = require('rx'), _ = require('lodash'), path = require('path'), - app = require('../server/server'), - nonprofits = require('./nonprofits.json'), - jobs = require('./jobs.json'); + app = require('../server/server'); function getFilesFor(dir) { return fs.readdirSync(path.join(__dirname, '/' + dir)); } var Challenge = app.models.Challenge; -var Nonprofit = app.models.Nonprofit; -var Job = app.models.Job; -var counter = 0; var challenges = getFilesFor('challenges'); -// plus two accounts for nonprofits and jobs seed. -var numberToSave = challenges.length + 1; +var destroy = Rx.Observable.fromNodeCallback(Challenge.destroyAll, Challenge); +var create = Rx.Observable.fromNodeCallback(Challenge.create, Challenge); -function completionMonitor() { - // Increment counter - counter++; - - // Exit if all challenges have been checked - if (counter >= numberToSave) { - process.exit(0); - } - - // Log where in the seed order we're currently at - console.log('Call: ' + counter + '/' + numberToSave); -} - -Challenge.destroyAll(function(err, info) { - if (err) { - throw err; - } else { - console.log('Deleted ', info); - } - challenges.forEach(function(file) { +destroy() + .flatMap(function() { return Rx.Observable.from(challenges); }) + .flatMap(function(file) { var challengeSpec = require('./challenges/' + file); var order = challengeSpec.order; var block = challengeSpec.name; var isBeta = !!challengeSpec.isBeta; + console.log('parsed %s successfully', file); // challenge file has no challenges... if (challengeSpec.challenges.length === 0) { - console.log('file %s has no challenges', file); - completionMonitor(); - return; + return Rx.Observable.just([{ block: 'empty ' + block }]); } var challenges = challengeSpec.challenges @@ -73,50 +52,15 @@ Challenge.destroyAll(function(err, info) { return challenge; }); - Challenge.create( - challenges, - function(err) { - if (err) { - throw err; - } else { - console.log('Successfully parsed %s', file); - completionMonitor(err); - } - } - ); - }); -}); - -Nonprofit.destroyAll(function(err, info) { - if (err) { - console.error(err); - } else { - console.log('Deleted ', info); - } - Nonprofit.create(nonprofits, function(err, data) { - if (err) { - throw err; - } else { - console.log('Saved ', data); + return create(challenges); + }) + .subscribe( + function(challenges) { + console.log('%s successfully saved', challenges[0].block); + }, + function(err) { throw err; }, + function() { + console.log('challenge seed completed'); + process.exit(0); } - completionMonitor(err); - console.log('nonprofits'); - }); -}); - -Job.destroyAll(function(err, info) { - if (err) { - throw err; - } else { - console.log('Deleted ', info); - } - Job.create(jobs, function(err, data) { - if (err) { - console.log('error: ', err); - } else { - console.log('Saved ', data); - } - console.log('jobs'); - completionMonitor(err); - }); -}); + ); diff --git a/seed/nonprofits.js b/seed/nonprofits.js new file mode 100644 index 0000000000..a30cdcfbd2 --- /dev/null +++ b/seed/nonprofits.js @@ -0,0 +1,29 @@ +/* eslint-disable no-process-exit */ +require('babel/register'); +require('dotenv').load(); + +var Rx = require('rx'); +var app = require('../server/server'); + +var Nonprofits = app.models.Challenge; +var nonprofits = require('./nonprofits.json'); +var destroy = Rx.Observable.fromNodeCallback(Nonprofits.destroyAll, Nonprofits); +var create = Rx.Observable.fromNodeCallback(Nonprofits.create, Nonprofits); + +destroy() + .flatMap(function() { + if (!nonprofits) { + return Rx.Observable.throw(new Error('No nonprofits found')); + } + return create(nonprofits); + }) + .subscribe( + function(nonprofits) { + console.log('successfully saved %d nonprofits', nonprofits.length); + }, + function(err) { throw err; }, + function() { + console.log('nonprofit seed completed'); + process.exit(0); + } + ); From e4f8bff4c10c3534a7d63adcd65221b740088f32 Mon Sep 17 00:00:00 2001 From: M-Bowe Date: Tue, 20 Oct 2015 23:09:08 -0400 Subject: [PATCH 469/538] Fix typo in basic-ziplines --- seed/challenges/basic-ziplines.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/basic-ziplines.json b/seed/challenges/basic-ziplines.json index 4565f364a8..15043e6220 100644 --- a/seed/challenges/basic-ziplines.json +++ b/seed/challenges/basic-ziplines.json @@ -35,7 +35,7 @@ [ "http://i.imgur.com/Wzt6Y9Y.gif", "A gif showing the process of saving and forking a pen.", - "Save your pen with the \"Save\" button. Then click the \"Fork\" button. This will create a fork (copy) of your pen that you can experimient with.", + "Save your pen with the \"Save\" button. Then click the \"Fork\" button. This will create a fork (copy) of your pen that you can experiment with.", "" ] ], From fb3d49096009ce9c8fadd04dbd12246e54a704be Mon Sep 17 00:00:00 2001 From: junhaoyap Date: Tue, 20 Oct 2015 22:27:27 -0700 Subject: [PATCH 470/538] Add stricter check for CSS selectors styling elements --- seed/challenges/html5-and-css.json | 1 + 1 file changed, 1 insertion(+) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index c54d12541a..e06df93079 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -377,6 +377,7 @@ "assert(!$(\"h2\").attr(\"style\"), 'Remove the style attribute from your h2 element.')", "assert($(\"style\") && $(\"style\").length > 1, 'Create a style element.')", "assert($(\"h2\").css(\"color\") === \"rgb(0, 0, 255)\", 'Your h2 element should be blue.')", + "assert(editor.match(/h2\\s*\\{\\s*color:\\s*blue;\\s*\\}/g), 'Ensure that your stylesheet h2 declaration is valid with a semicolon and closing brace')", "assert(editor.match(/<\\/style>/g) && editor.match(/<\\/style>/g).length === (editor.match(//g) || []).length, 'Make sure all your style elements are valid and have a closing tag.')" ], "challengeSeed": [ From 321040fe22f5e35553b54ed2615a03bbcc9b7c79 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 20 Oct 2015 23:25:32 -0700 Subject: [PATCH 471/538] Move gulp modules to dependencies --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 9a765dc44f..d9b5a9bca4 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,13 @@ "forever": "~0.14.1", "frameguard": "^0.2.2", "github-api": "~0.7.0", + "gulp": "~3.8.8", + "gulp-eslint": "~0.9.0", + "gulp-inject": "~1.0.2", + "gulp-jsonlint": "^1.1.0", + "gulp-nodemon": "^2.0.3", + "gulp-notify": "^2.2.0", + "gulp-plumber": "^1.0.1", "gulp-less": "^3.0.3", "gulp-minify-css": "~0.5.1", "gulp-reduce-file": "0.0.1", @@ -116,13 +123,6 @@ "browserify": "^10.2.4", "chai": "~1.10.0", "envify": "^3.4.0", - "gulp": "~3.8.8", - "gulp-eslint": "~0.9.0", - "gulp-inject": "~1.0.2", - "gulp-jsonlint": "^1.1.0", - "gulp-nodemon": "^2.0.3", - "gulp-notify": "^2.2.0", - "gulp-plumber": "^1.0.1", "istanbul": "^0.3.15", "loopback-explorer": "^1.7.2", "loopback-testing": "^1.1.0", From ee31bb30a1bab5b35663501bf75420486a029295 Mon Sep 17 00:00:00 2001 From: uwaseem Date: Wed, 21 Oct 2015 22:50:15 +0800 Subject: [PATCH 472/538] Fix typo - changes 'it's attribute' to 'its attribute' --- seed/challenges/bootstrap.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/bootstrap.json b/seed/challenges/bootstrap.json index 886bb06b92..e9b43babb3 100644 --- a/seed/challenges/bootstrap.json +++ b/seed/challenges/bootstrap.json @@ -91,7 +91,7 @@ "id": "bad87fee1348bd9acde08812", "title": "Make Images Mobile Responsive", "description": [ - "First, add a new image below the existing one. Set it's src attribute to http://bit.ly/fcc-running-cats.", + "First, add a new image below the existing one. Set its src attribute to http://bit.ly/fcc-running-cats.", "It would be great if this image could be exactly the width of our phone's screen.", "Fortunately, with Bootstrap, all we need to do is add the img-responsive class to your image. Do this, and the image should perfectly fit the width of your page." ], From 286d0c06c4ba25a232510f164f3d64f0310b6b3a Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 21 Oct 2015 12:33:35 -0700 Subject: [PATCH 473/538] further work to make challenges and news navigation consistent across mobile and desktop --- server/views/stories/hot-stories.jade | 4 ++-- server/views/stories/news-nav.jade | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/server/views/stories/hot-stories.jade b/server/views/stories/hot-stories.jade index 8cc7bb7659..a97da986ef 100644 --- a/server/views/stories/hot-stories.jade +++ b/server/views/stories/hot-stories.jade @@ -48,7 +48,7 @@ (typeof username !== 'undefined' ? "" : "upvote") + - "" + + "" + "
" + "
" + "" + "" + "" + "
" + From 6dfda0166191aad737c6d498d5df522f4b8f520b Mon Sep 17 00:00:00 2001 From: Michael Krebs Date: Wed, 21 Oct 2015 17:15:25 -0400 Subject: [PATCH 474/538] Changes Finders Keepers MDN link from array.some() to array.filter() --- seed/challenges/intermediate-bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/intermediate-bonfires.json b/seed/challenges/intermediate-bonfires.json index d8b008208d..ea05dd355f 100644 --- a/seed/challenges/intermediate-bonfires.json +++ b/seed/challenges/intermediate-bonfires.json @@ -633,7 +633,7 @@ "assert.strictEqual(find([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, 'message: find([1, 3, 5, 9], function(num) { return num % 2 === 0; }) should return undefined.');" ], "MDNlinks": [ - "Array.some()" + "Array.filter()" ], "type": "bonfire", "challengeType": 5, From 5105efa62492b2e2d56c35e95c21fa871cb4e942 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 21 Oct 2015 15:04:58 -0700 Subject: [PATCH 475/538] add solutions to challenges object and add solutions for upper intermediate bonfires --- common/models/challenge.json | 4 ++++ seed/challenges/upper-intermediate-bonfires.json | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/common/models/challenge.json b/common/models/challenge.json index 84cf3a4c6b..81d6af6eef 100644 --- a/common/models/challenge.json +++ b/common/models/challenge.json @@ -82,6 +82,10 @@ }, "descriptionPt": { "type": "array" + }, + "solutions": { + "type": "array", + "default": [] } }, "validations": [], diff --git a/seed/challenges/upper-intermediate-bonfires.json b/seed/challenges/upper-intermediate-bonfires.json index c09cb30da4..b4ab210cd2 100644 --- a/seed/challenges/upper-intermediate-bonfires.json +++ b/seed/challenges/upper-intermediate-bonfires.json @@ -39,6 +39,9 @@ "Closures", "Details of the Object Model" ], + "solutions": [ + "var Person = function(firstAndLast) {\n\n var firstName, lastName;\n\n function updateName(str) { \n firstName = str.split(\" \")[0];\n lastName = str.split(\" \")[1]; \n }\n\n updateName(firstAndLast);\n\n this.getFirstName = function(){\n return firstName;\n };\n \n this.getLastName = function(){\n return lastName;\n };\n \n this.getFullName = function(){\n return firstName + \" \" + lastName;\n };\n \n this.setFirstName = function(str){\n firstName = str;\n };\n \n\n this.setLastName = function(str){\n lastName = str;\n };\n \n this.setFullName = function(str){\n updateName(str);\n };\n};\n\nvar bob = new Person('Bob Ross');\nbob.getFullName();" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", @@ -80,6 +83,9 @@ "MDNlinks": [ "Math.pow()" ], + "solutions": [ + "function orbitalPeriod(arr) {\n var GM = 398600.4418;\n var earthRadius = 6367.4447;\n var TAU = 2 * Math.PI; \n return arr.map(function(obj) {\n return {\n name: obj.name,\n orbitalPeriod: Math.round(TAU * Math.sqrt(Math.pow(obj.avgAlt+earthRadius, 3)/GM))\n };\n });\n}\n\norbitalPeriod([{name : \"sputkin\", avgAlt : 35873.5553}]);\n" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", @@ -120,6 +126,9 @@ "Array.reduce()" ], "type": "bonfire", + "solutions": [ + "function pairwise(arr, arg) {\n var sum = 0;\n arr.forEach(function(e, i, a) {\n if (e != null) { \n var diff = arg-e;\n a[i] = null;\n var dix = a.indexOf(diff);\n if (dix !== -1) {\n sum += dix;\n sum += i;\n a[dix] = null;\n } \n }\n });\n return sum;\n}\n\npairwise([1,4,2,3,0,5], 7);\n" + ], "challengeType": 5, "nameCn": "", "descriptionCn": [], From 5077f74ca1d2c8dc9298ab5056a003a9a71afb00 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 21 Oct 2015 17:42:01 -0700 Subject: [PATCH 476/538] start updating HTML challenge styling --- seed/challenges/html5-and-css.json | 344 +++++++++++++++-------------- server/utils/resources.json | 2 +- 2 files changed, 180 insertions(+), 166 deletions(-) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index c54d12541a..22f99eb110 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -9,7 +9,7 @@ "description": [ "Welcome to Free Code Camp's first coding challenge!", "You can edit code in your text editor, which we've embedded into this web page.", - "Do you see the code in your text editor that says <h1>Hello</h1>? That's an HTML element.", + "Do you see the code in your text editor that says <h1>Hello</h1>? That's an HTML element", "Most HTML elements have an opening tag and a closing tag. Opening tags look like this: <h1>. Closing tags look like this: </h1>. Note that the only difference between opening tags and closing tags is that closing tags have a slash after their opening angle bracket.", "Once you've completed each challenge, and all its tests are passing, the \"Go to my next challenge\" button will become enabled. Click it - or press control and enter at the same time - to advance to the next challenge.", "To enable the \"Go to my next challenge\" button on this exercise, change your h1 tag's text to say \"Hello World\" instead of \"Hello\"." @@ -45,7 +45,7 @@ "Willkommen bei der ersten Programmier-Challenge von Free Code Camp! Klicke auf den folgenden Button für weitere Instruktionen.", "Sehr gut. Jetzt kannst du den Rest der Instruktionen für diese Challenge lesen.", "Mithilfe des eingebauten Text Editors kannst du den Code bearbeiten.", - "Siehst du den Code <h1>Hallo</h1> im Editor? Das ist ein HTML Element.", + "Siehst du den Code <h1>Hallo</h1> im Editor? Das ist ein HTML Element", "Die meisten HTML Elemente haben eine öffnende Auszeichnung (Tag) und eine sich schließende. Öffnende Tags sehen so aus: <h1>. Schließende Tags so: </h1>. Beachte, dass der einzige Unterschied zwischen öffnenden und schließenden Tags in dem Slash besteht, das bei schließenden Tags auf die sich öffnende spitze Klammer folgt.", "Sobald du eine Challenge abgeschlossen hast und alle Tests erfolgreich sind, wird der Button \"Go to my next challenge\" aktiv. Klicke auf diesen – oder drücke Steuerung (Control) und gleichzeitig Enter – um zur nächsten Challenge zu gehen.", "Um den Button \"Go to my next challenge\" dieser Lektion zu aktivieren, ändere den Inhalt des h1 Tags von \"Hello\" zu \"Hello World\"." @@ -57,10 +57,10 @@ "description": [ "Over the next few challenges, we'll build an HTML5 app that will look something like this:", "\"A", - "Add an h2 tag that says \"CatPhotoApp\" to create a second HTML element below your \"Hello World\" h1 element.", "The h2 element you enter will create an h2 element on the website.", "This element tells the browser how to render the text that it contains.", - "h2 elements are slightly smaller than h1 elements. There are also h3, h4, h5 and h6 elements." + "h2 elements are slightly smaller than h1 elements. There are also h3, h4, h5 and h6 elements.", + "Add an h2 tag that says \"CatPhotoApp\" to create a second HTML element below your \"Hello World\" h1 element." ], "tests": [ "assert(($(\"h2\").length > 0), 'Create an h2 element.')", @@ -84,7 +84,7 @@ "Agrega una etiqueta h2 que diga \"CatPhotoApp\" para crear un segundo elemento HTML debajo de tu elemento h1 \"Hello World\".", "El elemento h2 que ingreses creará un elemento h2 en el sitio web.", "Este elemento le dice al navegador cómo mostrar el texto que contiene.", - "Los elementos h2 son ligeramente más pequeños que los elementos h1. También hay elementos h3, h4, h5 y h6." + "Los elementos h2 son ligeramente más pequeños que los elementos h1. También hay elementos h3, h4, h5 y h6" ], "namePt": "", "descriptionPt": [], @@ -100,9 +100,9 @@ "id": "bad87fee1348bd9aedf08801", "title": "Inform with the Paragraph Element", "description": [ - "Create a p element below your h2 element, and give it the text \"Hello Paragraph\".", "p elements are the preferred element for normal-sized paragraph text on websites. P is short for \"paragraph\".", - "You can create a p element like so: <p>I'm a p tag!</p>." + "You can create a p element like so: <p>I'm a p tag!</p>", + "Create a p element below your h2 element, and give it the text \"Hello Paragraph\"." ], "tests": [ "assert(($(\"p\").length > 0), 'Create a p element.')", @@ -123,9 +123,9 @@ "descriptionRu": [], "nameEs": "Waypoint: Informa con el Elemento Párrafo", "descriptionEs": [ - "Crea un elemento párrafo debajo de tu elemento h2, y dale el texto \"Hello Paragraph\". Apenas escribas la etiqueta de apertura <p>, una de nuestras pruebas pasarán (ya que ésta es HTML válido). Asegúrate de cerrar el elemento agregando la etiqueta de cierre </p>.", + "Crea un elemento párrafo debajo de tu elemento h2, y dale el texto \"Hello Paragraph\". Apenas escribas la etiqueta de apertura <p>, una de nuestras pruebas pasarán (ya que ésta es HTML válido). Asegúrate de cerrar el elemento agregando la etiqueta de cierre </p>", "Los elementos párrafo son los principales elementos para los párrafos de texto en tamaño normal en sitios web.", - "Tú puedes crear un elemento párrafo como éste: <p>I'm a p tag!</p>." + "Tú puedes crear un elemento párrafo como éste: <p>I'm a p tag!</p>" ], "namePt": "", "descriptionPt": [], @@ -140,10 +140,10 @@ "id": "bad87fee1348bd9aedf08802", "title": "Uncomment HTML", "description": [ - "Uncomment your h1, h2 and p elements.", "Commenting is a way that you can leave comments within your code without affecting the code itself.", "Commenting is also a convenient way to make code inactive without having to delete it entirely.", - "You can start a comment with <!-- and end a comment with -->." + "You can start a comment with <!-- and end a comment with -->", + "Uncomment your h1, h2 and p elements." ], "tests": [ "assert($(\"h1\").length > 0, 'Make your h1 element visible on your page by uncommenting it.')", @@ -170,10 +170,10 @@ "descriptionRu": [], "nameEs": "Waypoint: Quitar comentarios HTML", "descriptionEs": [ - "Quitar el comentario a los elementos h1, h2 y p.", + "Quitar el comentario a los elementos h1, h2 y p", "Crear comentarios es una forma en la que puedes dejar mensajes dentro de tu código sin afectar el resultado.", "Agregar comentarios es también una forma conveniente de desactivar tu código sin tener que borrarlo por completo.", - "Puedes comenzar un comentario con <!-- y terminar de comentar con -->." + "Puedes comenzar un comentario con <!-- y terminar de comentar con -->" ], "namePt": "", "descriptionPt": [], @@ -189,9 +189,9 @@ "id": "bad87fee1348bd9aedf08804", "title": "Comment out HTML", "description": [ - "Comment out your h1 element and your p element, but leave your h2 element uncommented.", - "Remember that in order to start a comment, you need to use <!-- and to end a comment, you need to use -->.", - "Here you'll need to end the comment before your h2 element begins." + "Remember that in order to start a comment, you need to use <!-- and to end a comment, you need to use -->", + "Here you'll need to end the comment before your h2 element begins.", + "Comment out your h1 element and your p element, but leave your h2 element uncommented." ], "tests": [ "assert(($(\"h1\").length === 0), 'Comment out your h1 element so that it is not visible on your page.')", @@ -218,8 +218,8 @@ "descriptionRu": [], "nameEs": "Waypoint: Comenta en HTML", "descriptionEs": [ - "Comenta el elemento h1 y el elemento p, pero deja sin comentar el elemento h2.", - "Recuerda que para comenzar un comentario, necesitas usar <!-- y para terminar un comentario, necesitas usar -->.", + "Comenta el elemento h1 y el elemento p, pero deja sin comentar el elemento h2", + "Recuerda que para comenzar un comentario, necesitas usar <!-- y para terminar un comentario, necesitas usar -->", "Aquí necesitarás terminar el comentario antes que comience el elemento h2." ], "namePt": "", @@ -237,8 +237,8 @@ "description": [ "Web developers traditionally use lorem ipsum text as placeholder text. It's called lorem ipsum text because those are the first two words of a famous passage by Cicero of Ancient Rome.", "lorem ipsum text has been used as placeholder text by typesetters since the 16th century, and this tradition continues on the web.", - "Well, 5 centuries is long enough. Since we're building a CatPhotoApp, let's use something called kitty ipsum text.", - "Replace the text inside your p element with the first few words of this kitty ipsum text: Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff." + "Well, 5 centuries is long enough. Since we're building a CatPhotoApp, let's use something called kitty ipsum text", + "Replace the text inside your p element with the first few words of this kitty ipsum text: Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff." ], "tests": [ "assert.isTrue((/Kitty(\\s)+ipsum(\\s)+dolor/gi).test($(\"p\").text()), 'Your p element should contain the first few words of the provided kitty ipsum text.')" @@ -260,7 +260,7 @@ "descriptionRu": [], "nameEs": "Waypoint: Llena espacios con texto de relleno", "descriptionEs": [ - "Cambia el texto en el elemento p para usar las primeras palabras del texto Kitty Ipsum.", + "Cambia el texto en el elemento p para usar las primeras palabras del texto Kitty Ipsum", "Los desarrolladores web tradicionalmente usan Lorem Ipsum como texto de relleno. Se llama texto Lorem Ipsum porque esas son las primeras dos palabras de una cita famosa de Cicerón de la Roma Antigua.", "El texto Lorem Ipsum ha sido usado como texto de relleno en las imprentas desde el siglo 16, y esta tradición continúa en la web.", "Bueno, 5 siglos es bastante. Ya que estamos construyendo una aplicación de fotos de gatos (CatPhotoApp), ¡usemos algo llamado Kitty Ipsum!", @@ -281,9 +281,9 @@ "id": "bad87fed1348bd9aedf08833", "title": "Delete HTML Elements", "description": [ - "Delete your h1 element so we can simplify our view.", "Our phone doesn't have much vertical space.", - "Let's remove the unnecessary elements so we can start building our CatPhotoApp." + "Let's remove the unnecessary elements so we can start building our CatPhotoApp.", + "Delete your h1 element so we can simplify our view." ], "tests": [ "assert(($(\"h1\").length == 0), 'Delete your h1 element.')", @@ -324,10 +324,11 @@ "id": "bad87fee1348bd9aedf08803", "title": "Change the Color of Text", "description": [ - "Change your h2 element's style so that its text color is red.", - "We can do this by changing the \"style\" of your h2 element.", + "Now let's change the color of some of our text.", + "We can do this by changing the style of your h2 element.", "The style that is responsible for the color of an element's text is the \"color\" style.", - "Here's how you would set your h2 element's text color to blue: <h2 style=\"color: blue\">CatPhotoApp</h2>." + "Here's how you would set your h2 element's text color to blue: <h2 style=\"color: blue\">CatPhotoApp</h2>", + "Change your h2 element's style so that its text color is red." ], "tests": [ "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your h2 element should be red.')" @@ -348,9 +349,9 @@ "nameEs": "Waypoint: Cambia el color del texto", "descriptionEs": [ "Cambia el estilo del elemento h2 de manera que el color de su texto sea rojo.", - "Podemos hacer esto por medio de cambiar el estilo del elemento h2.", + "Podemos hacer esto por medio de cambiar el estilo del elemento h2", "El estilo responsable del color de texto de un elemento es el estilo \"color\".", - "Así es como podrías volver el color de texto de tu elemento h2 en azul: <h2 style=\"color: blue\">CatPhotoApp</h2>." + "Así es como podrías volver el color de texto de tu elemento h2 en azul: <h2 style=\"color: blue\">CatPhotoApp</h2>" ], "namePt": "", "descriptionPt": [], @@ -358,20 +359,23 @@ "descriptionDe": [ "Ändere den Style des h2 Elements, damit die Textfarbe Rot ist.", "Wir können das bewerkstelligen, indem wir den \"style\" des h2 Elements ändern.", - "So könntest du die Textfarbe des h2 Elements in Blau ändern: <h2 style=\"color: blue\">CatPhotoApp</h2>." + "So könntest du die Textfarbe des h2 Elements in Blau ändern: <h2 style=\"color: blue\">CatPhotoApp</h2>" ] }, { "id": "bad87fee1348bd9aedf08805", "title": "Use CSS Selectors to Style Elements", "description": [ - "Delete your h2 element's style attribute and instead create a CSS style element. Add the necessary CSS to turn all h2 elements blue.", "With CSS, there are hundreds of CSS properties that you can use to change the way an element looks on your page.", - "When you entered <h2 style=\"color: red\">CatPhotoApp</h2>, you were giving that individual h2 element an inline style.", - "That's one way to add style to an element, but a better way is by using CSS, which stands for Cascading Style Sheets.", - "At the top of your code, create a style element like this: <style></style>.", - "Inside that style element, you can create a CSS selector for all h2 elements. For example, if you wanted all h2 elements to be red, your style element would look like this: <style>h2 {color: red;}</style>.", - "Note that it's important to have both opening and closing curly braces ({ and }) around each element's style. You also need to make sure your element's style is between the opening and closing style tags. Finally, be sure to add the semicolon to the end of each of your element's styles." + "When you entered <h2 style=\"color: red\">CatPhotoApp</h2>, you were giving that individual h2 element an inline style", + "That's one way to add style to an element, but a better way is by using CSS, which stands for Cascading Style Sheets", + "At the top of your code, create a style element like this: <style></style>", + "Inside that style element, you can create a CSS selector for all h2 elements. For example, if you wanted all h2 elements to be red, your style element would look like this:", + "<style>", + "  h2 {color: red;}", + "</style>", + "Note that it's important to have both opening and closing curly braces ({ and }) around each element's style. You also need to make sure your element's style is between the opening and closing style tags. Finally, be sure to add the semicolon to the end of each of your element's styles.", + "Delete your h2 element's style attribute and instead create a CSS style element. Add the necessary CSS to turn all h2 elements blue." ], "tests": [ "assert(!$(\"h2\").attr(\"style\"), 'Remove the style attribute from your h2 element.')", @@ -396,10 +400,10 @@ "descriptionEs": [ "Borra el atributo style de tu elemento h2 y escribe el CSS para hacer todos los elementos h2 de color azul.", "Con CSS, hay cientos de atributos CSS que puedes usar para cambiar como un elemento se ve en una página web.", - "Cuando entraste <h2 style=\"color: red\">CatPhotoApp<h2>, le estuviste dando a ese elemento h2 en particular un estilo en línea.", - "Esa es una forma de agregar estilo a un elemento, pero una manera mejor es usando Hojas de Estilo en Cascada (Cascading Style Sheets, CSS).", - "Al principio de tu código, crea una etiqueta style como ésta: <style></style>.", - "Dentro de ese elemento style, puedes crear un selector css para todos los elementos h2. Por ejemplo, si querías que todos los elementos h2 sean rojos, tu elemento style se vería así: <style>h2 {color: red;}</style>.", + "Cuando entraste <h2 style=\"color: red\">CatPhotoApp<h2>, le estuviste dando a ese elemento h2 en particular un estilo en línea", + "Esa es una forma de agregar estilo a un elemento, pero una manera mejor es usando Hojas de Estilo en Cascada (Cascading Style Sheets, CSS)", + "Al principio de tu código, crea una etiqueta style como ésta: <style></style>", + "Dentro de ese elemento style, puedes crear un selector css para todos los elementos h2. Por ejemplo, si querías que todos los elementos h2 sean rojos, tu elemento style se vería así: <style>h2 {color: red;}</style>", "Fíjate que es importante tener llaves de apertura y de cierre ({ y }) alrededor del estilo para cada elemento. También necesitas asegurarte que el estilo para tu elemento está entre las etiquetas style de apertura y cierre. Finalmente, asegúrate de agregar el punto y coma al final de cada uno de los estilos de tu elemento." ], "namePt": "", @@ -419,7 +423,6 @@ "id": "bad87fee1348bd9aecf08806", "title": "Use a CSS Class to Style an Element", "description": [ - "Create a CSS class called red-text and apply it to your h2 element.", "Classes are reusable styles that can be added to HTML elements.", "Here's an example CSS class declaration:", "<style>", @@ -428,9 +431,10 @@ "  }", "</style>", "You can see that we've created a CSS class called blue-text within the <style> tag.", - "You can apply a class to an HTML element like this: <h2 class=\"blue-text\">CatPhotoApp</h2>.", + "You can apply a class to an HTML element like this: <h2 class=\"blue-text\">CatPhotoApp</h2>", "Note that in your CSS style element, classes should start with a period. In your HTML elements' class declarations, classes shouldn't start with a period.", - "Instead of creating a new style element, try removing the h2 style declaration from your existing style element, then replace it with the class declaration for .red-text." + "Instead of creating a new style element, try removing the h2 style declaration from your existing style element, then replace it with the class declaration for .red-text", + "Create a CSS class called red-text and apply it to your h2 element." ], "tests": [ "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your h2 element should be red.')", @@ -458,12 +462,12 @@ "descriptionRu": [], "nameEs": "Waypoint: Utiliza una clase CSS para darle estilo a un elemento", "descriptionEs": [ - "Crea una clase CSS llamada \"red-text\" y aplicala a tu elemento h2.", + "Crea una clase CSS llamada \"red-text\" y aplicala a tu elemento h2", "Las clases son estilos reutilizables que pueden ser añadidos a elementos HTML", "Esta es la anatomía de una clase CSS:", "\"a", - "Puedes ver que hemos creado una clase CSS llamada \"blue-text\" dentro de la etiqueta <style>.", - "Puedes aplicar una clase a un elemento HTML de esta manera: <h2 class=\"blue-text\">CatPhotoApp</h2>.", + "Puedes ver que hemos creado una clase CSS llamada \"blue-text\" dentro de la etiqueta <style>", + "Puedes aplicar una clase a un elemento HTML de esta manera: <h2 class=\"blue-text\">CatPhotoApp</h2>", "Nota que en el elemento CSS style, las clases deberían comenzar con un punto. En los elementos HTML, las declaraciones de clase, NO deberían comenzar con punto. ", "En vez de de crear un nuevo elemento style, prueba remover la declaración de estilo de h2 y reemplazarla por la declaración \"red-text\"." ], @@ -476,7 +480,7 @@ "So sieht eine CSS Klasse aus:", "\"Ein", "Du siehst, dass wir die CSS Klasse \"blue-text\" innerhalb von <style> geschrieben haben.", - "Du kannst eine Klasse folgendermaßen einem HTML Element beifügen: <h2 class=\"blue-text\">CatPhotoApp</h2>.", + "Du kannst eine Klasse folgendermaßen einem HTML Element beifügen: <h2 class=\"blue-text\">CatPhotoApp</h2>", "Beachte, dass Klassen in deinem CSS style Element mit einem Punkt beginngen sollten. In deinen Klassen-Deklarationen von HTML Elementen sollten diese nicht mit einem Punkt beginnen.", "Anstatt ein neues style Element zu erstellen, versuche die h2 Style-Deklaration von deinem bereits bestehenden Style Element zu entfernen und sie mit der Klassen-Deklaration \".red-text\" zu ersetzen." ] @@ -485,15 +489,20 @@ "id": "bad87fee1348bd9aefe08806", "title": "Style Multiple Elements with a CSS Class", "description": [ - "Apply the red-text class to your h2 and p elements.", "Remember that you can attach classes to HTML elements by using class=\"your-class-here\" within the relevant element's opening tag.", - "Remember that CSS class selectors require a period at the beginning like this: .blue-text { color: blue; }, but that class declarations don't use a period, like this: <h2 class=\"blue-text\">CatPhotoApp<h2>." + "Remember that CSS class selectors require a period at the beginning like this:", + ".blue-text {", + "  color: blue;", + "}", + "But also remember that class declarations don't use a period, like this:", + "<h2 class=\"blue-text\">CatPhotoApp<h2>", + "Apply the red-text class to your h2 and p elements." ], "tests": [ "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your h2 element should be red.')", - "assert($(\"h2\").hasClass(\"red-text\"), 'Your h2 element should have the class red-text.')", + "assert($(\"h2\").hasClass(\"red-text\"), 'Your h2 element should have the class red-text')", "assert($(\"p\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your p element should be red.')", - "assert($(\"p\").hasClass(\"red-text\"), 'Your p element should have the class red-text.')" + "assert($(\"p\").hasClass(\"red-text\"), 'Your p element should have the class red-text')" ], "challengeSeed": [ "" - ], - "type": "waypoint", - "challengeType": 0, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [], - "nameDe": "", - "descriptionDe": [] } ] } diff --git a/server/utils/resources.json b/server/utils/resources.json index a634575437..c80b9dafa7 100644 --- a/server/utils/resources.json +++ b/server/utils/resources.json @@ -70,7 +70,7 @@ "Ride like the wind!", "Legen - wait for it - dary!", "Ludicrous Speed! Go!", - "Yes you can!", + "Yes we can!", "Most triumphant!", "One loop to rule them all!", "By the power of Grayskull!", From d232e03e01b8535f3c0f5055440121d91a29ae2f Mon Sep 17 00:00:00 2001 From: Michael Krebs Date: Wed, 21 Oct 2015 20:56:14 -0400 Subject: [PATCH 477/538] Adds dting's solutions to advanced bonfires --- seed/challenges/advanced-bonfires.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/seed/challenges/advanced-bonfires.json b/seed/challenges/advanced-bonfires.json index 8ff025e2fe..b68dc4b0ff 100644 --- a/seed/challenges/advanced-bonfires.json +++ b/seed/challenges/advanced-bonfires.json @@ -57,6 +57,9 @@ "MDNlinks": [ "RegExp" ], + "solutions": [ + "var re = /^(?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:\\(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*\\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$/;\n\nfunction telephoneCheck(str) {\n return !!str.match(re);\n}\n\ntelephoneCheck(\"555-555-5555\");" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", @@ -95,6 +98,9 @@ "Array.reduce()", "Symmetric Difference" ], + "solutions": [ + "function sym(args) {\n var index = -1;\n var length = arguments.length;\n var result;\n while (++index < length) {\n var array = arguments[index];\n result = result ? diff(result, array).concat(diff(array, result)) : array;\n }\n return result ? uniq(result) : [];\n}\n\nfunction uniq(arr) {\n var h = Object.create(null);\n var u = [];\n arr.forEach(function(v) {\n if (v in h) return;\n h[v] = true;\n u.push(v);\n });\n return u;\n}\n\nfunction diff(a, b) {\n var h = Object.create(null);\n b.forEach(function(v) {\n h[v] = true; \n });\n return a.filter(function(v) { return !(v in h);});\n}\nsym([1, 2, 3], [5, 2, 1, 4]);\n" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", @@ -151,6 +157,9 @@ "MDNlinks": [ "Global Object" ], + "solutions": [ + "var VALUES = [1, 5, 10, 25, 100, 500, 1000, 2000, 10000];\n\nfunction drawer(price, cash, cid) {\n cash = ~~(cash * 100);\n price = ~~(price * 100);\n var diff = cash-price;\n cid.forEach(function(c) {\n c[1] = ~~(c[1] * 100);\n });\n var totalCid = cid.reduce(function(a, c) {\n return a + c[1];\n }, 0);\n if (diff > totalCid) {\n return \"Insufficient Funds\";\n }\n if (diff === totalCid) {\n return \"Closed\";\n }\n \n var change = []; \n var index = cid.length;\n while (diff > 0 && --index > -1) {\n var t = 0;\n var value = VALUES[index];\n while (diff >= value && cid[index][1] > 0) {\n t += value;\n cid[index][1] -= value;\n diff -= value;\n }\n if (t) {\n change.push([cid[index][0], t/100]);\n }\n console.log(JSON.stringify(change));\n }\n // Here is your change, ma'am.\n return change;\n}\n\n// Example cash-in-drawer array:\n// [['PENNY', 1.01],\n// ['NICKEL', 2.05],\n// ['DIME', 3.10],\n// ['QUARTER', 4.25],\n// ['ONE', 90.00],\n// ['FIVE', 55.00],\n// ['TEN', 20.00],\n// ['TWENTY', 60.00],\n// ['ONE HUNDRED', 100.00]]\n\ndrawer(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]]);\n" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", @@ -205,6 +214,9 @@ "MDNlinks": [ "Global Array Object" ], + "solutions": [ + "function inventory(arr1, arr2) {\n arr2.forEach(function(item) {\n createOrUpdate(arr1, item);\n });\n // All inventory must be accounted for or you're fired!\n return arr1;\n}\n\nfunction createOrUpdate(arr1, item) {\n var index = -1;\n while (++index < arr1.length) {\n if (arr1[index][1] === item[1]) {\n arr1[index][0] += item[0];\n return;\n }\n if (arr1[index][1] > item[1]) {\n break;\n }\n }\n arr1.splice(index, 0, item);\n}\n\n// Example inventory lists\nvar curInv = [\n [21, 'Bowling Ball'],\n [2, 'Dirty Sock'],\n [1, 'Hair Pin'],\n [5, 'Microphone']\n];\n\nvar newInv = [\n [2, 'Hair Pin'],\n [3, 'Half-Eaten Apple'],\n [67, 'Bowling Ball'],\n [7, 'Toothpaste']\n];\n\ninventory(curInv, newInv);\n" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", @@ -246,6 +258,9 @@ "Permutations", "RegExp" ], + "solutions": [ + "function permAlone(str) {\n return permutor(str).filter(function(perm) {\n return !perm.match(/(.)\\1/g);\n }).length;\n}\n\nfunction permutor(str) {\n // http://staff.roguecc.edu/JMiller/JavaScript/permute.html\n //permArr: Global array which holds the list of permutations\n //usedChars: Global utility array which holds a list of \"currently-in-use\" characters\n var permArr = [], usedChars = [];\n function permute(input) {\n //convert input into a char array (one element for each character)\n var i, ch, chars = input.split(\"\");\n for (i = 0; i < chars.length; i++) {\n //get and remove character at index \"i\" from char array\n ch = chars.splice(i, 1);\n //add removed character to the end of used characters\n usedChars.push(ch);\n //when there are no more characters left in char array to add, add used chars to list of permutations\n if (chars.length === 0) permArr[permArr.length] = usedChars.join(\"\");\n //send characters (minus the removed one from above) from char array to be permuted\n permute(chars.join(\"\"));\n //add removed character back into char array in original position\n chars.splice(i, 0, ch);\n //remove the last character used off the end of used characters array\n usedChars.pop();\n }\n }\n permute(str);\n return permArr;\n}\n\npermAlone('aab');\n" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", @@ -291,6 +306,9 @@ "String.substr()", "parseInt()" ], + "solutions": [ + "function friendly(str) {\n var dates = str.map(function(s) {return s.split('-').map(Number);});\n var start = dates[0];\n var end = dates[1];\n if (str[0] === str[1]) {\n return [readable(start)];\n }\n if (start[0] !== end[0]) {\n if (start[0] + 1 === end[0] && start[1] > end[1]) {\n start[0] = undefined;\n end[0] = undefined;\n }\n return dates.map(readable);\n }\n start[0] = undefined;\n end[0] = undefined;\n if (start[1] !== end[1]) {\n return dates.map(readable);\n }\n end[1] = undefined;\n return dates.map(readable);\n}\n\nfunction readable(arr) {\n var ordD = arr[2] + nth(arr[2]);\n if (!arr[1]) {\n return ordD;\n }\n return MONTH[arr[1]] + \" \" + ordD + (!arr[0] ? \"\" : \", \" + arr[0]);\n}\n\nvar MONTH = {1: \"January\",\n 2: \"February\",\n 3: \"March\",\n 4: \"April\",\n 5: \"May\",\n 6: \"June\",\n 7: \"July\",\n 8: \"August\",\n 9: \"September\",\n 10: \"October\",\n 11: \"November\",\n 12: \"December\"};\n\nfunction nth(d) {\n if(d>3 && d<21) return 'th';\n switch (d % 10) {\n case 1: return \"st\";\n case 2: return \"nd\";\n case 3: return \"rd\";\n default: return \"th\";\n }\n} \n\nfriendly(['2015-07-01', '2015-07-04']);\n" + ], "type": "bonfire", "challengeType": 5, "nameCn": "", From 2e2990770e3b839157e64007ea8e56e5d0af6b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Veras?= Date: Wed, 21 Oct 2015 23:49:17 -0400 Subject: [PATCH 478/538] Updating the waypoint information After commit ec1d3ac in learnyoumongo, exercise "Find Limit" was renamed to "Find Project". --- seed/challenges/mongodb.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/mongodb.json b/seed/challenges/mongodb.json index 0fe93ba6f9..facfb56089 100644 --- a/seed/challenges/mongodb.json +++ b/seed/challenges/mongodb.json @@ -25,7 +25,7 @@ "Complete \"Mongod\"", "Complete \"Connect\"", "Complete \"Find\"", - "Complete \"Find Limit\"", + "Complete \"Find Project\"", "Complete \"Insert\"", "Complete \"Update\"", "Complete \"Remove\"", From 5ee8b50431ad7de36d09f94f51bcfa18649bcb49 Mon Sep 17 00:00:00 2001 From: junhaoyap Date: Wed, 21 Oct 2015 21:02:43 -0700 Subject: [PATCH 479/538] Make first jQuery lesson more lenient for script tag --- seed/challenges/jquery.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/seed/challenges/jquery.json b/seed/challenges/jquery.json index d4625a85a4..bff88bccfc 100644 --- a/seed/challenges/jquery.json +++ b/seed/challenges/jquery.json @@ -16,8 +16,7 @@ "This is important because without your document ready function, your code may run before your HTML is rendered, which would cause bugs." ], "tests": [ - "assert(editor.match(/