Merge branch 'staging' of github.com:FreeCodeCamp/freecodecamp into staging

This commit is contained in:
Quincy Larson
2015-08-17 23:44:53 -07:00
14 changed files with 61 additions and 32 deletions

View File

@ -1163,6 +1163,10 @@ hr {
font: normal normal normal 14px/1 FontAwesome !important;
}
#testSuite > div >.row {
margin: 0!important;
}
//uncomment this to see the dimensions of all elements outlined in red
//* {
// border-color: red;

View File

@ -71,6 +71,17 @@ editor.on("keyup", function () {
var nodeEnv = prodOrDev === 'production' ? 'http://www.freecodecamp.com' : 'http://localhost:3001';
function updatePreview() {
editorValueForIFrame = editor.getValue();
var failedCommentTest = false;
if(editorValueForIFrame.match(/\<\!\-\-/gi) && editorValueForIFrame.match(/\-\-\>/gi) == null){
failedCommentTest = true;
}
else if(editorValueForIFrame.match(/\<\!\-\-/gi) && editorValueForIFrame.match(/\<\!\-\-/gi).length > editorValueForIFrame.match(/\-\-\>/gi).length){
failedCommentTest = true;
}
if(failedCommentTest){
editor.setValue(editor.getValue()+ "-->");
editorValueForIFrame = editorValueForIFrame + "-->";
}
goodTests = 0;
var previewFrame = document.getElementById('preview');
var preview = previewFrame.contentDocument || previewFrame.contentWindow.document;

View File

@ -100,12 +100,25 @@ function bonfireExecute() {
userTests = null;
$('#codeOutput').empty();
var userJavaScript = myCodeMirror.getValue();
var failedCommentTest = false;
if(userJavaScript.match(/\/\*/gi) && userJavaScript.match(/\*\//gi) == null){
failedCommentTest = true;
}
else if(!failedCommentTest && userJavaScript.match(/\/\*/gi) && userJavaScript.match(/\/\*/gi).length > userJavaScript.match(/\*\//gi).length){
failedCommentTest = true;
}
userJavaScript = removeComments(userJavaScript);
userJavaScript = scrapeTests(userJavaScript);
// simple fix in case the user forgets to invoke their function
submit(userJavaScript, function(cls, message) {
if (cls) {
if(failedCommentTest){
myCodeMirror.setValue(myCodeMirror.getValue() + "*/");
console.log('Caught Unfinished Comment');
codeOutput.setValue("Unfinished mulit-line comment");
failedCommentTest = false;
}
else if (cls) {
codeOutput.setValue(message.error);
runTests('Error', null);
} else {

View File

@ -80,7 +80,7 @@
"sym([1, 2, 3], [5, 2, 1, 4]);"
],
"tests": [
"expect(sym([1, 2, 3], [5, 2, 1, 4])).to.equal([3, 5, 4]);",
"assert.deepEqual(sym([1, 2, 3], [5, 2, 1, 4]), [3, 5, 4], 'should return an array of unique values');",
"assert.deepEqual(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'should return the symmetric difference of the given arrays');",
"assert.deepEqual(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'should return an array of unique values');",
"assert.deepEqual(sym([1, 1]), [1], 'should return an array of unique values');"

View File

@ -157,7 +157,7 @@
"assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && editor.getValue().match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return(true);}else{return(false);}})(), 'The first letter of firstLetterOfLastName should be a L');"
],
"challengeSeed": [
"var firstLetterOfLastName = \"\";",
"var firstLetterOfFirstName = \"\";",
"var firstLetterOfLastName = \"\";",
"",
"var firstName = \"Ada\";",
@ -336,7 +336,7 @@
"// 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.",
"(function(z){return('product='+z);})(product)"
"(function(z){return('product='+z);})(product);"
],
"type": "waypoint",
"challengeType": 1
@ -398,7 +398,8 @@
"Replace the <code>0.0</code> with the correct number so that you get the result mentioned in the comments."
],
"tests": [
"assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return(true);}else{return(false);}})(), 'Make the variable <code>product</code> equal 5.0.');"
"assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return(true);}else{return(false);}})(), 'Make the variable <code>product</code> equal 5.0.');",
"assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return(true);}else{return(false);}})(), 'Make the variable <code>quotient</code> equal 2.2.');"
],
"challengeSeed": [
"var quotient = 4.4 / 2.0; // equals 2.2",
@ -553,9 +554,9 @@
"//console.log(removed); // logs 3",
"",
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"var removed = myArray; // This should be [\"cat\", 2] and myArray should now be [\"John\", 23]",
"// Only change code below this line.",
"",
"var removed = myArray; // This should be [\"cat\", 2] and myArray should now be [\"John\", 23]",
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
@ -614,11 +615,12 @@
"// ourArray now equals [\"J\", [\"cat\"]]",
"",
"var myArray = [\"John\", 23, [\"dog\", 3]];",
"var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]",
"// Only change code below this line.",
"",
"var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]",
"",
"// 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.",
"(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);"
@ -726,9 +728,9 @@
],
"challengeSeed":[
"//var ourDog = {",
"// \"name\": \"Camper\"",
"// \"legs\": 4",
"// \"tails\": 1",
"// \"name\": \"Camper\",",
"// \"legs\": 4,",
"// \"tails\": 1,",
"// \"friends\": [\"everything!\"]",
"//};",
"",
@ -766,9 +768,9 @@
],
"challengeSeed":[
"// var ourDog = {",
"// \"name\": \"Camper\"",
"// \"legs\": 4",
"// \"tails\": 1",
"// \"name\": \"Camper\",",
"// \"legs\": 4,",
"// \"tails\": 1,",
"// \"friends\": [\"everything!\"]",
"// };",
"",
@ -902,7 +904,7 @@
],
"challengeSeed":[
"function myFunction(){",
" // Make myFunction return a random number between zero and nine instead of a decimal",
" // Make myFunction return a random number betweenzero and nine> instead of a decimal",
"",
" // Only change code below this line.",
"",
@ -922,7 +924,7 @@
"title": "Generate Random Whole Numbers within a Range",
"difficulty":"9.9829",
"description":[
"We can use a certain mathematical expression to get a random number between between two numbers.",
"We can use a certain mathematical expression to get a random number between two numbers.",
"<code>Math.floor(Math.random() * (max - min + 1)) + min</code>",
"By using this we can control the output of a random number."
],
@ -956,7 +958,7 @@
"We can use if statements in JavaScript to only execute code if a certain condition is met.",
"if statements require some sort of boolean condition evaluate.",
"Example:",
"<code> if (1 == 2) {",
"<code> if (1 == 2) {</code>",
"<code>&thinsp;&thinsp;return(true);</code>",
"<code>}</code>",
"<code>else {</code>",
@ -992,7 +994,7 @@
"title": "Sift through Text with Regular Expressions",
"difficulty":"9.984",
"description":[
"<code>Regular expressions</code> are way to find certain words or patterns inside of <code>strings</code>.",
"<code>Regular expressions</code> are used to find certain words or patterns inside of <code>strings</code>.",
"For example, if we wanted to find the number of times the word <code>the</code> occurred in the string <code>The dog chased the cat</code>, we could use the following <code>regular expression</code>: <code>\/the+\/gi</code>",
"Let's break this down a bit:",
"<code>the</code> is the pattern we want to match.",
@ -1092,7 +1094,7 @@
],
"tests":[
"assert(test === 36, 'Your RegEx should have found seven spaces in the <code>testString</code>.');",
"assert(editor.getValue().match(/\\/\\\\S\\/gi/gi), 'You should be using the following expression <code>/\\S+/gi</code> to find the spaces in the <code>testString</code>.');"
"assert(editor.getValue().match(/\\/\\\\S\\/gi/gi), 'You should be using the following expression <code>/\\+S/gi</code> to find the spaces in the <code>testString</code>.');"
],
"challengeSeed":[
"var test = (function(){",

View File

@ -898,7 +898,7 @@
"<img class=\"img-responsive\" src=\"https://www.evernote.com/l/AHTFU358y71AV6mokPeuTEgrZVdUJ4A8v3AB/image.png\" alt=\"An \"inline\" button is as small as the text it contains. In this image, it's centered. Below it is a \"block-level\" button, which stretches to fill the entire horizontal space.'>",
"By using the <code>span</code> element, you can put several elements together, and even style different parts of the same element differently.",
"Nest the word \"love\" in your \"Things cats love\" element below within a <code>span</code> element. Then give that <code>span</code> the class <code>text-danger</code> to make the text red.",
"Here's how you would do this with the \"Top 3 things cats hate\" element: <code>&#60;p&#62;Top 3 things cats &#60;span class\"text-danger\"&#62;hate&#60;/span&#62;&#60;/p&#62;</code>"
"Here's how you would do this with the \"Top 3 things cats hate\" element: <code>&#60;p&#62;Top 3 things cats &#60;span class = \"text-danger\"&#62;hate&#60;/span&#62;&#60;/p&#62;</code>"
],
"tests": [
"assert($(\"p span\") && $(\"p span\").length > 0, 'Your <code>span</code> element should be inside your <code>p</code> element.')",

View File

@ -491,7 +491,7 @@
"description": [
"Apply the <code>red-text</code> class to your <code>h2</code> and <code>p</code> elements.",
"Remember that you can attach classes to HTML elements by using <code>class=\"your-class-here\"</code> within the relevant element's opening tag.",
"Remember that CSS selectors require a period at the beginning like this: <code>.blue-text { color: blue; }</code>, but that class declarations don't use a period, like this: <code>&#60;h2 class=\"blue-text\"&#62;CatPhotoApp&#60;h2&#62;</code>."
"Remember that CSS class selectors require a period at the beginning like this: <code>.blue-text { color: blue; }</code>, but that class declarations don't use a period, like this: <code>&#60;h2 class=\"blue-text\"&#62;CatPhotoApp&#60;h2&#62;</code>."
],
"tests": [
"assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your <code>h2</code> element should be red.')",
@ -2530,14 +2530,14 @@
"difficulty": 1.392,
"description": [
"One cool thing about <code>id</code> attributes is that, like classes, you can style them using CSS.",
"Here's an example of how you can take your element with the <code>id</code> attribute of <code>cat-photo-element</code> and give it the background color of green. In your <code>style</code> element: <code>#cat-photo-element { background-color: green; }></code>",
"Here's an example of how you can take your element with the <code>id</code> attribute of <code>cat-photo-element</code> and give it the background color of green. In your <code>style</code> element: <code>#cat-photo-element { background-color: green; }</code>",
"Note that inside your <code>style</code> element, you always reference classes by putting a <code>.</code> in front of their names. You always reference ids by putting a <code>#</code> in front of their names.",
"Try giving your form, which now has the <code>id</code> attribute of <code>cat-photo-form</code>, a green background."
],
"tests": [
"assert($(\"form\").attr(\"id\") === \"cat-photo-form\", 'Give your <code>form</code> element the id of <code>cat-photo-form</code>.')",
"assert($(\"#cat-photo-form\").css(\"background-color\") === \"rgb(0, 128, 0)\", 'Your <code>form</code> element should have the <code>background-color</code> of green.')",
"assert(editor.match(/<form.*cat-photo-form.*>/gi) && editor.match(/<form.*cat-photo-form.*>/gi).length > 0, 'Make sure your <code>form</code> element has both an <code>id</code> attribute.')",
"assert(editor.match(/<form.*cat-photo-form.*>/gi) && editor.match(/<form.*cat-photo-form.*>/gi).length > 0, 'Make sure your <code>form</code> element has an <code>id</code> attribute.')",
"assert(!editor.match(/<form.*style.*>/gi) && !editor.match(/<form.*class.*>/gi), 'Do not give your <code>form</code> any <code>class</code> or <code>style</code> attributes.')"
],
"challengeSeed": [

View File

@ -71,10 +71,10 @@
],
"MDNlinks": [
"Comparison Operators",
"String.slice()",
"Array.slice()",
"Array.filter()",
"Array.indexOf()",
"String.concat()"
"Array.concat()"
],
"type": "bonfire",
"challengeType": 5,

View File

@ -624,7 +624,7 @@
"Here's an example of how you would use the <code>parent()</code> function: <code>$(\"#left-well\").parent().css(\"background-color\", \"blue\")</code>"
],
"tests": [
"assert($(\"#left-well\").css(\"background-color\") === 'rgb(255, 0, 0)', 'Your <code>left-well</code> element should have a red background.')",
"assert($(\"#left-well\").css(\"background-color\") === 'red' || $(\"#left-well\").css(\"background-color\") === 'rgb(255, 0, 0)' || $(\"#left-well\").css(\"background-color\").toLowerCase() === '#ff0000' || $(\"#left-well\").css(\"background-color\").toLowerCase() === '#f00', 'Your <code>left-well</code> element should have a red background.')",
"assert(editor.match(/\\.parent\\(\\)\\.css/g), 'You should use the <code>parent()</code> function to modify this element.')",
"assert(editor.match(/<div class=\"well\" id=\"left-well\">/g), 'Only use jQuery to add these classes to the element.')"
],
@ -730,7 +730,7 @@
"description": [
"You've seen why id attributes are so convenient for targeting with jQuery selectors. But you won't always have such neat ids to work with.",
"Fortunately, jQuery has some other tricks for targeting the right elements.",
"jQuery has a function called <code>:nth-child()</code> that will allow you select the nth element of a certain class or element type.",
"jQuery uses CSS Selectors to target elements. <code>target:nth-child(n)</code> css selector allows you to select all the nth element with the target class or element type.",
"Make the second child in each of your well elements bounce.",
"Here's how you would give the third element in each well bounce: <code>$(\".target:nth-child(3)\").addClass(\"animated bounce\");</code>"
],

View File

@ -233,13 +233,13 @@
"difficulty":0,
"description":[
"filter is a useful method that can filter out values that don't match a certain criteria",
"Let's remove all the values greater than six",
"Let's remove all the values greater than five",
"<code>array = array.filter(function(val) {</code>",
"<code>&thinsp;&thinsp;return(val<4);</code>",
"<code>});</code>"
],
"tests":[
"assert.deepEqual(array, [1,2,3,4,5], 'You should have removed all the values from the array that are less than six');",
"assert.deepEqual(array, [1,2,3,4,5], 'You should have removed all the values from the array that are greater than five');",
"assert(editor.getValue().match(/array\\.filter\\(/gi), 'You should be using the filter method to remove the values from the array');",
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7\\,8\\,9\\,10\\]/gi), 'You should only be using .filter to modify the contents of the array');"
],

View File

@ -22,7 +22,7 @@ export default function prodErrorHandler() {
var accept = accepts(req);
var type = accept.type('html', 'json', 'text');
var message = 'opps! Something went wrong. Please try again later';
var message = 'Oops! Something went wrong. Please try again later';
if (type === 'html') {
if (typeof req.flash === 'function') {
req.flash('errors', {

View File

@ -18,7 +18,7 @@ block content
i.fa.fa-linkedin
| Sign in with LinkedIn
br
p Email sign in is temporarily disabled - we are working to fix this ASAP. Try logging in with an above service that uses the same email address as you normally use to sign in with (other than Twitter).
p Email sign in is temporarily disabled - we are working to fix this ASAP.
//p
// a(href="/email-signup") Or sign up using your email address here.
//p

View File

@ -30,7 +30,6 @@ block content
.col-xs-12.col-sm-9.col-md-10
li.large-p.faded.negative-10
a(href='#' + challengeBlock.dashedName)= challengeBlock.name
h3= challengeBlock
else
.hidden-xs.col-sm-3.col-md-2
.progress.progress-bar-padding.text-center.thin-progress-bar

View File

@ -73,7 +73,7 @@ block content
textarea#codeEditor(autofocus=true, style='display: none;')
.col-md-4.col-lg-3
.hidden-xs.hidden-sm
img.iphone-position.iframe-scroll(src="https://s3.amazonaws.com/freecodecamp/iphone6-frame.png")
img.iphone-position.iframe-scroll(src="https://s3.amazonaws.com/freecodecamp/iphone6-frame.png", style = "z-index: -2;")
iframe.iphone.iframe-scroll#preview
.spacer
#complete-courseware-dialog.modal(tabindex='-1')