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

pull/1637/head
Quincy Larson 2015-08-06 23:19:18 -07:00
commit c5ad1ad851
6 changed files with 19 additions and 14 deletions

View File

@ -74,10 +74,10 @@
" return arr;",
"}",
"",
"orbitalPeriod([{name : \"sputkin\", avgAlt : 35873.5553}]);"
"orbitalPeriod([{name : \"sputnik\", avgAlt : 35873.5553}]);"
],
"tests": [
"expect(orbitalPeriod([{name : \"sputkin\", avgAlt : 35873.5553}])).to.eqls([{name: \"sputkin\", orbitalPeriod: 86400}]);",
"expect(orbitalPeriod([{name : \"sputnik\", avgAlt : 35873.5553}])).to.eqls([{name: \"sputnik\", orbitalPeriod: 86400}]);",
"expect(orbitalPeriod([{name: \"iss\", avgAlt: 413.6}, {name: \"hubble\", avgAlt: 556.7}, {name: \"moon\", avgAlt: 378632.553}])).to.eqls([{name : \"iss\", orbitalPeriod: 5557}, {name: \"hubble\", orbitalPeriod: 5734}, {name: \"moon\", orbitalPeriod: 2377399}]);"
],
"MDNlinks": [

View File

@ -573,12 +573,12 @@
"difficulty": "9.9817",
"description": [
"Another common way in which we can manipulate the data in an array is through <code>.shift() </code>",
"<code>.shift()</code>is used to \"shift\" a value from the start of an array. We can retrieve this value by preforming the shift in a variable declaration.",
"<code>.shift()</code>is used to \"shift\" a value from the start of an array. We can retrieve this value by performing the shift in a variable declaration.",
"Let's try <code>.shift()</code>now"
],
"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 first two values left([\"John\", 23])');",
"assert((function(d){if(d === 'John' && typeof(removed) === 'function'){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');"
"assert((function(d){if(d === 'John' && typeof(removed) === 'string'){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');"
],
"challengeSeed": [
"var myArray = ['John', 23, ['dog', 3]];",
@ -834,8 +834,8 @@
"dashedName": "waypoint-generate-random-fractions-with-javascript",
"difficulty":"9.9827",
"description":[
"Random numbers are a very useful for creating random behaviours and games",
"Javascript has a <code>Math.random()</code> method that can generate a random decimal number",
"Random numbers are very useful for creating random behaviours and games",
"JavaScript has a <code>Math.random()</code> method that can generate a random decimal number",
"Let's have a go of <code>Math.random()</code> now be getting <code>myFunction</code> to return a random number"
],
"tests":[
@ -1046,7 +1046,7 @@
"dashedName": "waypoint-invert-regular-expression-matches-with-javaScript",
"difficulty":"9.987",
"description":[
"Use <code>/\\S+/gi;</code> to match everything that isn't a space in the string",
"Use <code>/\\S/gi;</code> to match everything that isn't a space in the string",
"You can invert any match by using the uppercase version of the selector <code>\\s</code> versus <code>\\S</code> for example"
],
"tests":[

View File

@ -17,9 +17,9 @@
"Go to <a href='http://codepen.io' target='_blank'>http://codepen.io</a> and create an account.",
"Click your user image in the top right corner, then click the \"New pen\" button that drops down.",
"Drag the windows around and press the buttons in the lower-right hand corner to change the orientation to suit your preference.",
"Click the gear next to CSS. Then in the \"External CSS File or Another Pen\" text field, type \"bootstrap\" and scroll down until you see the latest version of Bootstrap. Click it.",
"Click the gear next to CSS. Click the \"Quick-add...\" select box and choose Bootstrap.",
"Verify that bootstrap is active by adding the following code to your HTML: <code>&lt;h1 class='text-primary'&gt;Hello CodePen!&lt;/h1&gt;</code>. The text's color should be Bootstrap blue.",
"Click the gear next to JavaScript. Click the \"Latest version of...\" select box and choose jQuery.",
"Click the gear next to JavaScript. Click the \"Quick-add...\" select box and choose jQuery.",
"Now add the following code to your JavaScript: <code>$(document).ready(function() { $('.text-primary').text('Hi CodePen!') });</code>. Click the \"Save\" button at the top. Your \"Hello CodePen!\" should change to \"Hi CodePen!\". This means that jQuery is working.",
"You can use this CodePen that you've just created as a starting point for your Ziplines. Just click the \"fork\" button at the top of your CodePen and it will create a duplicate CodePen.",
"Now you're ready for your first Zipline. Click the \"I've completed this challenge\" button."

View File

@ -3348,11 +3348,11 @@
"dashedName": "waypoint-override-all-other-styles-by-using-important",
"difficulty": 1.53,
"description": [
"Yay! we just proved that in-line styles will override all the CSS declarations in your <code>style</code> element.",
"Yay! We just proved that in-line styles will override all the CSS declarations in your <code>style</code> element.",
"But wait. There's one last way to override CSS. This is the most powerful method of all. But before we do it, let's talk about why you would ever want to override CSS.",
"In many situations, you will use CSS libraries. These may accidentally override your own CSS. So when you absolutely need to be sure that an element has specific CSS, you can use <code>!important</code>.",
"Let's go all the way back to our \"pink-text\" class declaration. Remember that our \"pink-text\" class was overridden by subsequent class declarations, id declarations, and in-line styles.",
"Let's add the keyword <code>!important</code> to your body' element's color declaration to make 100% sure that your <code>h1</code> element will be pink.",
"Let's add the keyword <code>!important</code> to your pink-text element's color declaration to make 100% sure that your <code>h1</code> element will be pink.",
"An example of how to do this is: <code>color: red !important;</code>"
],
"tests": [
@ -3516,7 +3516,7 @@
],
"tests": [
"assert($('body').css('background-color') === 'rgb(0, 255, 0)', 'Give your <code>body</code> element the background-color of green.')",
"assert(editor.match(/#00FF00/g) && editor.match(/#00FF00/g).length > 0, 'Use hex code the color green instead of the word \"green\". For example <code>body: { color: #00FF00; }</code>.')"
"assert(editor.match(/#00[Ff]{2}00/g) && editor.match(/#00[Ff]{2}00/g).length > 0, 'Use hex code the color green instead of the word \"green\". For example <code>body: { color: #00FF00; }</code>.')"
],
"challengeSeed": [
"<style>",

View File

@ -385,7 +385,7 @@ module.exports = function(app) {
);
}
})
.withLatestFrom(Rx.Observable.just(req.user), function(user, pairedWith) {
.withLatestFrom(Rx.Observable.just(req.user), function(pairedWith, user) {
return {
user: user,
pairedWith: pairedWith

View File

@ -62,7 +62,12 @@ module.exports = {
},
unDasherize: function unDasherize(name) {
return ('' + name).replace(/\-/g, ' ').trim();
return ('' + name)
// replace dash with space
.replace(/\-/g, ' ')
// strip nonalphanumarics chars except whitespace
.replace(/[^a-zA-Z\d\s]/g, '')
.trim();
},
getChallengeMapForDisplay: function() {