From f0f4e85cb05957e32f2c4e1603b2ea1a60649989 Mon Sep 17 00:00:00 2001 From: letalumil Date: Sun, 15 Feb 2015 04:50:47 +0300 Subject: [PATCH 01/12] Fix 'Chunky Monkey' bonfire EntryPoint typo --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 869df527a0..9d8bbbbcdf 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -172,7 +172,7 @@ "description": [ "Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array." ], - "challengeSeed": "function chunk(arr, size) {\n // Break it up.\r\n return arr;\r\n}\n\nchunk((['a', 'b', 'c', 'd'], 2));", + "challengeSeed": "function chunk(arr, size) {\n // Break it up.\r\n return arr;\r\n}\n\nchunk(['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');", From a2d66b4b96e42214b4a798c6bdf43c89faa1bf63 Mon Sep 17 00:00:00 2001 From: letalumil Date: Sun, 15 Feb 2015 04:51:52 +0300 Subject: [PATCH 02/12] Fix 'Slasher Flick' bonfire seed function signature --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 9d8bbbbcdf..0b80761795 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -186,7 +186,7 @@ "description": [ "Return the remaining elements of an array after chopping off n elements from the head." ], - "challengeSeed": "function slasher(arr) {\n // it doesn't allways pay to be first\r\n return arr;\r\n}\n\nslasher([1, 2, 3], 2);", + "challengeSeed": "function slasher(arr, howMany) {\n // it doesn't allways pay to be first\r\n return arr;\r\n}\n\nslasher([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 when n < 1');", From 0e377c572829061d2b0cd3c9b5c4df8d73697a9d Mon Sep 17 00:00:00 2001 From: letalumil Date: Sun, 15 Feb 2015 04:54:56 +0300 Subject: [PATCH 03/12] Fix 'Where art thou' bonfire. Fixes #96 --- seed_data/bonfires.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 0b80761795..933e0de778 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -208,6 +208,20 @@ "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');" ] }, + { + "_id":"a8e512fbe388ac2f9198f0fa", + "name":"Where art thou", + "difficulty":"1.55", + "description":[ + "Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument)." + ], + "challengeEntryPoint":"where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });", + "challengeSeed":"function where(collection, source) {\n var arr = [];\r\n // What's in a name?\r\n return arr;\r\n}", + "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');" + ] + }, { "_id":"a39963a4c10bc8b4d4f06d7e", "name":"Seek and Destroy", From cf288c7daf17f303aa63a1c00bd00b9688a16968 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Sun, 15 Feb 2015 11:51:56 -0500 Subject: [PATCH 04/12] Switch to angular jqlite for class manipulation on pairedwith form in bonfire/show --- public/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/main.js b/public/js/main.js index a9bca401e2..7976c4f6d1 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -197,7 +197,7 @@ profileValidation.directive('existingUsername', ['$http', function($http) { if (element.val().length > 0) { ngModel.$setValidity('exists', false); } else { - $('#completed-with').removeClass('ng-dirty'); + element.removeClass('ng-dirty'); ngModel.$setPristine(); } if (element.val()) { From b93b2af97cc3e7cce02079959634f79662b1711a Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Sun, 15 Feb 2015 11:57:48 -0500 Subject: [PATCH 05/12] Cleaning up challengeSeed for where-art-though and adding it back into pool of available challenges --- seed_data/bonfires.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 933e0de778..40a1de8457 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -215,8 +215,7 @@ "description":[ "Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument)." ], - "challengeEntryPoint":"where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });", - "challengeSeed":"function where(collection, source) {\n var arr = [];\r\n // What's in a name?\r\n return arr;\r\n}", + "challengeSeed":"function where(collection, source) {\n var arr = [];\r\n // What's in a name?\r\n return arr;\r\n}\n\nwhere([{ 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');" From ef6ad60778cd8aa98c8eaa896fd88bb2a5f3d244 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Sun, 15 Feb 2015 17:54:46 -0500 Subject: [PATCH 06/12] Updated infinite redirect on boo who challenge --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 40a1de8457..b9f0a14f44 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -287,7 +287,7 @@ }, { "_id": "a77dbc43c33f39daa4429b4f", - "name": "Boo who?", + "name": "Boo who", "difficulty": "2.06", "description": [ "Check if a value is classified as a boolean primitive. Return true or false.", From c1115cbc7c3102b4ff85a5a031077e6518bc0949 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Sun, 15 Feb 2015 18:08:11 -0500 Subject: [PATCH 07/12] more fixes for boo who --- seed_data/bonfires.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index b9f0a14f44..7b02f05bf0 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -293,15 +293,12 @@ "Check if a value is classified as a boolean primitive. Return true or false.", "Boolean primitives are true and false." ], - "challengeSeed": "function boo(boolean) {\n // What is the new fad diet for ghost developers? The Boolean.\r\n return boolean;\r\n}\n\nboo(null);", + "challengeSeed": "function boo(bool) {\n // What is the new fad diet for ghost developers? The Boolean.\r\n return bool;\r\n}\n\nboo(null);", "tests": [ "assert.strictEqual(boo(true), true);", "assert.strictEqual(boo(false), true);", - "assert.strictEqual(boo(Object(true)), true);", - "assert.strictEqual(boo(Object(false)), true);", - "assert.strictEqual(boo(args), false);", "assert.strictEqual(boo([1, 2, 3]), false);", - "assert.strictEqual(boo(slice), false);", + "assert.strictEqual(boo([].slice), false);", "assert.strictEqual(boo({ 'a': 1 }), false);", "assert.strictEqual(boo(1), false);", "assert.strictEqual(boo(NaN), false);", From 6b6ffe0ae43d2dd1846253bebc60388cd5d9b382 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Sun, 15 Feb 2015 19:25:57 -0500 Subject: [PATCH 08/12] Fix naming of spinal tap case so bonfire can return it --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 7b02f05bf0..602b431f64 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -333,7 +333,7 @@ }, { "_id": "a103376db3ba46b2d50db289", - "name": "Spinal-Tap-Case", + "name": "Spinal Tap Case", "difficulty": "2.08", "description": [ "Convert a string to spinal case." From d12e25f250b91afc01a43af0067d7026c39473fa Mon Sep 17 00:00:00 2001 From: Branden Byers Date: Sun, 15 Feb 2015 20:46:36 -0600 Subject: [PATCH 09/12] Update sorted union bonfire description A camper requested more clarification on this challenge. Re-reading it, it was convoluted as to how the returned array should have been ordered. --- seed_data/bonfires.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 7b02f05bf0..956cb5c2db 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -310,7 +310,9 @@ "name": "Sorted Union", "difficulty": "2.07", "description": [ - "Write a function that takes two or more arrays and returns a new array of unique values sorted in order." + "Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.", + "The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.", + "Check the assertion tests for examples." ], "challengeSeed": "function unite(arr) {\n return arr;\r\n}\n\nunite([1, 2, 3], [5, 2, 1, 4], [2, 1]);", "tests": [ @@ -564,4 +566,4 @@ "assert.deepEqual(inventory([[0, 'Bowling Ball'], [0, 'Dirty Sock'], [0, 'Hair pin'], [0, 'Microphone']], [[1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [1, 'Bowling Ball'], [1, 'Toothpaste']]), [[1, 'Bowling Ball'], [1, 'Dirty Sock'], [1, 'Hair pin'], [1, 'Half-Eaten Apple'], [1, 'Microphone'], [1, 'Toothpaste']]);" ] } -] \ No newline at end of file +] From 0df8fd394da7915b9c42366f69681ea4c786cbb0 Mon Sep 17 00:00:00 2001 From: letalumil Date: Mon, 16 Feb 2015 07:44:06 +0300 Subject: [PATCH 10/12] Remove duplicate initialization of bob variable in the 'Make a Person' bonfire --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 956cb5c2db..3ca68f70c5 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -477,7 +477,7 @@ "Those methods are getFirstName(), getLastName(), getFullName(), setFirstName(), setLastName(), and setFullName().", "These methods must be the only available means for interacting with the object." ], - "challengeSeed": "var Person = function(firstAndLast) {\n return firstAndLast;\r\n};\n\nvar bob = new Person('Bob Ross');\n\nvar bob = new Person('Bob Ross');\nbob.getFullName();", + "challengeSeed": "var Person = function(firstAndLast) {\n return firstAndLast;\r\n};\n\nvar bob = new Person('Bob Ross');\nbob.getFullName();", "tests": [ "expect(Object.keys(bob).length).to.eql(6);", "expect(bob instanceof Person).to.be.true;", From d0c2f6ccca3e6314d8f4cab9cb4f83ca580d9ab3 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Mon, 16 Feb 2015 00:03:35 -0500 Subject: [PATCH 11/12] Fixing up more bonfires --- controllers/bonfire.js | 3 +-- seed_data/bonfires.json | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/controllers/bonfire.js b/controllers/bonfire.js index 49b143fd43..d67edf35c4 100644 --- a/controllers/bonfire.js +++ b/controllers/bonfire.js @@ -88,7 +88,7 @@ exports.returnIndividualBonfire = function(req, res, next) { return res.redirect('/bonfires'); } - bonfire = bonfire.pop() + bonfire = bonfire.pop(); var dashedNameFull = bonfire.name.toLowerCase().replace(/\s/g, '-'); if (dashedNameFull != dashedName) { return res.redirect('../bonfires/' + dashedNameFull); @@ -113,7 +113,6 @@ exports.returnIndividualBonfire = function(req, res, next) { bonfireHash: bonfire._id }); - }); }; diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 5e28745827..17d487b937 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -314,7 +314,7 @@ "The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.", "Check the assertion tests for examples." ], - "challengeSeed": "function unite(arr) {\n return arr;\r\n}\n\nunite([1, 2, 3], [5, 2, 1, 4], [2, 1]);", + "challengeSeed": "function unite(arr1, arr2, arr3) {\n return arr1;\r\n}\n\nunite([1, 2, 3], [5, 2, 1, 4], [2, 1]);", "tests": [ "assert.deepEqual(unite([1, 3, 2], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4], 'should return the union of the given arrays');", "assert.deepEqual(unite([1, 3, 2], [1, [5]], [2, [4]]), [1, 3, 2, [5], [4]], 'should not flatten nested arrays');" @@ -338,7 +338,7 @@ "name": "Spinal Tap Case", "difficulty": "2.08", "description": [ - "Convert a string to spinal case." + "Convert a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes." ], "challengeSeed": "function spinalCase(str) {\n // \"It's such a fine line between stupid, and clever.\"\r\n // --David St. Hubbins\r\n return str;\r\n}\n\nspinalCase('This Is Spinal Tap');", "tests": [ @@ -460,12 +460,14 @@ "name": "Everything Be True", "difficulty": "2.21", "description": [ - "Check if the predicate (second argument) returns truthy for all elements of a collection (first argument)." + "Check if the predicate (second argument) returns truthy (defined) for all elements of a collection (first argument).", + "For this, check to see if the property defined in the second argument is present on every element of the collection.", + "Remember, you can access object properties through either dot notation or [] notation." ], "challengeSeed": "function every(collection, pre) {\n // Does everyone have one of these?\r\n return pre;\r\n}\n\nevery([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex');", "tests": [ "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex'), true, 'should return true if predicate returns truthy for all elements in the collection');", - "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex', 'female'}), false, 'should return false if predicate returns falsey for any element in the collection');" + "assert.strictEqual(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], {'sex': 'female'}), false, 'should return false if predicate returns falsey for any element in the collection');" ] }, { From cf941c3666ca6bdafdb07321b694a40e552a8228 Mon Sep 17 00:00:00 2001 From: letalumil Date: Mon, 16 Feb 2015 10:02:35 +0300 Subject: [PATCH 12/12] Fix 'Cash Register' bonfire bug. Closes #103 --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 9af6ce4be4..776bcc0636 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -546,7 +546,7 @@ "expect(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", "expect(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');", - "assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 80.00], ['TEN', 10.00], ['FIVE', 5], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');", + "assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');", "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), 'Insufficient Funds', 'insufficient funds');", "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), \"Closed\", 'cash-in-drawer equals change');" ]