From 46d185a503a547c826ec9c9cbac39e036f042a84 Mon Sep 17 00:00:00 2001 From: Geoff Storbeck Date: Mon, 30 Mar 2015 23:27:09 -0400 Subject: [PATCH 1/3] added 5 new bonfires --- seed_data/bonfires.json | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index c298c97db7..df3fe15d5d 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -302,6 +302,68 @@ "assert.deepEqual(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');" ] }, + { + "_id": "a7f4d8f2483413a6ce226cac", + "name": "Roman Numeral Converter", + "tests": [ + "expect(convert(\"xii\")).to.equal(12);", + "expect(convert(\"XLII\")).to.equal(42);", + "expect(convert(9)).to.equal(\"IX\");" + ], + "difficulty": "2.02", + "description": [ + "Convert between roman numerals and numbers depending on the input given.", + "If input is given a roman numeral return the integer equivalent", + "If input is given in an integer give the roman numeral equivalent" + ], + "challengeSeed": "function convert(num) {\n return num;\r\n}\n\nconvert(36);" + }, + { + "_id": "a0b5010f579e69b815e7c5d6", + "name": "Search and Replace", + "tests": [ + "expect(replace(\"Let's go to the store\", \"store\", \"mall\")).to.equal(\"Let's go to the mall\");", + "expect(replace(\"He's sleeping on the couch\", \"sleeping\", \"sitting\")).to.equal(\"He's sitting on the couch\");", + "expect(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\")).to.equal(\"This has a spelling error\");", + "expect(replace(\"His name is Tom\", \"Tom\", \"john\")).to.equal(\"His name is John\");" + ], + "difficulty": "2.03", + "description": [ + "Perform a search and replace on a string", + "Use the second argument as the before and the third as the after", + "Note: Keep the same capitalization on the new word as the old word" + ], + "challengeSeed": "function replace(str, before, after) {\n return str;\r\n}\n\nreplace(\"A quick brown fox jumped over the lazy dog\", \"jumped\", \"leaped\");" + }, + { + "_id": "aa7697ea2477d1316795783b", + "name": "Pig Latin", + "tests": [ + "expect(translate(\"California\")).to.equal(\"Aliforniacay\");", + "expect(translate(\"paragraphs\")).to.equal(\"aragraphspay\");", + "expect(translate(\"algorithm\")).to.equal(\"algorithmway\");" + ], + "difficulty": "2.04", + "description": [ + "Translate the provided string to pig latin" + ], + "challengeSeed": "function translate(str) {\n return str;\r\n}\n\ntranslate(\"consonant\");" + }, + { + "_id": "afd15382cdfb22c9efe8b7de", + "name": "DNA Pairing", + "tests": [ + "assert.deepEqual(pair(\"ATCGA\"),[['A','T'],['T','A'],['C','G'],['G','C'],['A','T']], 'should return the dna pair');", + "assert.deepEqual(pair(\"TTGAG\"),[['T','A'],['T','A'],['G','C'],['A','T'],['G','C']], 'should return the dna pair');", + "assert.deepEqual(pair(\"CTCTA\"),[['C','G'],['T','A'],['C','G'],['T','A'],['A','T']], 'should return the dna pair');" + ], + "difficulty": "2.05", + "description": [ + "Translate the DNA string and create a 2D array of base pairs", + "Return the provided character as the first element in each array." + ], + "challengeSeed": "function pair(str) {\n return str;\r\n}\n\npair(\"GCG\");" + }, { "_id": "af7588ade1100bde429baf20", "name" : "Missing letters", @@ -669,5 +731,26 @@ "expect(permAlone('abfdefa')).to.equal(2640);", "expect(permAlone('zzzzzzzz')).to.equal(0);" ] + }, + { + "_id": "a19f0fbe1872186acd434d5a", + "name": "Friendly Date Ranges", + "difficulty": "4.05", + "description": [ + "Implement a way of converting two dates into a more friendly date range that could be presented to a user.", + "It must not show any redundant information in the date range.", + "For example, if the year and month are the same then only the day range should be displayed.", + "Secondly, if the starting year is the current year, and the ending year can be inferred by the reader, the year should be omitted.", + "Input date is formatted as YYYY-MM-DD" + ], + "challengeSeed": "function friendly(str) {\n return str;\n}\n\nfriendly(['2015-07-01', '2015-07-04']);", + "tests": [ + "assert.deepEqual(friendly(['2015-07-01', '2015-07-04']), ['July 1st','4th'], 'ending month should be omitted since it is already mentioned');", + "assert.deepEqual(friendly(['2015-12-01', '2016-02-03']), ['December 1st','February 3rd'], 'one month apart can be inferred it is the next year');", + "assert.deepEqual(friendly(['2015-12-01', '2017-02-03']), ['December 1st, 2015','February 3rd, 2017']);", + "assert.deepEqual(friendly(['2016-03-01', '2016-05-05']), ['March 1st','May 5th, 2016']);", + "assert.deepEqual(friendly(['2017-01-01', '2017-01-01']), ['January 1st, 2017'], 'since we do not duplicate only return once');", + "assert.deepEqual(friendly(['2022-09-05', '2023-09-04']), ['September 5th, 2022','September 4th, 2023']);" + ] } ] From 003f6c6c0a31886800c735dde421d06763a0ba58 Mon Sep 17 00:00:00 2001 From: Geoff Storbeck Date: Tue, 31 Mar 2015 19:07:22 -0400 Subject: [PATCH 2/3] Updated language and added more test cases --- seed_data/bonfires.json | 42 ++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index df3fe15d5d..85f2521c33 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -239,7 +239,7 @@ "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", @@ -306,15 +306,16 @@ "_id": "a7f4d8f2483413a6ce226cac", "name": "Roman Numeral Converter", "tests": [ - "expect(convert(\"xii\")).to.equal(12);", - "expect(convert(\"XLII\")).to.equal(42);", - "expect(convert(9)).to.equal(\"IX\");" + "expect(convert(12)).to.equal(\"XII\");", + "expect(convert(5)).to.equal(\"V\");", + "expect(convert(9)).to.equal(\"IX\");", + "expect(convert(29)).to.equal(\"XXIX\");", + "expect(convert(16)).to.equal(\"XVI\");" ], "difficulty": "2.02", "description": [ - "Convert between roman numerals and numbers depending on the input given.", - "If input is given a roman numeral return the integer equivalent", - "If input is given in an integer give the roman numeral equivalent" + "Convert the number be a roman numeral.", + "All roman numerals answers should be provided in upper-case." ], "challengeSeed": "function convert(num) {\n return num;\r\n}\n\nconvert(36);" }, @@ -322,16 +323,18 @@ "_id": "a0b5010f579e69b815e7c5d6", "name": "Search and Replace", "tests": [ - "expect(replace(\"Let's go to the store\", \"store\", \"mall\")).to.equal(\"Let's go to the mall\");", - "expect(replace(\"He's sleeping on the couch\", \"sleeping\", \"sitting\")).to.equal(\"He's sitting on the couch\");", + "expect(replace(\"Let us go to the store\", \"store\", \"mall\")).to.equal(\"Let us go to the mall\");", + "expect(replace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\")).to.equal(\"He is Sitting on the couch\");", "expect(replace(\"This has a spellngi error\", \"spellngi\", \"spelling\")).to.equal(\"This has a spelling error\");", - "expect(replace(\"His name is Tom\", \"Tom\", \"john\")).to.equal(\"His name is John\");" + "expect(replace(\"His name is Tom\", \"Tom\", \"john\")).to.equal(\"His name is John\");", + "expect(replace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\")).to.equal(\"Let us get back to more Bonfires\");" ], "difficulty": "2.03", "description": [ - "Perform a search and replace on a string", - "Use the second argument as the before and the third as the after", - "Note: Keep the same capitalization on the new word as the old word" + "Perform a search and replace on the sentence using the arguments provided and return the new sentence.", + "First argument is the sentence the perform the search and replace on.", + "Second argument is the word that you will be replacing (before).", + "Third argument is what you will be replacing the second argument with (after)." ], "challengeSeed": "function replace(str, before, after) {\n return str;\r\n}\n\nreplace(\"A quick brown fox jumped over the lazy dog\", \"jumped\", \"leaped\");" }, @@ -339,13 +342,17 @@ "_id": "aa7697ea2477d1316795783b", "name": "Pig Latin", "tests": [ - "expect(translate(\"California\")).to.equal(\"Aliforniacay\");", + "expect(translate(\"california\")).to.equal(\"aliforniacay\");", "expect(translate(\"paragraphs\")).to.equal(\"aragraphspay\");", - "expect(translate(\"algorithm\")).to.equal(\"algorithmway\");" + "expect(translate(\"glove\")).to.equal(\"oveglay\");", + "expect(translate(\"algorithm\")).to.equal(\"algorithmway\");", + "expect(translate(\"eight\")).to.equal(\"eightway\");" ], "difficulty": "2.04", "description": [ - "Translate the provided string to pig latin" + "Translate the provided string to pig latin.", + "Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an \"ay\".", + "If a word begins with a vowel you just add \"way\" to the end." ], "challengeSeed": "function translate(str) {\n return str;\r\n}\n\ntranslate(\"consonant\");" }, @@ -359,7 +366,8 @@ ], "difficulty": "2.05", "description": [ - "Translate the DNA string and create a 2D array of base pairs", + "The DNA strand is missing the pairing element. Match each character with the missing element and return the results as a 2d array.", + "Base pairs are a pair of AT and CG. Match the missing element to the provided character.", "Return the provided character as the first element in each array." ], "challengeSeed": "function pair(str) {\n return str;\r\n}\n\npair(\"GCG\");" From e6272d4c7e34f382683450b9f14c1ec8bfb8ab45 Mon Sep 17 00:00:00 2001 From: Geoff Storbeck Date: Sat, 4 Apr 2015 12:22:29 -0400 Subject: [PATCH 3/3] Forgot comma on the end of the new entry to bonfireMDNlinks.js --- seed_data/bonfireMDNlinks.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/seed_data/bonfireMDNlinks.js b/seed_data/bonfireMDNlinks.js index e604b63919..4c053f9b65 100644 --- a/seed_data/bonfireMDNlinks.js +++ b/seed_data/bonfireMDNlinks.js @@ -1,7 +1,7 @@ // MDN Links /* These links are for Bonfires. Each key/value pair is used to render a Bonfire with approrpiate links. - + The text of the key is what the link text will be, e.g. Global Array Object General convention is to use the page title of the MDN reference page. @@ -14,6 +14,10 @@ var links = "Global String Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "Boolean Objects" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", + // ========= GLOBAL OBJECT METHODS + "parseInt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt", + + // ========= PROPERTIES/MISC "String.length" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length", "Arguments object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments", @@ -57,7 +61,7 @@ var links = "Array.sort()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort", "Array.splice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice", "Array.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString", - + // ======== GENERAL JAVASCRIPT REFERENCES "Arithmetic Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators", "Comparison Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators"