diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9511ab33cc..6830f00dc5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,6 @@ 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 `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). +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` would 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 summary 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](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Pull-Request-Contribute) 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). diff --git a/README.md b/README.md index 7590eccafe..9b0c87d631 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Welcome to Free Code Camp's open source codebase! ======================= -Free Code Camp is an open-source community of busy people who learn to code, then build projects for nonprofits. +Free Code Camp is an open-source community of busy people who learn to code and build projects for nonprofits. Our campers (students) start by working through our free, self-paced, browser-based curriculum. Next, they build several practice projects. Finally, we pair two campers together with a stakeholder from a nonprofit organization, and help them build the solution the nonprofit has requested. @@ -24,7 +24,7 @@ This code is running live at [FreeCodeCamp.com](http://www.FreeCodeCamp.com). We Wiki ------------ -We would love your help expanding our [wiki](https://github.com/freecodecamp/freecodecamp/wiki) with more information about learning to code and getting a coding job. +We would love your help expanding our [wiki](https://github.com/freecodecamp/freecodecamp/wiki). Our goal is to become a great resource for people learning to code, building local coding communities, and applying for coding jobs. Contributing ------------ @@ -35,9 +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 `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). +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` would 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 summary 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](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Pull-Request-Contribute) 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 ------------- @@ -110,8 +110,8 @@ DEBUG=true # Start the mongo server mongod -# Create your mongo database. -# Type "mongo" in your terminal to access the mongo shell +# Create your mongo database. +# Type "mongo" in your terminal to access the mongo shell use freecodecamp # Exit the mongo shell with control + d diff --git a/bower.json b/bower.json index cd8cfd5cf3..1f833167fc 100644 --- a/bower.json +++ b/bower.json @@ -26,6 +26,7 @@ "moment": "~2.10.2", "angular-bootstrap": "~0.13.0", "ramda": "~0.13.0", - "jshint": "~2.7.0" + "jshint": "~2.7.0", + "lightbox2": "~2.8.1" } } diff --git a/client/commonFramework.js b/client/commonFramework.js index be5be4533c..3a8a0c808a 100644 --- a/client/commonFramework.js +++ b/client/commonFramework.js @@ -1,6 +1,23 @@ -/* globals jailed, CodeMirror, challenge_Id, challenge_Name, challengeType */ +// common namespace +// all classes should be stored here +var common = common || { + // init is an array of functions that are + // called at the beginning of dom ready + init: [] +}; + +common.challengeName = common.challengeName || window.challenge_Name ? + window.challenge_Name : + ''; + +common.challengeType = common.challengeType || window.challengeType ? + window.challengeType : + 0; + +common.challengeId = common.challengeId || window.challenge_Id; + // codeStorage -var codeStorageFactory = (function($, localStorage) { +common.codeStorageFactory = (function($, localStorage) { var CodeStorageProps = { version: 0.01, @@ -68,8 +85,45 @@ var codeStorageFactory = (function($, localStorage) { return codeStorageFactory; }($, localStorage)); -var sandBox = (function() { +common.codeOutput = (function(CodeMirror, document, challengeType) { + if (!CodeMirror) { + return {}; + } + if ( + challengeType === '0' || + challengeType === '7' + ) { + return {}; + } + var codeOutput = CodeMirror.fromTextArea( + document.getElementById('codeOutput'), + { + lineNumbers: false, + mode: 'text', + theme: 'monokai', + readOnly: 'nocursor', + lineWrapping: true + } + ); + codeOutput.setValue( + '/**\n' + + ' * Your output will go here.\n' + + ' * Console.log() -type statements\n' + + ' * will appear in your browser\'s\n' + + ' * DevTools JavaScript console.\n' + + ' */' + ); + + codeOutput.setSize('100%', '100%'); + + return codeOutput; +}(window.CodeMirror, window.document, common.challengeType || 0)); + +var sandBox = (function(jailed, codeOutput) { + if (!jailed) { + return {}; + } var plugin = null; var sandBox = { @@ -150,7 +204,7 @@ var sandBox = (function() { endLoading(); console.log('resetting on fatal plugin error'); - if (challengeType === 0) { + if (common.challengeType === 0) { codeOutput.setValue( 'Sorry, your code is either too slow, has a fatal error, ' + 'or contains an infinite loop.' @@ -163,7 +217,7 @@ var sandBox = (function() { reset(); sandBox.submit = submit; return sandBox; -}()); +}(window.jailed, common.codeOutput)); function replaceSafeTags(value) { return value @@ -180,33 +234,105 @@ var BDDregex = new RegExp( var isInitRun = false; var initPreview = true; -var editor; -editor = CodeMirror.fromTextArea(document.getElementById('codeEditor'), { - lineNumbers: true, - mode: 'text', - theme: 'monokai', - runnable: true, - matchBrackets: true, - autoCloseBrackets: true, - scrollbarStyle: 'null', - lineWrapping: true, - gutters: ['CodeMirror-lint-markers'] -}); +var editor = (function(CodeMirror, emmetCodeMirror, common) { + var codeStorageFactory = common.codeStorageFactory; + if (!CodeMirror) { + return {}; + } -var codeStorage = codeStorageFactory(editor, challenge_Name); -var myCodeMirror = editor; + var editor = CodeMirror.fromTextArea(document.getElementById('codeEditor'), { + lineNumbers: true, + mode: 'text', + theme: 'monokai', + runnable: true, + matchBrackets: true, + autoCloseBrackets: true, + scrollbarStyle: 'null', + lineWrapping: true, + gutters: ['CodeMirror-lint-markers'] + }); + + editor.setSize('100%', 'auto'); + + var codeStorage = common.codeStorage = + codeStorageFactory(editor, common.challengeName); + + editor.on('keyup', function() { + clearTimeout(codeStorage.updateTimeoutId); + codeStorage.updateTimeoutId = setTimeout( + codeStorage.updateStorage.bind(codeStorage), + codeStorage.updateWait + ); + }); + + // Initialize CodeMirror editor with a nice html5 canvas demo. + editor.on('keyup', function() { + clearTimeout(delay); + delay = setTimeout(updatePreview, 300); + }); + + editor.setOption('extraKeys', { + Tab: function(cm) { + if (cm.somethingSelected()) { + cm.indentSelection('add'); + } else { + var spaces = Array(cm.getOption('indentUnit') + 1).join(' '); + cm.replaceSelection(spaces); + } + }, + 'Shift-Tab': function(cm) { + if (cm.somethingSelected()) { + cm.indentSelection('subtract'); + } else { + var spaces = Array(cm.getOption('indentUnit') + 1).join(' '); + cm.replaceSelection(spaces); + } + }, + 'Ctrl-Enter': function() { + isInitRun = false; + bonfireExecute(true); + return false; + } + }); + + + var info = editor.getScrollInfo(); + + var after = editor.charCoords({ + line: editor.getCursor().line + 1, + ch: 0 + }, 'local').top; + + if (info.top + info.clientHeight < after) { + editor.scrollTo(null, after - info.clientHeight + 3); + } + + if (emmetCodeMirror) { + emmetCodeMirror( + editor, + { + 'Cmd-E': 'emmet.expand_abbreviation', + Tab: 'emmet.expand_abbreviation_with_tab', + Enter: 'emmet.insert_formatted_line_break_only' + } + ); + } + common.init.push(function() { + editorValue = codeStorage.isAlive() ? + codeStorage.getStoredValue() : + allSeeds; + + editor.setValue(replaceSafeTags(editorValue)); + editor.refresh(); + }); + + return editor; +}(window.CodeMirror, window.emmetCodeMirror, common)); -editor.on('keyup', function() { - clearTimeout(codeStorage.updateTimeoutId); - codeStorage.updateTimeoutId = setTimeout( - codeStorage.updateStorage.bind(codeStorage), - codeStorage.updateWait - ); -}); var editorValue; -var challengeSeed = challengeSeed || null; +var challengeSeed = challengeSeed || []; var tests = tests || []; var allSeeds = ''; @@ -216,31 +342,6 @@ var allSeeds = ''; }); })(); -editor.setOption('extraKeys', { - Tab: function(cm) { - if (cm.somethingSelected()) { - cm.indentSelection('add'); - } else { - var spaces = Array(cm.getOption('indentUnit') + 1).join(' '); - cm.replaceSelection(spaces); - } - }, - 'Shift-Tab': function(cm) { - if (cm.somethingSelected()) { - cm.indentSelection('subtract'); - } else { - var spaces = Array(cm.getOption('indentUnit') + 1).join(' '); - cm.replaceSelection(spaces); - } - }, - 'Ctrl-Enter': function() { - bonfireExecute(true); - return false; - } -}); - -editor.setSize('100%', 'auto'); - var libraryIncludes = "" + "" + "" + @@ -283,7 +384,8 @@ function scopejQuery(str) { } function safeHTMLRun(test) { - if (challengeType === '0') { + var codeStorage = common.codeStorage; + if (common.challengeType === '0') { var previewFrame = document.getElementById('preview'); var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; if (editor.getValue().match(/\/gi) !== null) { @@ -293,7 +395,7 @@ function safeHTMLRun(test) { .split(/\<\s?\/\s?script\s?\>/gi)[0]; // add feuxQuery - s = "var document = \"\"; var $ = function() {return(new function() {this.add=function() {return(this);};this.addBack=function() {return(this);};this.addClass=function() {return(this);};this.after=function() {return(this);};this.ajaxComplete=function() {return(this);};this.ajaxError=function() {return(this);};this.ajaxSend=function() {return(this);};this.ajaxStart=function() {return(this);};this.ajaxStop=function() {return(this);};this.ajaxSuccess=function() {return(this);};this.andSelf=function() {return(this);};this.animate=function() {return(this);};this.append=function() {return(this);};this.appendTo=function() {return(this);};this.attr=function() {return(this);};this.before=function() {return(this);};this.bind=function() {return(this);};this.blur=function() {return(this);};this.callbacksadd=function() {return(this);};this.callbacksdisable=function() {return(this);};this.callbacksdisabled=function() {return(this);};this.callbacksempty=function() {return(this);};this.callbacksfire=function() {return(this);};this.callbacksfired=function() {return(this);};this.callbacksfireWith=function() {return(this);};this.callbackshas=function() {return(this);};this.callbackslock=function() {return(this);};this.callbackslocked=function() {return(this);};this.callbacksremove=function() {return(this);};this.change=function() {return(this);};this.children=function() {return(this);};this.clearQueue=function() {return(this);};this.click=function() {return(this);};this.clone=function() {return(this);};this.closest=function() {return(this);};this.contents=function() {return(this);};this.context=function() {return(this);};this.css=function() {return(this);};this.data=function() {return(this);};this.dblclick=function() {return(this);};this.delay=function() {return(this);};this.delegate=function() {return(this);};this.dequeue=function() {return(this);};this.detach=function() {return(this);};this.die=function() {return(this);};this.each=function() {return(this);};this.empty=function() {return(this);};this.end=function() {return(this);};this.eq=function() {return(this);};this.error=function() {return(this);};this.fadeIn=function() {return(this);};this.fadeOut=function() {return(this);};this.fadeTo=function() {return(this);};this.fadeToggle=function() {return(this);};this.filter=function() {return(this);};this.find=function() {return(this);};this.finish=function() {return(this);};this.first=function() {return(this);};this.focus=function() {return(this);};this.focusin=function() {return(this);};this.focusout=function() {return(this);};this.get=function() {return(this);};this.has=function() {return(this);};this.hasClass=function() {return(this);};this.height=function() {return(this);};this.hide=function() {return(this);};this.hover=function() {return(this);};this.html=function() {return(this);};this.index=function() {return(this);};this.innerHeight=function() {return(this);};this.innerWidth=function() {return(this);};this.insertAfter=function() {return(this);};this.insertBefore=function() {return(this);};this.is=function() {return(this);};this.jQuery=function() {return(this);};this.jquery=function() {return(this);};this.keydown=function() {return(this);};this.keypress=function() {return(this);};this.keyup=function() {return(this);};this.last=function() {return(this);};this.length=function() {return(this);};this.live=function() {return(this);};this.load=function() {return(this);};this.load=function() {return(this);};this.map=function() {return(this);};this.mousedown=function() {return(this);};this.mouseenter=function() {return(this);};this.mouseleave=function() {return(this);};this.mousemove=function() {return(this);};this.mouseout=function() {return(this);};this.mouseover=function() {return(this);};this.mouseup=function() {return(this);};this.next=function() {return(this);};this.nextAll=function() {return(this);};this.nextUntil=function() {return(this);};this.not=function() {return(this);};this.off=function() {return(this);};this.offset=function() {return(this);};this.offsetParent=function() {return(this);};this.on=function() {return(this);};this.one=function() {return(this);};this.outerHeight=function() {return(this);};this.outerWidth=function() {return(this);};this.parent=function() {return(this);};this.parents=function() {return(this);};this.parentsUntil=function() {return(this);};this.position=function() {return(this);};this.prepend=function() {return(this);};this.prependTo=function() {return(this);};this.prev=function() {return(this);};this.prevAll=function() {return(this);};this.prevUntil=function() {return(this);};this.promise=function() {return(this);};this.prop=function() {return(this);};this.pushStack=function() {return(this);};this.queue=function() {return(this);};this.ready=function() {return(this);};this.remove=function() {return(this);};this.removeAttr=function() {return(this);};this.removeClass=function() {return(this);};this.removeData=function() {return(this);};this.removeProp=function() {return(this);};this.replaceAll=function() {return(this);};this.replaceWith=function() {return(this);};this.resize=function() {return(this);};this.scroll=function() {return(this);};this.scrollLeft=function() {return(this);};this.scrollTop=function() {return(this);};this.select=function() {return(this);};this.selector=function() {return(this);};this.serialize=function() {return(this);};this.serializeArray=function() {return(this);};this.show=function() {return(this);};this.siblings=function() {return(this);};this.size=function() {return(this);};this.slice=function() {return(this);};this.slideDown=function() {return(this);};this.slideToggle=function() {return(this);};this.slideUp=function() {return(this);};this.stop=function() {return(this);};this.submit=function() {return(this);};this.text=function() {return(this);};this.toArray=function() {return(this);};this.toggle=function() {return(this);};this.toggle=function() {return(this);};this.toggleClass=function() {return(this);};this.trigger=function() {return(this);};this.triggerHandler=function() {return(this);};this.unbind=function() {return(this);};this.undelegate=function() {return(this);};this.unload=function() {return(this);};this.unwrap=function() {return(this);};this.val=function() {return(this);};this.width=function() {return(this);};this.wrap=function() {return(this);};this.wrapAll=function() {return(this);};this.wrapInner=function() {return(this);}});};$.ajax=function() {return($);};$.ajaxPrefilter=function() {return($);};$.ajaxSetup=function() {return($);};$.ajaxTransport=function() {return($);};$.boxModel=function() {return($);};$.browser=function() {return($);};$.Callbacks=function() {return($);};$.contains=function() {return($);};$.cssHooks=function() {return($);};$.cssNumber=function() {return($);};$.data=function() {return($);};$.Deferred=function() {return($);};$.dequeue=function() {return($);};$.each=function() {return($);};$.error=function() {return($);};$.extend=function() {return($);};$.fnextend=function() {return($);};$.fxinterval=function() {return($);};$.fxoff=function() {return($);};$.get=function() {return($);};$.getJSON=function() {return($);};$.getScript=function() {return($);};$.globalEval=function() {return($);};$.grep=function() {return($);};$.hasData=function() {return($);};$.holdReady=function() {return($);};$.inArray=function() {return($);};$.isArray=function() {return($);};$.isEmptyObject=function() {return($);};$.isFunction=function() {return($);};$.isNumeric=function() {return($);};$.isPlainObject=function() {return($);};$.isWindow=function() {return($);};$.isXMLDoc=function() {return($);};$.makeArray=function() {return($);};$.map=function() {return($);};$.merge=function() {return($);};$.noConflict=function() {return($);};$.noop=function() {return($);};$.now=function() {return($);};$.param=function() {return($);};$.parseHTML=function() {return($);};$.parseJSON=function() {return($);};$.parseXML=function() {return($);};$.post=function() {return($);};$.proxy=function() {return($);};$.queue=function() {return($);};$.removeData=function() {return($);};$.sub=function() {return($);};$.support=function() {return($);};$.trim=function() {return($);};$.type=function() {return($);};$.unique=function() {return($);};$.when=function() {return($);};$.always=function() {return($);};$.done=function() {return($);};$.fail=function() {return($);};$.isRejected=function() {return($);};$.isResolved=function() {return($);};$.notify=function() {return($);};$.notifyWith=function() {return($);};$.pipe=function() {return($);};$.progress=function() {return($);};$.promise=function() {return($);};$.reject=function() {return($);};$.rejectWith=function() {return($);};$.resolve=function() {return($);};$.resolveWith=function() {return($);};$.state=function() {return($);};$.then=function() {return($);};$.currentTarget=function() {return($);};$.data=function() {return($);};$.delegateTarget=function() {return($);};$.isDefaultPrevented=function() {return($);};$.isImmediatePropagationStopped=function() {return($);};$.isPropagationStopped=function() {return($);};$.metaKey=function() {return($);};$.namespace=function() {return($);};$.pageX=function() {return($);};$.pageY=function() {return($);};$.preventDefault=function() {return($);};$.relatedTarget=function() {return($);};$.result=function() {return($);};$.stopImmediatePropagation=function() {return($);};$.stopPropagation=function() {return($);};$.target=function() {return($);};$.timeStamp=function() {return($);};$.type=function() {return($);};$.which=function() {return($);};" + s; + s = 'var document = \"\"; var $ = function() {return(new function() {this.add=function() {return(this);};this.addBack=function() {return(this);};this.addClass=function() {return(this);};this.after=function() {return(this);};this.ajaxComplete=function() {return(this);};this.ajaxError=function() {return(this);};this.ajaxSend=function() {return(this);};this.ajaxStart=function() {return(this);};this.ajaxStop=function() {return(this);};this.ajaxSuccess=function() {return(this);};this.andSelf=function() {return(this);};this.animate=function() {return(this);};this.append=function() {return(this);};this.appendTo=function() {return(this);};this.attr=function() {return(this);};this.before=function() {return(this);};this.bind=function() {return(this);};this.blur=function() {return(this);};this.callbacksadd=function() {return(this);};this.callbacksdisable=function() {return(this);};this.callbacksdisabled=function() {return(this);};this.callbacksempty=function() {return(this);};this.callbacksfire=function() {return(this);};this.callbacksfired=function() {return(this);};this.callbacksfireWith=function() {return(this);};this.callbackshas=function() {return(this);};this.callbackslock=function() {return(this);};this.callbackslocked=function() {return(this);};this.callbacksremove=function() {return(this);};this.change=function() {return(this);};this.children=function() {return(this);};this.clearQueue=function() {return(this);};this.click=function() {return(this);};this.clone=function() {return(this);};this.closest=function() {return(this);};this.contents=function() {return(this);};this.context=function() {return(this);};this.css=function() {return(this);};this.data=function() {return(this);};this.dblclick=function() {return(this);};this.delay=function() {return(this);};this.delegate=function() {return(this);};this.dequeue=function() {return(this);};this.detach=function() {return(this);};this.die=function() {return(this);};this.each=function() {return(this);};this.empty=function() {return(this);};this.end=function() {return(this);};this.eq=function() {return(this);};this.error=function() {return(this);};this.fadeIn=function() {return(this);};this.fadeOut=function() {return(this);};this.fadeTo=function() {return(this);};this.fadeToggle=function() {return(this);};this.filter=function() {return(this);};this.find=function() {return(this);};this.finish=function() {return(this);};this.first=function() {return(this);};this.focus=function() {return(this);};this.focusin=function() {return(this);};this.focusout=function() {return(this);};this.get=function() {return(this);};this.has=function() {return(this);};this.hasClass=function() {return(this);};this.height=function() {return(this);};this.hide=function() {return(this);};this.hover=function() {return(this);};this.html=function() {return(this);};this.index=function() {return(this);};this.innerHeight=function() {return(this);};this.innerWidth=function() {return(this);};this.insertAfter=function() {return(this);};this.insertBefore=function() {return(this);};this.is=function() {return(this);};this.jQuery=function() {return(this);};this.jquery=function() {return(this);};this.keydown=function() {return(this);};this.keypress=function() {return(this);};this.keyup=function() {return(this);};this.last=function() {return(this);};this.length=function() {return(this);};this.live=function() {return(this);};this.load=function() {return(this);};this.load=function() {return(this);};this.map=function() {return(this);};this.mousedown=function() {return(this);};this.mouseenter=function() {return(this);};this.mouseleave=function() {return(this);};this.mousemove=function() {return(this);};this.mouseout=function() {return(this);};this.mouseover=function() {return(this);};this.mouseup=function() {return(this);};this.next=function() {return(this);};this.nextAll=function() {return(this);};this.nextUntil=function() {return(this);};this.not=function() {return(this);};this.off=function() {return(this);};this.offset=function() {return(this);};this.offsetParent=function() {return(this);};this.on=function() {return(this);};this.one=function() {return(this);};this.outerHeight=function() {return(this);};this.outerWidth=function() {return(this);};this.parent=function() {return(this);};this.parents=function() {return(this);};this.parentsUntil=function() {return(this);};this.position=function() {return(this);};this.prepend=function() {return(this);};this.prependTo=function() {return(this);};this.prev=function() {return(this);};this.prevAll=function() {return(this);};this.prevUntil=function() {return(this);};this.promise=function() {return(this);};this.prop=function() {return(this);};this.pushStack=function() {return(this);};this.queue=function() {return(this);};this.ready=function() {return(this);};this.remove=function() {return(this);};this.removeAttr=function() {return(this);};this.removeClass=function() {return(this);};this.removeData=function() {return(this);};this.removeProp=function() {return(this);};this.replaceAll=function() {return(this);};this.replaceWith=function() {return(this);};this.resize=function() {return(this);};this.scroll=function() {return(this);};this.scrollLeft=function() {return(this);};this.scrollTop=function() {return(this);};this.select=function() {return(this);};this.selector=function() {return(this);};this.serialize=function() {return(this);};this.serializeArray=function() {return(this);};this.show=function() {return(this);};this.siblings=function() {return(this);};this.size=function() {return(this);};this.slice=function() {return(this);};this.slideDown=function() {return(this);};this.slideToggle=function() {return(this);};this.slideUp=function() {return(this);};this.stop=function() {return(this);};this.submit=function() {return(this);};this.text=function() {return(this);};this.toArray=function() {return(this);};this.toggle=function() {return(this);};this.toggle=function() {return(this);};this.toggleClass=function() {return(this);};this.trigger=function() {return(this);};this.triggerHandler=function() {return(this);};this.unbind=function() {return(this);};this.undelegate=function() {return(this);};this.unload=function() {return(this);};this.unwrap=function() {return(this);};this.val=function() {return(this);};this.width=function() {return(this);};this.wrap=function() {return(this);};this.wrapAll=function() {return(this);};this.wrapInner=function() {return(this);}});};$.ajax=function() {return($);};$.ajaxPrefilter=function() {return($);};$.ajaxSetup=function() {return($);};$.ajaxTransport=function() {return($);};$.boxModel=function() {return($);};$.browser=function() {return($);};$.Callbacks=function() {return($);};$.contains=function() {return($);};$.cssHooks=function() {return($);};$.cssNumber=function() {return($);};$.data=function() {return($);};$.Deferred=function() {return($);};$.dequeue=function() {return($);};$.each=function() {return($);};$.error=function() {return($);};$.extend=function() {return($);};$.fnextend=function() {return($);};$.fxinterval=function() {return($);};$.fxoff=function() {return($);};$.get=function() {return($);};$.getJSON=function() {return($);};$.getScript=function() {return($);};$.globalEval=function() {return($);};$.grep=function() {return($);};$.hasData=function() {return($);};$.holdReady=function() {return($);};$.inArray=function() {return($);};$.isArray=function() {return($);};$.isEmptyObject=function() {return($);};$.isFunction=function() {return($);};$.isNumeric=function() {return($);};$.isPlainObject=function() {return($);};$.isWindow=function() {return($);};$.isXMLDoc=function() {return($);};$.makeArray=function() {return($);};$.map=function() {return($);};$.merge=function() {return($);};$.noConflict=function() {return($);};$.noop=function() {return($);};$.now=function() {return($);};$.param=function() {return($);};$.parseHTML=function() {return($);};$.parseJSON=function() {return($);};$.parseXML=function() {return($);};$.post=function() {return($);};$.proxy=function() {return($);};$.queue=function() {return($);};$.removeData=function() {return($);};$.sub=function() {return($);};$.support=function() {return($);};$.trim=function() {return($);};$.type=function() {return($);};$.unique=function() {return($);};$.when=function() {return($);};$.always=function() {return($);};$.done=function() {return($);};$.fail=function() {return($);};$.isRejected=function() {return($);};$.isResolved=function() {return($);};$.notify=function() {return($);};$.notifyWith=function() {return($);};$.pipe=function() {return($);};$.progress=function() {return($);};$.promise=function() {return($);};$.reject=function() {return($);};$.rejectWith=function() {return($);};$.resolve=function() {return($);};$.resolveWith=function() {return($);};$.state=function() {return($);};$.then=function() {return($);};$.currentTarget=function() {return($);};$.data=function() {return($);};$.delegateTarget=function() {return($);};$.isDefaultPrevented=function() {return($);};$.isImmediatePropagationStopped=function() {return($);};$.isPropagationStopped=function() {return($);};$.metaKey=function() {return($);};$.namespace=function() {return($);};$.pageX=function() {return($);};$.pageY=function() {return($);};$.preventDefault=function() {return($);};$.relatedTarget=function() {return($);};$.result=function() {return($);};$.stopImmediatePropagation=function() {return($);};$.stopPropagation=function() {return($);};$.target=function() {return($);};$.timeStamp=function() {return($);};$.type=function() {return($);};$.which=function() {return($);};' + s; sandBox.submit(scopejQuery(s), function(cls, message) { if (cls) { @@ -358,17 +460,11 @@ if (typeof prodOrDev !== 'undefined') { 'http://www.freecodecamp.com' : 'http://localhost:3001'; - if (challengeType === '0') { + if (common.challengeType === '0') { setTimeout(updatePreview, 300); } } -// Initialize CodeMirror editor with a nice html5 canvas demo. -editor.on('keyup', function() { - clearTimeout(delay); - delay = setTimeout(updatePreview, 300); -}); - /** * "post" methods */ @@ -401,11 +497,20 @@ var postError = function(data) { var goodTests = 0; var testSuccess = function() { goodTests++; + // test successful run show completion if (goodTests === tests.length) { - showCompletion(); + return showCompletion(); } }; +function ctrlEnterClickHandler(e) { + // ctrl + enter + if (e.ctrlKey && e.keyCode === 13) { + $('#complete-courseware-dialog').off('keydown', ctrlEnterClickHandler); + $('#submit-challenge').click(); + } +} + function showCompletion() { if (isInitRun) { isInitRun = false; @@ -417,12 +522,14 @@ function showCompletion() { 'event', 'Challenge', 'solved', - challenge_Name + ', Time: ' + time + ', Attempts: ' + attempts + common.challengeName + ', Time: ' + time + ', Attempts: ' + attempts ); - var bonfireSolution = myCodeMirror.getValue(); + var bonfireSolution = editor.getValue(); var didCompleteWith = $('#completed-with').val() || null; + $('#complete-courseware-dialog').modal('show'); $('#complete-courseware-dialog .modal-header').click(); + $('#submit-challenge').click(function(e) { e.preventDefault(); @@ -448,16 +555,17 @@ function showCompletion() { $.post( '/completed-bonfire/', { challengeInfo: { - challengeId: challenge_Id, - challengeName: challenge_Name, + challengeId: common.challengeId, + challengeName: common.challengeName, completedWith: didCompleteWith, - challengeType: challengeType, + challengeType: common.challengeType, solution: bonfireSolution } }, function(res) { if (res) { - window.location = '/challenges/next-challenge'; + window.location = + '/challenges/next-challenge?id=' + common.challengeId; } } ); @@ -468,7 +576,7 @@ var resetEditor = function resetEditor() { editor.setValue(replaceSafeTags(allSeeds)); $('#testSuite').empty(); bonfireExecute(true); - codeStorage.updateStorage(); + common.codeStorage.updateStorage(); }; var attempts = 0; @@ -476,35 +584,6 @@ if (attempts) { attempts = 0; } -if (challengeType !== '0') { - var codeOutput = CodeMirror.fromTextArea( - document.getElementById('codeOutput'), - { - lineNumbers: false, - mode: 'text', - theme: 'monokai', - readOnly: 'nocursor', - lineWrapping: true - } - ); - - codeOutput.setValue('/**\n' + - ' * Your output will go here.\n' + ' * Console.log() -type statements\n' + - ' * will appear in your browser\'s\n' + ' * DevTools JavaScript console.\n' + - ' */'); - codeOutput.setSize('100%', '100%'); -} - -var info = editor.getScrollInfo(); - -var after = editor.charCoords({ - line: editor.getCursor().line + 1, - ch: 0 -}, 'local').top; - -if (info.top + info.clientHeight < after) { - editor.scrollTo(null, after - info.clientHeight + 3); -} var userTests; var testSalt = Math.random(); @@ -583,9 +662,15 @@ var createTestDisplay = function() { } }; -var expect = chai.expect; -var assert = chai.assert; -var should = chai.should(); +(function(win, chai) { + if (!chai) { + return; + } + win.expect = chai.expect; + win.assert = chai.assert; + win.should = chai.should(); + +}(window, window.chai)); var reassembleTest = function(test, data) { @@ -624,7 +709,9 @@ var runTests = function(err, data) { ) { try { if (chaiTestFromJSON) { + /* eslint-disable no-eval, no-unused-vars */ var output = eval(reassembleTest(chaiTestFromJSON, data)); + /* eslint-enable no-eval, no-unused-vars */ } } catch (error) { allTestsPassed = false; @@ -639,26 +726,139 @@ var runTests = function(err, data) { if (allTestsPassed) { allTestsPassed = false; showCompletion(); - } - else{ + } else { isInitRun = false; } } }; +// step challenge +common.init.push((function() { + var stepClass = '.challenge-step'; + var nextBtnClass = '.challenge-step-btn-next'; + var actionBtnClass = '.challenge-step-btn-action'; + var finishBtnClass = '.challenge-step-btn-finish'; + var submitBtnId = '#challenge-step-btn-submit'; + var submitModalId = '#challenge-step-modal'; + + function getNextStep($challengeSteps) { + var length = $challengeSteps.length; + var $nextStep = false; + var nextStepIndex = 0; + $challengeSteps.each(function(index) { + var $step = $(this); + if ( + !$step.hasClass('hidden') && + index + 1 !== length + ) { + nextStepIndex = index + 1; + } + }); + + $nextStep = $challengeSteps[nextStepIndex]; + + return $nextStep; + } + + function handleNextStepClick(e) { + e.preventDefault(); + var nextStep = getNextStep($(stepClass)); + $(this) + .parent() + .addClass('animated fadeOutLeft') + .delay(700) + .queue(function(next) { + $(this).addClass('hidden'); + if (nextStep) { + $(nextStep) + .removeClass('hidden') + .addClass('animated slideInRight') + .delay(1000) + .queue(function(next) { + $(this).removeClass('slideInRight'); + next(); + }); + } + next(); + }); + + } + + function handleActionClick() { + $(this) + .parent() + .find('.disabled') + .removeClass('disabled'); + } + + function handleFinishClick(e) { + e.preventDefault(); + $(submitModalId).modal('show'); + $(submitModalId + '.modal-header').click(); + $(submitBtnId).click(handleSubmitClick); + } + + function handleSubmitClick(e) { + e.preventDefault(); + + $('#submit-challenge') + .attr('disabled', 'true') + .removeClass('btn-primary') + .addClass('btn-warning disabled'); + + var $checkmarkContainer = $('#checkmark-container'); + $checkmarkContainer.css({ height: $checkmarkContainer.innerHeight() }); + + $('#challenge-checkmark') + .addClass('zoomOutUp') + .delay(1000) + .queue(function(next) { + $(this).replaceWith( + '
' + + 'submitting...
' + ); + next(); + }); + + $.post( + '/completed-bonfire/', { + challengeInfo: { + challengeId: common.challengeId, + challengeName: common.challengeName, + challengeType: common.challengeType + } + }, + function(res) { + if (res) { + window.location = + '/challenges/next-challenge?id=' + common.challengeId; + } + } + ); + } + + return function($) { + $(nextBtnClass).click(handleNextStepClick); + $(actionBtnClass).click(handleActionClick); + $(finishBtnClass).click(handleFinishClick); + }; +}(window.$))); + function bonfireExecute(shouldTest) { + var codeOutput = common.codeOutput; initPreview = false; goodTests = 0; attempts++; - ga('send', 'event', 'Challenge', 'ran-code', challenge_Name); + ga('send', 'event', 'Challenge', 'ran-code', common.challengeName); userTests = null; $('#testSuite').empty(); if ( - challengeType !== '0' && + common.challengeType !== '0' && !editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) ) { - var userJavaScript = myCodeMirror.getValue(); + var userJavaScript = editor.getValue(); var failedCommentTest = false; // checks if the number of opening comments(/*) matches the number of @@ -678,7 +878,7 @@ function bonfireExecute(shouldTest) { if (userJavaScript.match(/function\s*?\(|function\s+\w+\s*?\(/gi)) { sandBox.submit(userJavaScript, function(cls, message) { if (failedCommentTest) { - myCodeMirror.setValue(myCodeMirror.getValue() + '*/'); + editor.setValue(editor.getValue() + '*/'); console.log('Caught Unfinished Comment'); codeOutput.setValue('Unfinished multi-line comment'); failedCommentTest = false; @@ -703,7 +903,7 @@ function bonfireExecute(shouldTest) { sandBox.submit(userJavaScript, function(cls, message) { if (failedCommentTest) { - myCodeMirror.setValue(myCodeMirror.getValue() + '*/'); + editor.setValue(editor.getValue() + '*/'); console.log('Caught Unfinished Comment'); codeOutput.setValue('Unfinished mulit-line comment'); failedCommentTest = false; @@ -733,7 +933,7 @@ function bonfireExecute(shouldTest) { } if ( !editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) && - challengeType === '0' + common.challengeType === '0' ) { safeHTMLRun(shouldTest); } else { @@ -747,25 +947,37 @@ function bonfireExecute(shouldTest) { } $('#submitButton').on('click', function() { + isInitRun = false; bonfireExecute(true); }); $(document).ready(function() { + + common.init.forEach(function(init) { + init($); + }); + + // init modal keybindings on open + $('#complete-courseware-dialog').on('shown.bs.modal', function() { + $('#complete-courseware-dialog').keydown(ctrlEnterClickHandler); + }); + + // remove modal keybinds on close + $('#complete-courseware-dialog').on('hidden.bs.modal', function() { + $('#complete-courseware-dialog').off('keydown', ctrlEnterClickHandler); + }); + var $preview = $('#preview'); isInitRun = true; - editorValue = codeStorage.isAlive() ? - codeStorage.getStoredValue() : - allSeeds; - - myCodeMirror.setValue(replaceSafeTags(editorValue)); if (typeof $preview.html() !== 'undefined') { $preview.load(function() { if (initPreview) { bonfireExecute(true); } }); - } else { + } else if (common.challengeType !== 7) { bonfireExecute(true); } + }); diff --git a/client/es6-shims.js b/client/es6-shims.js new file mode 100644 index 0000000000..43abd2ed1a --- /dev/null +++ b/client/es6-shims.js @@ -0,0 +1,2 @@ +require('object.assign').shim(); +require('es6-map/implement'); diff --git a/client/index.js b/client/index.js index 95be7ca9ae..44bdb0a82c 100644 --- a/client/index.js +++ b/client/index.js @@ -1,9 +1,10 @@ +import unused from './es6-shims'; // eslint-disable-line import Rx from 'rx'; import React from 'react'; import Fetchr from 'fetchr'; import debugFactory from 'debug'; import { Router } from 'react-router'; -import { history } from 'react-router/lib/BrowserHistory'; +import { createLocation, createHistory } from 'history'; import { hydrate } from 'thundercats'; import { Render } from 'thundercats-react'; @@ -17,21 +18,29 @@ const services = new Fetchr({ }); Rx.config.longStackSupport = !!debug.enabled; - +const history = createHistory(); +const appLocation = createLocation( + location.pathname + location.search +); // returns an observable -app$(history) +app$({ history, location: appLocation }) .flatMap( ({ AppCat }) => { + // instantiate the cat with service const appCat = AppCat(null, services); + // hydrate the stores return hydrate(appCat, catState) .map(() => appCat); }, - ({ initialState }, appCat) => ({ initialState, appCat }) + // not using nextLocation at the moment but will be used for + // redirects in the future + ({ nextLocation, props }, appCat) => ({ nextLocation, props, appCat }) ) - .flatMap(({ initialState, appCat }) => { + .flatMap(({ props, appCat }) => { + props.history = history; return Render( appCat, - React.createElement(Router, initialState), + React.createElement(Router, props), DOMContianer ); }) diff --git a/client/less/lib/bootstrap/variables.less b/client/less/lib/bootstrap/variables.less index 01e26f3433..8b8fefa81d 100755 --- a/client/less/lib/bootstrap/variables.less +++ b/client/less/lib/bootstrap/variables.less @@ -107,7 +107,7 @@ @border-radius-small: 3px; //** Global color for active items (e.g., navs or dropdowns). -@component-active-color: #eee; +@component-active-color: @gray-lighter; //** Global background color for active items (e.g., navs or dropdowns). @component-active-bg: @brand-primary; @@ -145,26 +145,26 @@ @btn-font-weight: normal; @btn-default-color: #333; -@btn-default-bg: #eee; +@btn-default-bg: @gray-lighter; @btn-default-border: #ccc; -@btn-primary-color: #eee; +@btn-primary-color: @gray-lighter; @btn-primary-bg: @brand-primary; @btn-primary-border: darken(@btn-primary-bg, 5%); -@btn-success-color: #eee; +@btn-success-color: @gray-lighter; @btn-success-bg: @brand-success; @btn-success-border: darken(@btn-success-bg, 5%); -@btn-info-color: #eee; +@btn-info-color: @gray-lighter; @btn-info-bg: @brand-info; @btn-info-border: darken(@btn-info-bg, 5%); -@btn-warning-color: #eee; +@btn-warning-color: @gray-lighter; @btn-warning-bg: @brand-warning; @btn-warning-border: darken(@btn-warning-bg, 5%); -@btn-danger-color: #eee; +@btn-danger-color: @gray-lighter; @btn-danger-bg: @brand-danger; @btn-danger-border: darken(@btn-danger-bg, 5%); @@ -176,7 +176,7 @@ //## //** `` background color -@input-bg: #eee; +@input-bg: @gray-lighter; //** `` background color @input-bg-disabled: @gray-lighter; @@ -223,7 +223,7 @@ //## Dropdown menu container and contents. //** Background for the dropdown menu. -@dropdown-bg: #eee; +@dropdown-bg: @gray-lighter; //** Dropdown menu `border-color`. @dropdown-border: rgba(0,0,0,.15); //** Dropdown menu `border-color` **for IE8**. @@ -359,10 +359,10 @@ @navbar-default-border: darken(@navbar-default-bg, 6.5%); // Navbar links -@navbar-default-link-color: #eee; +@navbar-default-link-color: @gray-lighter; @navbar-default-link-hover-color: #4a2b0f; -@navbar-default-link-hover-bg: #eee; -@navbar-default-link-active-color: #eee; +@navbar-default-link-hover-bg: @gray-lighter; +@navbar-default-link-active-color: @gray-lighter; @navbar-default-link-active-bg: darken(@navbar-default-bg, 6.5%); @navbar-default-link-disabled-color: #ccc; @navbar-default-link-disabled-bg: transparent; @@ -386,7 +386,7 @@ // Inverted navbar links @navbar-inverse-link-color: @gray-light; -@navbar-inverse-link-hover-color: #eee; +@navbar-inverse-link-hover-color: @gray-lighter; @navbar-inverse-link-hover-bg: transparent; @navbar-inverse-link-active-color: @navbar-inverse-link-hover-color; @navbar-inverse-link-active-bg: darken(@navbar-inverse-bg, 10%); @@ -395,12 +395,12 @@ // Inverted navbar brand label @navbar-inverse-brand-color: @navbar-inverse-link-color; -@navbar-inverse-brand-hover-color: #eee; +@navbar-inverse-brand-hover-color: @gray-lighter; @navbar-inverse-brand-hover-bg: transparent; // Inverted navbar toggle @navbar-inverse-toggle-hover-bg: #333; -@navbar-inverse-toggle-icon-bar-bg: #eee; +@navbar-inverse-toggle-icon-bar-bg: @gray-lighter; @navbar-inverse-toggle-border-color: #333; @@ -415,7 +415,7 @@ @nav-disabled-link-color: @gray-light; @nav-disabled-link-hover-color: @gray-light; -@nav-open-link-hover-color: #eee; +@nav-open-link-hover-color: @gray-lighter; //== Tabs @nav-tabs-border-color: #ddd; @@ -440,19 +440,19 @@ //## @pagination-color: @link-color; -@pagination-bg: #eee; +@pagination-bg: @gray-lighter; @pagination-border: #ddd; @pagination-hover-color: @link-hover-color; @pagination-hover-bg: @gray-lighter; @pagination-hover-border: #ddd; -@pagination-active-color: #eee; +@pagination-active-color: @gray-lighter; @pagination-active-bg: @brand-primary; @pagination-active-border: @brand-primary; @pagination-disabled-color: @gray-light; -@pagination-disabled-bg: #eee; +@pagination-disabled-bg: @gray-lighter; @pagination-disabled-border: #ddd; @@ -511,7 +511,7 @@ //** Tooltip max width @tooltip-max-width: 200px; //** Tooltip text color -@tooltip-color: #eee; +@tooltip-color: @gray-lighter; //** Tooltip background color @tooltip-bg: #000; @tooltip-opacity: .9; @@ -527,7 +527,7 @@ //## //** Popover body background color -@popover-bg: #eee; +@popover-bg: @gray-lighter; //** Popover maximum width @popover-max-width: 276px; //** Popover border color @@ -541,7 +541,7 @@ //** Popover arrow width @popover-arrow-width: 10px; //** Popover arrow color -@popover-arrow-color: #eee; +@popover-arrow-color: @gray-lighter; @popover-arrow-color: @popover-bg; //** Popover outer arrow width @@ -570,9 +570,9 @@ @label-danger-bg: @brand-danger; //** Default label text color -@label-color: #eee; +@label-color: @gray-lighter; //** Default text color of a linked label -@label-link-hover-color: #eee; +@label-link-hover-color: @gray-lighter; //== Modals @@ -588,7 +588,7 @@ @modal-title-line-height: @line-height-base; //** Background color of modal content area -@modal-content-bg: #eee; +@modal-content-bg: @gray-lighter; //** Modal content border color @modal-content-border-color: rgba(0,0,0,.2); //** Modal content border color **for IE8** @@ -640,7 +640,7 @@ //** Background color of the whole progress component @progress-bg: #f5f5f5; //** Progress bar text color -@progress-bar-color: #eee; +@progress-bar-color: @gray-lighter; //** Variable for setting rounded corners on progress bar. @progress-border-radius: @border-radius-base; @@ -662,7 +662,7 @@ //## //** Background color on `.list-group-item` -@list-group-bg: #eee; +@list-group-bg: @gray-lighter; //** `.list-group-item` border color @list-group-border: #ddd; //** List group border radius @@ -695,7 +695,7 @@ // //## -@panel-bg: #eee; +@panel-bg: @gray-lighter; @panel-body-padding: 15px; @panel-heading-padding: 10px 15px; @panel-footer-padding: @panel-heading-padding; @@ -709,7 +709,7 @@ @panel-default-border: #ddd; @panel-default-heading-bg: #f5f5f5; -@panel-primary-text: #eee; +@panel-primary-text: @gray-lighter; @panel-primary-border: @brand-primary; @panel-primary-heading-bg: @brand-primary; @@ -717,7 +717,7 @@ @panel-success-border: @state-success-border; @panel-success-heading-bg: @state-success-bg; -@panel-info-text: #eee; +@panel-info-text: @gray-lighter; @panel-info-border: darken(#4a2b0f, 5%); @panel-info-heading-bg: #4a2b0f; @@ -761,15 +761,15 @@ // //## -@badge-color: #eee; +@badge-color: @gray-lighter; //** Linked badge text color on hover -@badge-link-hover-color: #eee; +@badge-link-hover-color: @gray-lighter; @badge-bg: @gray-light; //** Badge text color in active nav link @badge-active-color: @link-color; //** Badge background color in active nav link -@badge-active-bg: #eee; +@badge-active-bg: @gray-lighter; @badge-font-weight: bold; @badge-line-height: 1; @@ -798,15 +798,15 @@ @carousel-text-shadow: 0 1px 2px rgba(0,0,0,.6); -@carousel-control-color: #eee; +@carousel-control-color: @gray-lighter; @carousel-control-width: 15%; @carousel-control-opacity: .5; @carousel-control-font-size: 20px; -@carousel-indicator-active-bg: #eee; -@carousel-indicator-border-color: #eee; +@carousel-indicator-active-bg: @gray-lighter; +@carousel-indicator-border-color: @gray-lighter; -@carousel-caption-color: #eee; +@carousel-caption-color: @gray-lighter; //== Close @@ -815,7 +815,7 @@ @close-font-weight: bold; @close-color: #000; -@close-text-shadow: 0 1px 0 #eee; +@close-text-shadow: 0 1px 0 @gray-lighter; //== Code @@ -825,7 +825,7 @@ @code-color: #c7254e; @code-bg: #f9f2f4; -@kbd-color: #eee; +@kbd-color: @gray-lighter; @kbd-bg: #333; @pre-bg: #f5f5f5; diff --git a/client/less/main.less b/client/less/main.less index 814e99cb54..e21023754e 100644 --- a/client/less/main.less +++ b/client/less/main.less @@ -37,8 +37,7 @@ html { overflow-x: hidden; } -input[type=checkbox] -{ +input[type=checkbox] { /* Double-sized Checkboxes */ -ms-transform: scale(2); /* IE */ -moz-transform: scale(2); /* FF */ @@ -48,7 +47,7 @@ input[type=checkbox] } body.full-screen-body-background { - background-color: #eeeeee; + background-color: @gray-lighter; } @@ -101,24 +100,10 @@ h1, h2, h3, h4, h5, h6, p, li { margin: 0 auto; } -.three-by-three { - height: 100px; -} - -.darker-background { - background-color: #dedede; -} - -/**/ - .btn-cta { font-size: 40px; } -.nonprofit-cta { - font-size: 28px; -} - .btn, .shadow { white-space: normal; -webkit-box-shadow: 2px 4px 1px rgba(0, 0, 0, 0.3); @@ -142,25 +127,6 @@ ul { word-wrap: break-word; } -.img-center { - margin:0 auto; -} - -.centered-iframe { - display:block; -} - -@media (min-width: 767px) { - .landing-panel-body { - padding-left: 40px; - padding-right: 40px; - } -} - -.landing-panel-heading { - font-size: 40px; -} - .panel-heading { font-size: 25px; } @@ -175,14 +141,6 @@ ul { font-size: 26px; } -.five-pixel-break { - height: 5px; -} - -.fifteen-pixel-break { - height: 15px; -} - .nav-height { height: 50px; border: none; @@ -193,55 +151,34 @@ ul { width: 200px; } -.completion-icon{ +.completion-icon { font-size: 150px; } -.responsive-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden; } -.responsive-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } - -.positive-10 { - margin-top: 10px; -} - -.positive-15-bottom { - margin-bottom: 15px; -} - .positive-15 { margin-top: 15px; } -.negative-45 { - margin-top: -45px; - margin-bottom: -45px; +.positive-15-bottom { + margin-bottom: 15px; } -.negative-55 { - margin-top: -55px; - margin-bottom: -55px; +.positive-10 { + margin-top: 10px; } -.negative-10 { - margin-top: -10px; -} - -.negative-28 { - margin-top: -28px; -} - -.negative-35 { - margin-top: -35px; -} - -.negative-30 { - margin-top: -30px; +.positive-5 { + margin-top: 5px; } .negative-5 { margin-top: -5px; } +.negative-10 { + margin-top: -10px; +} + .negative-15 { margin-top: -15px; } @@ -250,14 +187,35 @@ ul { margin-top: -20px; } -.negative-bottom-margin-30 { +.negative-28 { + margin-top: -28px; +} + +.negative-30 { + margin-top: -30px; +} + +.negative-30-bottom { margin-bottom: -30px; } +.negative-35 { + margin-top: -35px; +} + +.negative-55 { + margin-top: -55px; + margin-bottom: -55px; +} + .large-p { font-size: 24px; } +.map-p { + font-size: 20px; +} + .large-li { font-size: 24px; } @@ -270,36 +228,11 @@ ul { color: @brand-success; } -.delay-1 { - -webkit-animation-delay: 1s; - animation-delay: 1s; -} - -.delay-2 { - -webkit-animation-delay: 2s; - animation-delay: 2s; -} - -.delay-4 { - -webkit-animation-delay: 4s; - animation-delay: 4s; -} - -.delay-10 { - -webkit-animation-delay: 10s; - animation-delay: 10s; -} - .fast-animation { -webkit-animation-duration: 0.5s; animation-duration: 0.5s; } -.slow-animation { - -webkit-animation-duration: 1.5s; - animation-duration: 1.5s; -} - .disabled { pointer-events: none; cursor: default; @@ -310,10 +243,6 @@ ul { display: none; } -.button-container { - height: 120px; -} - .nav-logo { height: 40px; margin-top: -10px; @@ -329,7 +258,7 @@ ul { } @media (max-width: 991px) and (min-width: 768px) { position: absolute; - right:0; + right: 0; margin-right: 10px; white-space: nowrap; } @@ -346,8 +275,8 @@ ul { .thin-progress-bar { height: 8px; - margin-top:3px; - margin-bottom:0px; + margin-top: 3px; + margin-bottom: 0px; width: 60%; margin-right: auto; margin-left: auto; @@ -357,8 +286,8 @@ ul { margin-bottom: -6px; } -.strikethrough { - text-decoration: line-through; +.lb-container { + padding: 0px; } .btn-social { @@ -377,7 +306,7 @@ ul { } .navbar-nav > li > a { - color: #eee; + color: @gray-lighter; &:hover { color: #4a2b0f; } @@ -396,11 +325,6 @@ ul { font-size: 63px; } -.scroll-lock { - overflow: hidden; - height: 100%; -} - .signup-btn.btn { background-color: #ffac33; background-image: linear-gradient(#ffcc4d, #ffac33); @@ -421,41 +345,9 @@ ul { background-image: none; box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3); } -.profile-image { - border-radius: 5px; - width: 200px; - height: 200px; - padding-left: 5px; - padding-right: 5px; -} -.team-member { - height: 420px; -} - -*, *:before, *:after {box-sizing: border-box !important;} - -.masonry-row { - -moz-column-width: 18em; - -webkit-column-width: 18em; - -moz-column-gap: 1em; - -webkit-column-gap:1em; -} - -.masonry-block { - display: inline-block; - padding: .25rem; - width: 100%; -} - -.masonry-relative { - position:relative; - display: block; -} - -.next-challenge-button { - max-width: 1500px; - margin:0 auto; +*, *:before, *:after { + box-sizing: border-box !important; } .btn-big { @@ -505,13 +397,13 @@ thead { } .navbar-nav a { - color: #eee; + color: @gray-lighter; font-size: 20px; margin-top: -5px; margin-bottom: -5px; } .navbar-toggle { - color: #eee; + color: @gray-lighter; } .navbar-right { @@ -520,16 +412,11 @@ thead { } .signup-btn-nav { - margin-top:-2px !important; + margin-top: -2px !important; padding-top: 10px !important; padding-bottom: 10px !important; } -.nameline { - margin-top: -5px; - font-size: 40px; -} - .public-profile-img { height: 200px; width: 200px; @@ -543,23 +430,6 @@ thead { border-color: #78FA89; } -.desktop-narrow { - @media (min-width: 767px) { - marign: 0 auto; - width: 80%; - } -} - -.min650 { - min-height: 630px; -} - -.portfolio-image { - height: 225px; - width: 300px; - border-radius: 5px; -} - .flat-top { margin-top: -5px; } @@ -573,7 +443,7 @@ thead { } .points-on-top { - color: #eee; + color: @gray-lighter; font-size: 35px; z-index: 2; width: 60%; @@ -642,7 +512,7 @@ thead { .challenge-list-header { background-color: #215f1e; - color: #eee; + color: @gray-lighter; font-size: 36px; text-align: center; margin-bottom: -30px; @@ -650,19 +520,8 @@ thead { padding-left: 50px; } -.all-list-header { - background-color: #4A2B0F; - color: #eee; - font-size: 36px; - text-align: center; - margin-bottom: -30px; - border-radius: 5px 5px 0px 0px; - padding-left: 50px; - -} - .closing-x { - color: #eee; + color: @gray-lighter; font-size: 50px; text-align: right; } @@ -678,7 +537,7 @@ thead { position: absolute; a { font-size: 20px; - color: #eee; + color: @gray-lighter; margin-left: 0px; margin-right: 0px; padding-left: 10px; @@ -687,7 +546,7 @@ thead { padding-bottom: 12px; &:hover { color: #4a2b0f; - background-color: #eee; + background-color: @gray-lighter; text-decoration: none; } } @@ -702,19 +561,6 @@ thead { font-size: 15px; } -.jquery-exercises-well { - text-align: left; - height: 200px; -} - -#exercise-directory { - font-size: 20px; -} - -#current-exercise { - text-size: 250px; -} - .bonfire-instructions { margin-bottom: 5px; } @@ -770,10 +616,6 @@ form.code span { padding-bottom: 0px; } -.panel-bonfire { - height: 100% -} - div.CodeMirror-scroll { padding-bottom: 30px; } @@ -812,11 +654,6 @@ iframe.iphone { } } -.nonprofit-help-select-text-height { - font-size: 40px; - padding-top: 20px; -} - // To adjust right margin, negative values bring the image closer to the edge of the screen .iphone-position { position: absolute; @@ -829,25 +666,6 @@ iframe.iphone { min-height: 650px; } -// This is used to give icons text for screen readers to read out, without needing the text to actually appear. -.icon-lock{ - font-size: 0px; -} - -.stats-text { - font-size: 26px; - line-height: 150%; -} - -.github-and-twitter-button-text { - padding-top: 10px; -} - -.gitter-imbed { - height: 100%; - margin-bottom: 50px; -} - .btn-primary-ghost { background: transparent; color: @brand-primary; @@ -908,7 +726,7 @@ iframe.iphone { padding-right: 8px; margin-left: 0px; margin-right: 2px; - text-align:left; + text-align: left; font-size: 10px; } @@ -918,38 +736,11 @@ iframe.iphone { font-size: 18px; } -.tight-h3 { - margin-top: -4px; - margin-bottom: -4px; -} - .story-list { padding-bottom: 30px; margin-bottom: 30px; } -.big-ion-up-arrow { - font-size: 45px; - margin-top: -10px; - margin-bottom: -15px; - text-align: center; -} - -.big-ion-up-arrow #upvote, #reply-to-main-post { - cursor: pointer; -} - -.story-up-votes { - padding-top: 0px; - margin-left: -5px; - text-align: center; -} - -.img-story-post { - max-width: 110px; - max-height: 110px; -} - .button-spacer { padding: 5px 0 2px 0; } @@ -1057,11 +848,7 @@ hr { } .cal-heatmap-container { - background-color: #EEEEEE; -} - -.checkbox-table label { - margin-left: 10px; + background-color: @gray-lighter; } .interested-camper-image { @@ -1070,16 +857,6 @@ hr { padding: 5px; } -.svg-challenge-map { - fill: #333; - height: 40px; -} - -.news-number { - font-size: 30px; - text-align: center; -} - .mobile-story-image { border-radius: 5px; width: 100%; @@ -1101,10 +878,6 @@ hr { opacity: 0.5; } -.same-line { - display: inline-block; -} - .padded-ionic-icon { padding-top: 5px; } @@ -1142,10 +915,6 @@ hr { // Calculator styles -.initially-hidden { - display: none; -} - .chart rect { fill: steelblue; } diff --git a/client/main.js b/client/main.js index bbd69857d0..c1578c1d6f 100644 --- a/client/main.js +++ b/client/main.js @@ -1,14 +1,45 @@ +var mapShareKey = 'map-shares'; +var lastCompleted = typeof lastCompleted !== 'undefined' ? + lastCompleted : + ''; + +function getMapShares() { + var alreadyShared = JSON.parse(localStorage.getItem(mapShareKey) || '[]'); + if (!alreadyShared || !Array.isArray(alreadyShared)) { + localStorage.setItem(mapShareKey, JSON.stringify([])); + alreadyShared = []; + } + return alreadyShared; +} + +function setMapShare(id) { + var alreadyShared = getMapShares(); + var found = false; + alreadyShared.forEach(function(_id) { + if (_id === id) { + found = true; + } + }); + if (!found) { + alreadyShared.push(id); + } + localStorage.setItem(mapShareKey, JSON.stringify(alreadyShared)); + return alreadyShared; +} + $(document).ready(function() { - var challengeName = typeof challengeName !== undefined ? challengeName : 'Untitled'; + + var challengeName = typeof challengeName !== 'undefined' ? + challengeName : + 'Untitled'; + if (challengeName) { ga('send', 'event', 'Challenge', 'load', challengeName); } - $(document).ready(function() { - if (typeof editor !== 'undefined') { - $('#reset-button').on('click', resetEditor); - } - }); + if (typeof editor !== 'undefined') { + $('#reset-button').on('click', resetEditor); + } var CSRF_HEADER = 'X-CSRF-Token'; @@ -69,23 +100,61 @@ $(document).ready(function() { $('#search-issue').unbind('click'); $('#search-issue').on('click', function() { var queryIssue = window.location.href.toString(); - window.open('https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=is:issue is:all '+ queryIssue.substr(queryIssue.lastIndexOf('challenges/') + 11).replace('/', ''), '_blank'); + window.open('https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' + + 'is:issue is:all ' + (challenge_Name || challengeName) + ' OR ' + + queryIssue.substr(queryIssue.lastIndexOf('challenges/') + 11) + .replace('/', ''), '_blank'); }); $('#help-ive-found-a-bug-wiki-article').unbind('click'); $('#help-ive-found-a-bug-wiki-article').on('click', function() { - var queryIssue = window.location.href.toString(); window.open("https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Help-I've-Found-a-Bug", '_blank'); }); $('#report-issue').unbind('click'); $('#report-issue').on('click', function() { - var textMessage = 'https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge ' + window.location.href + ' has an issue.'; - textMessage += ' User Agent is: ' + navigator.userAgent + '.'; - textMessage += ' Please describe how to reproduce this issue, and include links to screenshots if possible.%0A%0A'; - textMessage = textMessage.replace(';', ','); //GitHub cuts User Agent text because of ';' symbol so I just replace it with ',' + var textMessage = [ + 'Challenge [', + (challenge_Name || challengeName || window.location.href), + '](', + window.location.href, + ') has an issue.\n', + 'User Agent is: ', + navigator.userAgent, + '.\n', + 'Please describe how to reproduce this issue, and include ', + 'links to screenshots if possible.\n\n' + ].join(''); + + if (editor.getValue().trim()) { + var type; + switch (challengeType) { + case challengeTypes.HTML_CSS_JQ: + type = 'html'; + break; + case challengeTypes.JAVASCRIPT: + type = 'javascript'; + break; + default: + type = ''; + } + + textMessage += [ + 'My code:\n```', + type, + '\n', + editor.getValue(), + '\n```\n\n' + ].join(''); + } + + textMessage = encodeURIComponent(textMessage); + $('#issue-modal').modal('hide'); - window.open(textMessage, '_blank'); + window.open( + 'https://github.com/freecodecamp/freecodecamp/issues/new?&body=' + + textMessage, '_blank' + ); }); $('#completed-courseware').unbind('click'); @@ -141,7 +210,7 @@ $(document).ready(function() { }).success( function(res) { if (res) { - window.location.href = '/challenges/next-challenge'; + window.location.href = '/challenges/next-challenge?id=' + challenge_Id; } }).fail( function() { @@ -164,7 +233,7 @@ $(document).ready(function() { } }).success( function() { - window.location.href = '/challenges/next-challenge'; + window.location.href = '/challenges/next-challenge?id=' + challenge_Id; }).fail( function() { window.location.href = '/challenges'; @@ -187,25 +256,19 @@ $(document).ready(function() { verified: false } }).success(function() { - window.location.href = '/challenges/next-challenge'; + window.location.href = '/challenges/next-challenge?id=' + challenge_Id; }).fail(function() { window.location.replace(window.location.href); }); break; case challengeTypes.BONFIRE: - window.location.href = '/challenges/next-challenge'; + window.location.href = '/challenges/next-challenge?id=' + challenge_Id; default: break; } } }); - $('.next-challenge-button').unbind('click'); - $('.next-challenge-button').on('click', function() { - l = location.pathname.split('/'); - window.location = '/challenges/' + (parseInt(l[l.length - 1]) + 1); - }); - $('#complete-courseware-dialog').on('hidden.bs.modal', function() { editor.focus(); }); @@ -349,6 +412,40 @@ $(document).ready(function() { } }, false); } + + + // map sharing + var alreadyShared = getMapShares(); + + if (lastCompleted && alreadyShared.indexOf(lastCompleted) === -1) { + $('div[id="' + lastCompleted + '"]') + .parent() + .parent() + .removeClass('hidden'); + } + + // on map view + $('.map-challenge-block-share').on('click', function(e) { + e.preventDefault(); + var challengeBlockName = $(this).children().attr('id'); + var challengeBlockEscapedName = challengeBlockName.replace(/\s/, '%20'); + var username = typeof window.username !== 'undefined' ? + window.username : + ''; + + var link = 'https://www.facebook.com/dialog/feed?' + + 'app_id=1644598365767721' + + '&display=page&' + + 'caption=I%20just%20completed%20the%20' + + challengeBlockEscapedName + + '%20section%20on%20Free%20Code%20Camp%2E' + + '&link=http%3A%2F%2Ffreecodecamp%2Ecom%2F' + + username + + '&redirect_uri=http%3A%2F%2Ffreecodecamp%2Ecom%2Fmap'; + + setMapShare(challengeBlockName); + window.location.href = link; + }); }); function defCheck(a){ diff --git a/common/app/app-stream.jsx b/common/app/app-stream.jsx index dcba9b7ca0..82d5568c09 100644 --- a/common/app/app-stream.jsx +++ b/common/app/app-stream.jsx @@ -1,18 +1,17 @@ import Rx from 'rx'; -import assign from 'object.assign'; -import { Router } from 'react-router'; +import { match } from 'react-router'; import App from './App.jsx'; import AppCat from './Cat'; import childRoutes from './routes'; -const router$ = Rx.Observable.fromNodeCallback(Router.run, Router); +const route$ = Rx.Observable.fromNodeCallback(match); -const routes = assign({ components: App }, childRoutes); +const routes = Object.assign({ components: App }, childRoutes); -export default function app$(location) { - return router$(routes, location) - .map(([initialState, transistion]) => { - return { initialState, transistion, AppCat }; +export default function app$({ location, history }) { + return route$({ routes, location, history }) + .map(([nextLocation, props]) => { + return { nextLocation, props, AppCat }; }); } diff --git a/common/app/routes/Hikes/flux/Actions.js b/common/app/routes/Hikes/flux/Actions.js index 94f3403590..2d9d44a4fd 100644 --- a/common/app/routes/Hikes/flux/Actions.js +++ b/common/app/routes/Hikes/flux/Actions.js @@ -1,5 +1,4 @@ import { Actions } from 'thundercats'; -import assign from 'object.assign'; import debugFactory from 'debug'; const debug = debugFactory('freecc:hikes:actions'); @@ -45,7 +44,7 @@ export default Actions({ dashedName, oldState.currentHike ); - return assign({}, oldState, { currentHike }); + return Object.assign({}, oldState, { currentHike }); } }); } diff --git a/common/app/routes/Jobs/components/CreateJobModal.jsx b/common/app/routes/Jobs/components/CreateJobModal.jsx new file mode 100644 index 0000000000..446ed957d6 --- /dev/null +++ b/common/app/routes/Jobs/components/CreateJobModal.jsx @@ -0,0 +1,43 @@ +import React, { PropTypes } from 'react'; +import { History } from 'react-router'; +import { Button, Modal } from 'react-bootstrap'; + +export default React.createClass({ + displayName: 'CreateJobsModal', + + propTypes: { + onHide: PropTypes.func, + showModal: PropTypes.bool + }, + + mixins: [History], + + goToNewJob(onHide) { + onHide(); + this.history.pushState(null, '/jobs/new'); + }, + + render() { + const { + showModal, + onHide + } = this.props; + + return ( + + +

Welcome to Free Code Camp's board

+

We post jobs specifically target to our junior developers.

+ +
+
+ ); + } +}); diff --git a/common/app/routes/Jobs/components/Jobs.jsx b/common/app/routes/Jobs/components/Jobs.jsx index 4b37571eb2..a4d8354b3f 100644 --- a/common/app/routes/Jobs/components/Jobs.jsx +++ b/common/app/routes/Jobs/components/Jobs.jsx @@ -1,23 +1,43 @@ import React, { cloneElement, PropTypes } from 'react'; import { contain } from 'thundercats-react'; +import { History } from 'react-router'; import { Button, Jumbotron, Row } from 'react-bootstrap'; + +import CreateJobModal from './CreateJobModal.jsx'; import ListJobs from './List.jsx'; export default contain( { store: 'jobsStore', - fetchAction: 'jobActions.getJobs' + fetchAction: 'jobActions.getJobs', + actions: 'jobActions' }, React.createClass({ displayName: 'Jobs', + + mixins: [History], + propTypes: { children: PropTypes.element, - jobs: PropTypes.array + jobActions: PropTypes.object, + jobs: PropTypes.array, + showModal: PropTypes.bool }, - renderList(jobs) { + handleJobClick(id) { + const { jobActions } = this.props; + if (!id) { + return null; + } + jobActions.findJob(id); + this.history.pushState(null, `/jobs/${id}`); + }, + + renderList(handleJobClick, jobs) { return ( - + ); }, @@ -32,7 +52,12 @@ export default contain( }, render() { - const { children, jobs } = this.props; + const { + children, + jobs, + showModal, + jobActions + } = this.props; return (
@@ -46,15 +71,19 @@ export default contain(

{ this.renderChild(children, jobs) || - this.renderList(jobs) } - + this.renderList(this.handleJobClick, jobs) } + +
); } diff --git a/common/app/routes/Jobs/components/List.jsx b/common/app/routes/Jobs/components/List.jsx index b90050aa74..2457bcb7f0 100644 --- a/common/app/routes/Jobs/components/List.jsx +++ b/common/app/routes/Jobs/components/List.jsx @@ -1,81 +1,85 @@ import React, { PropTypes } from 'react'; -import { contain } from 'thundercats-react'; import { PanelGroup, Thumbnail, Panel, Well } from 'react-bootstrap'; import moment from 'moment'; -export default contain( - { +export default React.createClass({ + displayName: 'ListJobs', + + propTypes: { + handleClick: PropTypes.func, + jobs: PropTypes.array }, - React.createClass({ - displayName: 'ListJobs', - propTypes: { - jobs: PropTypes.array - }, + renderJobs(handleClick, jobs =[]) { + const thumbnailStyle = { + backgroundColor: 'white', + maxHeight: '100px', + maxWidth: '100px' + }; - renderJobs(jobs =[]) { - const thumbnailStyle = { - backgroundColor: 'white', - maxHeight: '100px', - maxWidth: '100px' - }; - return jobs.map(( - { - id, - company, - position, - description, - logo, - city, - state, - email, - phone, - postedOn - }, - index - ) => { - const header = ( -
-

{ company }

-
- { position } -
-
- ); - return ( - - - - - Position: { position } - Location: { city }, { state } -
- Contact: { email || phone || 'N/A' } -
- Posted On: { moment(postedOn).format('MMMM Do, YYYY') } -
-

{ description }

-
-
- ); - }); - }, - - render() { - const { jobs } = this.props; - return ( - - { this.renderJobs(jobs) } - + return jobs.map(( + { + id, + company, + position, + isHighlighted, + description, + logo, + city, + state, + email, + phone, + postedOn + }, + index + ) => { + const header = ( +
+

{ company }

+
+ { position } +
+
); - } - }) -); + return ( + + + + + Position: { position } + Location: { city }, { state } +
+ Contact: { email || phone || 'N/A' } +
+ Posted On: { moment(postedOn).format('MMMM Do, YYYY') } +
+

handleClick(id) }>{ description }

+
+
+ ); + }); + }, + + render() { + const { + handleClick, + jobs + } = this.props; + + return ( + + { this.renderJobs(handleClick, jobs) } + + ); + } +}); diff --git a/common/app/routes/Jobs/components/NewJob.jsx b/common/app/routes/Jobs/components/NewJob.jsx new file mode 100644 index 0000000000..4c369411f0 --- /dev/null +++ b/common/app/routes/Jobs/components/NewJob.jsx @@ -0,0 +1,319 @@ +import React, { PropTypes } from 'react'; +import { History } from 'react-router'; +import { contain } from 'thundercats-react'; +import debugFactory from 'debug'; +import { getDefaults } from '../utils'; + +import { + inHTMLData, + uriInSingleQuotedAttr +} from 'xss-filters'; + +import { + Button, + Col, + Input, + Row, + Well +} from 'react-bootstrap'; + +import { + isAscii, + isEmail, + isMobilePhone, + isURL +} from 'validator'; + +const debug = debugFactory('freecc:jobs:newForm'); + +const checkValidity = [ + 'position', + 'locale', + 'description', + 'email', + 'phone', + 'url', + 'logo', + 'name', + 'highlight' +]; + +function formatValue(value, validator, type = 'string') { + const formated = getDefaults(type); + if (validator && type === 'string') { + formated.valid = validator(value); + } + if (value) { + formated.value = value; + formated.bsStyle = formated.valid ? 'success' : 'error'; + } + return formated; +} + +function isValidURL(data) { + return isURL(data, { 'require_protocol': true }); +} + +function isValidPhone(data) { + return isMobilePhone(data, 'en-US'); +} + +export default contain({ + actions: 'jobActions', + store: 'jobsStore', + map({ form = {} }) { + const { + position, + locale, + description, + email, + phone, + url, + logo, + name, + highlight + } = form; + return { + position: formatValue(position, isAscii), + locale: formatValue(locale, isAscii), + description: formatValue(description, isAscii), + email: formatValue(email, isEmail), + phone: formatValue(phone, isValidPhone), + url: formatValue(url, isValidURL), + logo: formatValue(logo, isValidURL), + name: formatValue(name, isAscii), + highlight: formatValue(highlight, null, 'bool') + }; + }, + subscribeOnWillMount() { + return typeof window !== 'undefined'; + } + }, + React.createClass({ + displayName: 'NewJob', + + propTypes: { + jobActions: PropTypes.object, + position: PropTypes.object, + locale: PropTypes.object, + description: PropTypes.object, + email: PropTypes.object, + phone: PropTypes.object, + url: PropTypes.object, + logo: PropTypes.object, + name: PropTypes.object, + highlight: PropTypes.object + }, + + mixins: [History], + + handleSubmit(e) { + e.preventDefault(); + const props = this.props; + let valid = true; + checkValidity.forEach((prop) => { + // if value exist, check if it is valid + if (props[prop].value && props[prop].type !== 'boolean') { + valid = valid && !!props[prop].valid; + } + }); + + if (!valid) { + debug('form not valid'); + return; + } + + const { + position, + locale, + description, + email, + phone, + url, + logo, + name, + highlight, + jobActions + } = this.props; + + // sanitize user output + const jobValues = { + position: inHTMLData(position.value), + location: inHTMLData(locale.value), + description: inHTMLData(description.value), + email: inHTMLData(email.value), + phone: inHTMLData(phone.value), + url: uriInSingleQuotedAttr(url.value), + logo: uriInSingleQuotedAttr(logo.value), + name: inHTMLData(name.value), + highlight: !!highlight.value + }; + + const job = Object.keys(jobValues).reduce((accu, prop) => { + if (jobValues[prop]) { + accu[prop] = jobValues[prop]; + } + return accu; + }, {}); + + job.postedOn = new Date(); + debug('job sanitized', job); + jobActions.saveForm(job); + + this.history.pushState(null, '/jobs/new/preview'); + }, + + componentDidMount() { + const { jobActions } = this.props; + jobActions.getSavedForm(); + }, + + handleChange(name, { target: { value } }) { + const { jobActions: { handleForm } } = this.props; + handleForm({ [name]: value }); + }, + + render() { + const { + position, + locale, + description, + email, + phone, + url, + logo, + name, + highlight, + jobActions: { handleForm } + } = this.props; + const { handleChange } = this; + const labelClass = 'col-sm-offset-1 col-sm-2'; + const inputClass = 'col-sm-6'; + + return ( +
+ + + +

Create Your Job Post

+
+ +
+

Job Information

+
+ handleChange('position', e) } + placeholder='Position' + type='text' + value={ position.value } + wrapperClassName={ inputClass } /> + handleChange('locale', e) } + placeholder='Location' + type='text' + value={ locale.value } + wrapperClassName={ inputClass } /> + handleChange('description', e) } + placeholder='Description' + rows='10' + type='textarea' + value={ description.value } + wrapperClassName={ inputClass } /> + +
+

Company Information

+
+ handleChange('name', e) } + placeholder='Foo, INC' + type='text' + value={ name.value } + wrapperClassName={ inputClass } /> + handleChange('email', e) } + placeholder='Email' + type='email' + value={ email.value } + wrapperClassName={ inputClass } /> + handleChange('phone', e) } + placeholder='555-123-1234' + type='tel' + value={ phone.value } + wrapperClassName={ inputClass } /> + handleChange('url', e) } + placeholder='http://freecatphotoapp.com' + type='url' + value={ url.value } + wrapperClassName={ inputClass } /> + handleChange('logo', e) } + placeholder='http://freecatphotoapp.com/logo.png' + type='url' + value={ logo.value } + wrapperClassName={ inputClass } /> + +
+

Make it stand out

+
+ handleForm({ + highlight: !!checked + }) + } + type='checkbox' /> +
+ + + + + + + + + +
+ ); + } + }) +); diff --git a/common/app/routes/Jobs/components/Preview.jsx b/common/app/routes/Jobs/components/Preview.jsx new file mode 100644 index 0000000000..5b6081be5c --- /dev/null +++ b/common/app/routes/Jobs/components/Preview.jsx @@ -0,0 +1,14 @@ +// import React, { PropTypes } from 'react'; +import { contain } from 'thundercats-react'; +import ShowJob from './ShowJob.jsx'; + +export default contain( + { + store: 'JobsStore', + actions: 'JobActions', + map({ form: job = {} }) { + return { job }; + } + }, + ShowJob +); diff --git a/common/app/routes/Jobs/components/Show.jsx b/common/app/routes/Jobs/components/Show.jsx index 209917cff7..ce2512c27d 100644 --- a/common/app/routes/Jobs/components/Show.jsx +++ b/common/app/routes/Jobs/components/Show.jsx @@ -1,59 +1,24 @@ -import React, { PropTypes } from 'react'; -import { Thumbnail, Panel, Well } from 'react-bootstrap'; -import moment from 'moment'; +import { contain } from 'thundercats-react'; +import ShowJob from './ShowJob.jsx'; -const thumbnailStyle = { - backgroundColor: 'white', - maxHeight: '100px', - maxWidth: '100px' -}; -export default React.createClass({ - displayName: 'ShowJob', - propTypes: { - job: PropTypes.object +export default contain( + { + store: 'jobsStore', + fetchAction: 'jobActions.getJob', + map({ currentJob }) { + return { job: currentJob }; + }, + getPayload({ params: { id }, job = {} }) { + return { + id, + isPrimed: job.id === id + }; + }, + // using es6 destructuring + shouldContainerFetch({ job = {} }, { params: { id } } + ) { + return job.id !== id; + } }, - - renderHeader({ company, position }) { - return ( -
-

{ company }

-
- { position } -
-
- ); - }, - - render() { - const { job } = this.props; - const { - logo, - position, - city, - state, - email, - phone, - postedOn, - description - } = job; - - return ( - - - - Position: { position } - Location: { city }, { state } -
- Contact: { email || phone || 'N/A' } -
- Posted On: { moment(postedOn).format('MMMM Do, YYYY') } -
-

{ description }

-
- ); - } -}); + ShowJob +); diff --git a/common/app/routes/Jobs/components/ShowJob.jsx b/common/app/routes/Jobs/components/ShowJob.jsx new file mode 100644 index 0000000000..1a048a3fff --- /dev/null +++ b/common/app/routes/Jobs/components/ShowJob.jsx @@ -0,0 +1,67 @@ +import React, { PropTypes } from 'react'; +import { Row, Thumbnail, Panel, Well } from 'react-bootstrap'; +import moment from 'moment'; + +const thumbnailStyle = { + backgroundColor: 'white', + maxHeight: '100px', + maxWidth: '100px' +}; + +export default React.createClass({ + displayName: 'ShowJob', + propTypes: { + job: PropTypes.object, + params: PropTypes.object + }, + + renderHeader({ company, position }) { + return ( +
+

{ company }

+
+ { position } +
+
+ ); + }, + + render() { + const { job = {} } = this.props; + const { + logo, + position, + city, + company, + state, + email, + phone, + postedOn, + description + } = job; + + return ( +
+ + + + + Position: { position } + Location: { city }, { state } +
+ Contact: { email || phone || 'N/A' } +
+ Posted On: { moment(postedOn).format('MMMM Do, YYYY') } +
+

{ description }

+
+
+
+ ); + } +}); diff --git a/common/app/routes/Jobs/flux/Actions.js b/common/app/routes/Jobs/flux/Actions.js index 68d5eeae57..5900e6dda1 100644 --- a/common/app/routes/Jobs/flux/Actions.js +++ b/common/app/routes/Jobs/flux/Actions.js @@ -1,27 +1,104 @@ import { Actions } from 'thundercats'; +import store from 'store'; import debugFactory from 'debug'; const debug = debugFactory('freecc:jobs:actions'); +const assign = Object.assign; export default Actions({ setJobs: null, - getJob(id) { - return { id }; + // findJob assumes that the job is already in the list of jobs + findJob(id) { + return oldState => { + const { currentJob = {}, jobs = [] } = oldState; + // currentJob already set + // do nothing + if (currentJob.id === id) { + return null; + } + const foundJob = jobs.reduce((newJob, job) => { + if (job.id === id) { + return job; + } + return newJob; + }, null); + + // if no job found this will be null which is a op noop + return foundJob ? + assign({}, oldState, { currentJob: foundJob }) : + null; + }; }, + setError: null, + getJob: null, getJobs(params) { return { params }; + }, + openModal() { + return { showModal: true }; + }, + closeModal() { + return { showModal: false }; + }, + handleForm(value) { + return { + transform(oldState) { + const { form } = oldState; + const newState = assign({}, oldState); + newState.form = assign( + {}, + form, + value + ); + return newState; + } + }; + }, + saveForm: null, + getSavedForm: null, + setForm(form) { + return { form }; } }) .refs({ displayName: 'JobActions' }) .init(({ instance: jobActions, args: [services] }) => { jobActions.getJobs.subscribe(() => { - services.read('job', null, null, (err, jobs) => { + services.read('jobs', null, null, (err, jobs) => { if (err) { debug('job services experienced an issue', err); - jobActions.setJobs({ jobs: [] }); + return jobActions.setError({ err }); } jobActions.setJobs({ jobs }); }); }); + + jobActions.getJob.subscribe(({ id, isPrimed }) => { + // job is already set, do nothing. + if (isPrimed) { + debug('job is primed'); + return; + } + services.read('jobs', { id }, null, (err, job) => { + if (err) { + debug('job services experienced an issue', err); + return jobActions.setError({ err }); + } + if (job) { + jobActions.setJobs({ currentJob: job }); + } + jobActions.setJobs({}); + }); + }); + + jobActions.saveForm.subscribe((form) => { + store.set('newJob', form); + }); + + jobActions.getSavedForm.subscribe(() => { + const job = store.get('newJob'); + if (job && !Array.isArray(job) && typeof job === 'object') { + jobActions.setForm(job); + } + }); return jobActions; }); diff --git a/common/app/routes/Jobs/flux/Store.js b/common/app/routes/Jobs/flux/Store.js index 803bc7b0bd..b2f5132013 100644 --- a/common/app/routes/Jobs/flux/Store.js +++ b/common/app/routes/Jobs/flux/Store.js @@ -1,10 +1,30 @@ import { Store } from 'thundercats'; -const { setter } = Store; +const { + createRegistrar, + setter, + transformer +} = Store; -export default Store() +export default Store({ showModal: false }) .refs({ displayName: 'JobsStore' }) .init(({ instance: jobsStore, args: [cat] }) => { - let jobActions = cat.getActions('JobActions'); - jobsStore.register(setter(jobActions.setJobs)); + const { + setJobs, + findJob, + setError, + openModal, + closeModal, + handleForm, + setForm + } = cat.getActions('JobActions'); + const register = createRegistrar(jobsStore); + register(setter(setJobs)); + register(setter(setError)); + register(setter(openModal)); + register(setter(closeModal)); + register(setter(setForm)); + + register(transformer(findJob)); + register(handleForm); }); diff --git a/common/app/routes/Jobs/index.js b/common/app/routes/Jobs/index.js index 9d52bf2b53..6c556c994e 100644 --- a/common/app/routes/Jobs/index.js +++ b/common/app/routes/Jobs/index.js @@ -1,14 +1,26 @@ import Jobs from './components/Jobs.jsx'; +import NewJob from './components/NewJob.jsx'; +import Show from './components/Show.jsx'; +import Preview from './components/Preview.jsx'; /* - * show: /jobs - * showOne: /jobs/:id - * edit /jobs/:id - * delete /jobs/:id - * createOne /jobs/new + * index: /jobs list jobs + * show: /jobs/:id show one job + * create /jobs/new create a new job */ export default { - path: 'jobs', - component: Jobs + childRoutes: [{ + path: '/jobs', + component: Jobs + }, { + path: 'jobs/new', + component: NewJob + }, { + path: 'jobs/new/preview', + component: Preview + }, { + path: 'jobs/:id', + component: Show + }] }; diff --git a/common/app/routes/Jobs/utils.js b/common/app/routes/Jobs/utils.js new file mode 100644 index 0000000000..aeb0396c12 --- /dev/null +++ b/common/app/routes/Jobs/utils.js @@ -0,0 +1,22 @@ +const defaults = { + 'string': { + value: '', + valid: false, + pristine: true, + type: 'string' + }, + bool: { + value: false, + type: 'boolean' + } +}; + +export function getDefaults(type, value) { + if (!type) { + return defaults['string']; + } + if (value) { + return Object.assign({}, defaults[type], { value }); + } + return Object.assign({}, defaults[type]); +} diff --git a/common/app/routes/index.js b/common/app/routes/index.js index 973e9f2bf0..1f14733f82 100644 --- a/common/app/routes/index.js +++ b/common/app/routes/index.js @@ -3,12 +3,8 @@ import Hikes from './Hikes'; export default { path: '/', - getChildRoutes(locationState, cb) { - setTimeout(() => { - cb(null, [ - Jobs, - Hikes - ]); - }, 0); - } + childRoutes: [ + Jobs, + Hikes + ] }; diff --git a/common/models/job.json b/common/models/job.json index a3392fee82..f77fc6defa 100644 --- a/common/models/job.json +++ b/common/models/job.json @@ -1,6 +1,7 @@ { "name": "job", "base": "PersistedModel", + "strict": true, "idInjection": true, "trackChanges": false, "properties": { @@ -29,6 +30,9 @@ "state": { "type": "string" }, + "url": { + "type": "string" + }, "country": { "type": "string" }, @@ -38,7 +42,7 @@ "description": { "type": "string" }, - "isApproverd": { + "isApproved": { "type": "boolean" }, "isHighlighted": { diff --git a/common/models/story.json b/common/models/story.json index 5d8e56dfb2..d338199a48 100644 --- a/common/models/story.json +++ b/common/models/story.json @@ -34,10 +34,6 @@ "description": { "type": "string" }, - "originalStoryAuthorEmail": { - "type": "string", - "default": "" - }, "rank": { "type": "number", "default": 0 diff --git a/common/models/user.json b/common/models/user.json index e1547203b1..01a3b3a6bc 100644 --- a/common/models/user.json +++ b/common/models/user.json @@ -161,6 +161,9 @@ "rand": { "type": "number", "index": true + }, + "tshirtVote": { + "type": "number" } }, "validations": [], diff --git a/gulpfile.js b/gulpfile.js index b5eee5417a..fd5fdda38d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,6 @@ +// enable debug for gulp +process.env.DEBUG = process.env.DEBUG || 'freecc:*'; + require('babel-core/register'); var Rx = require('rx'), gulp = require('gulp'), @@ -6,6 +9,7 @@ var Rx = require('rx'), // utils plumber = require('gulp-plumber'), notify = require('gulp-notify'), + gutil = require('gulp-util'), reduce = require('gulp-reduce-file'), sortKeys = require('sort-keys'), debug = require('debug')('freecc:gulp'), @@ -25,6 +29,7 @@ var Rx = require('rx'), // rev rev = require('gulp-rev'), revReplace = require('gulp-rev-replace'), + revDel = require('rev-del'), // lint jsonlint = require('gulp-jsonlint'), @@ -33,6 +38,7 @@ var Rx = require('rx'), Rx.config.longStackSupport = true; +var __DEV__ = process.env.NODE_ENV !== 'production'; var reloadDelay = 1000; var reload = sync.reload; var paths = { @@ -43,6 +49,8 @@ var paths = { '!public/js/bundle*', 'node_modules/', 'client/', + 'seed', + 'server/manifests/*.json', 'server/rev-manifest.json' ], @@ -67,8 +75,7 @@ var paths = { ], dependents: [ - 'client/commonFramework.js', - 'client/sandbox.js' + 'client/commonFramework.js' ], less: './client/less/main.less', @@ -107,11 +114,22 @@ function errorHandler() { this.emit('end'); } +function delRev(dest, manifestName) { + // in production do not delete old revisions + if (!__DEV__) { + return gutil.noop(); + } + return revDel({ + oldManifest: path.join(paths.manifest, manifestName), + dest: dest + }); +} + gulp.task('serve', function(cb) { var called = false; nodemon({ script: paths.server, - ext: '.js .json', + ext: '.jsx .js .json', ignore: paths.serverIgnore, exec: path.join(__dirname, 'node_modules/.bin/babel-node'), env: { @@ -143,7 +161,7 @@ var syncDepenedents = [ 'js', 'less', 'dependents', - 'pack-client', + 'pack-watch', 'build-manifest' ]; @@ -173,6 +191,9 @@ gulp.task('lint-json', function() { gulp.task('test-challenges', ['lint-json']); gulp.task('pack-client', function() { + var manifestName = 'react-manifest.json'; + var dest = webpackConfig.output.path; + return gulp.src(webpackConfig.entry) .pipe(plumber({ errorHandler: errorHandler })) .pipe(webpack(Object.assign( @@ -180,30 +201,73 @@ gulp.task('pack-client', function() { webpackConfig, webpackOptions ))) - .pipe(gulp.dest(webpackConfig.output.path)) + .pipe(gulp.dest(dest)) .pipe(rev()) // copy files to public - .pipe(gulp.dest(webpackConfig.output.path)) - // create and merge manifest - .pipe(rev.manifest('react-manifest.json')) + .pipe(gulp.dest(dest)) + // create manifest + .pipe(rev.manifest(manifestName)) + // delete old rev + .pipe(delRev( + dest, + manifestName + )) .pipe(gulp.dest(paths.manifest)); }); -gulp.task('pack-watch', function() { - return gulp.src(webpackConfig.entry) +var defaultStatsOptions = { + colors: gutil.colors.supportsColor, + hash: false, + timings: false, + chunks: false, + chunkModules: false, + modules: false, + children: true, + version: true, + cached: false, + cachedAssets: false, + reasons: false, + source: false, + errorDetails: false +}; + +gulp.task('pack-watch', function(cb) { + var called = false; + gulp.src(webpackConfig.entry) .pipe(plumber({ errorHandler: errorHandler })) .pipe(webpack(Object.assign( {}, webpackConfig, webpackOptions, { watch: true } - ))) - .pipe(gulp.dest(webpackConfig.output.path)) + ), null, function(notUsed, stats) { + if (stats) { + gutil.log(stats.toString(defaultStatsOptions)); + } + + if (!called) { + debug('webpack watch completed'); + called = true; + cb(); + } + + })) + .pipe(gulp.dest(webpackConfig.output.path)); +}); + +gulp.task('pack-watch-manifest', function() { + var manifestName = 'react-manifest.json'; + var dest = webpackConfig.output.path; + return gulp.src(dest + '/bundle.js') .pipe(rev()) // copy files to public - .pipe(gulp.dest(webpackConfig.output.path)) + .pipe(gulp.dest(dest)) // create manifest - .pipe(rev.manifest('react-manifest.json')) + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) .pipe(gulp.dest(paths.manifest)); }); @@ -217,32 +281,45 @@ gulp.task('pack-node', function() { gulp.task('pack', ['pack-client', 'pack-node']); gulp.task('less', function() { + var manifestName = 'css-manifest.json'; + var dest = paths.css; return gulp.src(paths.less) .pipe(plumber({ errorHandler: errorHandler })) // copile .pipe(less({ paths: [ path.join(__dirname, 'less', 'includes') ] })) - .pipe(gulp.dest(paths.css)) + .pipe(gulp.dest(dest)) // add revision .pipe(rev()) // copy files to public - .pipe(gulp.dest(paths.css)) + .pipe(gulp.dest(dest)) // create and merge manifest - .pipe(rev.manifest('css-manifest.json')) + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) .pipe(gulp.dest(paths.manifest)); }); gulp.task('js', function() { + var manifestName = 'js-manifest.json'; + var dest = paths.publicJs; + return gulp.src(paths.js) .pipe(plumber({ errorHandler: errorHandler })) - .pipe(gulp.dest(paths.publicJs)) + .pipe(gulp.dest(dest)) // create registry file .pipe(rev()) // copy revisioned assets to dest - .pipe(gulp.dest(paths.publicJs)) + .pipe(gulp.dest(dest)) // create manifest file - .pipe(rev.manifest('js-manifest.json')) + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) // copy manifest file to dest .pipe(gulp.dest(paths.manifest)); }); @@ -250,6 +327,9 @@ gulp.task('js', function() { // commonFramework depend on iFrameScripts // sandbox depends on plugin gulp.task('dependents', ['js'], function() { + var manifestName = 'dependents-manifest.json'; + var dest = paths.publicJs; + var manifest = gulp.src( path.join(__dirname, paths.manifest, 'js-manifest.json') ); @@ -257,9 +337,14 @@ gulp.task('dependents', ['js'], function() { return gulp.src(paths.dependents) .pipe(plumber({ errorHandler: errorHandler })) .pipe(revReplace({ manifest: manifest })) + .pipe(gulp.dest(dest)) .pipe(rev()) - .pipe(gulp.dest(paths.publicJs)) - .pipe(rev.manifest('dependents-manifest.json')) + .pipe(gulp.dest(dest)) + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) .pipe(gulp.dest(paths.manifest)); }); @@ -301,7 +386,9 @@ var watchDependents = [ 'dependents', 'serve', 'sync', - 'build-manifest' + 'build-manifest', + 'pack-watch', + 'pack-watch-manifest' ]; gulp.task('watch', watchDependents, function() { @@ -311,7 +398,15 @@ gulp.task('watch', watchDependents, function() { gulp.watch(paths.js, ['js', 'dependents']); gulp.watch(paths.dependents, ['dependents']); gulp.watch(paths.manifest + '/*.json', ['build-manifest-watch']); + gulp.watch(webpackConfig.output.path + '/bundle.js', ['pack-watch-manifest']); }); -gulp.task('default', ['less', 'serve', 'sync', 'watch', 'pack-watch']); +gulp.task('default', [ + 'less', + 'serve', + 'pack-watch', + 'pack-watch-manifest', + 'watch', + 'sync' +]); diff --git a/package.json b/package.json index 44833cc65d..f16e4bb9db 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,9 @@ "dependencies": { "accepts": "~1.2.5", "async": "~0.9.0", - "babel": "5.6.14", - "babel-core": "5.6.15", - "babel-eslint": "^4.0.5", + "babel": "5.8.23", + "babel-core": "5.8.23", + "babel-eslint": "4.1.1", "babel-loader": "5.2.2", "bcrypt-nodejs": "~0.0.3", "body-parser": "^1.13.2", @@ -36,6 +36,7 @@ "dedent": "^0.4.0", "dotenv": "~0.4.0", "errorhandler": "~1.3.0", + "es6-map": "^0.1.1", "eslint": "^1.1.0", "eslint-plugin-react": "^3.2.1", "express": "~4.10.4", @@ -53,13 +54,14 @@ "gulp-reduce-file": "0.0.1", "gulp-rev": "^6.0.1", "gulp-rev-replace": "^0.4.2", + "gulp-util": "^3.0.6", "gulp-webpack": "^1.5.0", "helmet": "~0.9.0", "helmet-csp": "^0.2.3", + "history": "^1.9.0", "jade": "~1.8.0", "json-loader": "^0.5.2", - "less": "~1.7.5", - "less-middleware": "~2.0.1", + "less": "~2.5.1", "lodash": "^3.9.3", "loopback": "https://github.com/FreeCodeCamp/loopback.git#fix/no-password", "loopback-boot": "2.8.2", @@ -85,33 +87,33 @@ "pmx": "^0.3.16", "ramda": "~0.10.0", "react": "^0.13.3", - "react-bootstrap": "^0.23.7", + "react-bootstrap": "~0.23.7", "react-motion": "~0.1.0", - "react-router": "https://github.com/BerkeleyTrue/react-router#freecodecamp", + "react-router": "^1.0.0-rc1", "react-vimeo": "^0.0.3", "request": "~2.53.0", + "rev-del": "^1.0.5", "rx": "^2.5.3", "sanitize-html": "~1.6.1", "sort-keys": "^1.1.1", "source-map-support": "^0.3.2", + "store": "https://github.com/berkeleytrue/store.js.git#feature/noop-server", "thundercats": "^2.1.0", "thundercats-react": "^0.1.0", "twit": "~1.1.20", "uglify-js": "~2.4.15", - "validator": "~3.22.1", + "validator": "^3.22.1", "webpack": "^1.9.12", + "xss-filters": "^1.2.6", "yui": "~3.18.1" }, "devDependencies": { - "babel-eslint": "^3.1.7", "blessed": "~0.0.37", "bower-main-files": "~0.0.4", "browser-sync": "~1.8.1", "browserify": "^10.2.4", "chai": "~1.10.0", "envify": "^3.4.0", - "eslint": "^0.21.2", - "eslint-plugin-react": "^2.3.0", "gulp": "~3.8.8", "gulp-eslint": "~0.9.0", "gulp-inject": "~1.0.2", diff --git a/public/css/lato.css b/public/css/lato.css new file mode 100644 index 0000000000..57941353cc --- /dev/null +++ b/public/css/lato.css @@ -0,0 +1,9 @@ +@font-face { + font-family: "Lato"; + src: url(/fonts/Lato-Regular.ttf) format("truetype"); +} + +@font-face { + font-family: "Lato Light"; + src: url(/fonts/Lato-Light.ttf) format("truetype"); +} diff --git a/public/css/ubuntu.css b/public/css/ubuntu.css new file mode 100644 index 0000000000..7036f2e4f4 --- /dev/null +++ b/public/css/ubuntu.css @@ -0,0 +1,9 @@ +@font-face { + font-family: "Ubuntu"; + src: url(/fonts/Ubuntu-Regular.ttf) format("truetype"); +} + +@font-face { + font-family: "Ubuntu Mono"; + src: url(/fonts/UbuntuMono-Regular.ttf) format("truetype"); +} diff --git a/public/fonts/Lato-Light.ttf b/public/fonts/Lato-Light.ttf old mode 100755 new mode 100644 diff --git a/public/fonts/Lato-Regular.ttf b/public/fonts/Lato-Regular.ttf new file mode 100644 index 0000000000..04ea8efb13 Binary files /dev/null and b/public/fonts/Lato-Regular.ttf differ diff --git a/public/fonts/Ubuntu-Regular.ttf b/public/fonts/Ubuntu-Regular.ttf new file mode 100644 index 0000000000..d748728a20 Binary files /dev/null and b/public/fonts/Ubuntu-Regular.ttf differ diff --git a/public/fonts/UbuntuMono-Regular.ttf b/public/fonts/UbuntuMono-Regular.ttf new file mode 100644 index 0000000000..fdd309d716 Binary files /dev/null and b/public/fonts/UbuntuMono-Regular.ttf differ diff --git a/public/fonts/ionicons.eot b/public/fonts/ionicons.eot old mode 100755 new mode 100644 diff --git a/public/fonts/ionicons.svg b/public/fonts/ionicons.svg old mode 100755 new mode 100644 diff --git a/public/fonts/ionicons.ttf b/public/fonts/ionicons.ttf old mode 100755 new mode 100644 diff --git a/public/fonts/ionicons.woff b/public/fonts/ionicons.woff old mode 100755 new mode 100644 diff --git a/seed/bonfireMDNlinks.js b/seed/bonfireMDNlinks.js index 0e0b0f89b1..d3beb5908d 100644 --- a/seed/bonfireMDNlinks.js +++ b/seed/bonfireMDNlinks.js @@ -1,93 +1,95 @@ -// MDN Links +/** + * MDN Links + * + * These links are for Bonfires. Each key/value pair is used to render a Bonfire with appropriate 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. + * + **/ -/* These links are for Bonfires. Each key/value pair is used to render a Bonfire with appropriate 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. -*/ -var links = - { +var links = { // ========= NON MDN REFS "Currying": "https://leanpub.com/javascript-allonge/read#pabc", "Smallest Common Multiple": "https://www.mathsisfun.com/least-common-multiple.html", "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", + "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", - "Boolean Objects" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", - "RegExp" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", - "Global Function Object": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", - "Arguments object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments", + // ========= 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", + "Boolean Objects": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", + "RegExp": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", + "Global Function Object": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", + "Arguments object": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments", "Closures": "https://developer.mozilla.org/en-US/docs/" + "Web/JavaScript/Closures", - // ========= GLOBAL OBJECT METHODS - "parseInt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt", + // ========= 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", + // ========= PROPERTIES/MISC + "String.length": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length", - // ========== OBJECT METHODS - "Object.getOwnPropertyNames()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", - "Object.keys()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys", - "Object.hasOwnProperty()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", + // ========== OBJECT METHODS + "Object.getOwnPropertyNames()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", + "Object.keys()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys", + "Object.hasOwnProperty()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", - // ======== STRING METHODS - "String.charAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt", - "String.charCodeAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt", - "String.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat", - "String.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf", - "String.fromCharCode()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode", - "String.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "String.match()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match", - "String.replace()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace", - "String.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice", - "String.split()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split", - "String.substring()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring", - "String.substr()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr", - "String.toLowerCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase", - "String.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString", - "String.toUpperCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase", - // ======== ARRAY METHODS - "Array.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat", - "Array.every()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every", - "Array.filter()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter", - "Array.forEach()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach", - "Array.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf", - "Array.isArray()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray", - "Array.join()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join", - "Array.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf", - "Array.map()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map", - "Array.pop()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop", - "Array.push()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push", - "Array.reduce()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce", - "Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse", - "Array.shift()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift", - "Array.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice", - "Array.some()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some", - "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", + // ======== STRING METHODS + "String.charAt()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt", + "String.charCodeAt()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt", + "String.concat()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat", + "String.indexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf", + "String.fromCharCode()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode", + "String.lastIndexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf", + "String.match()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match", + "String.replace()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace", + "String.slice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice", + "String.split()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split", + "String.substring()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring", + "String.substr()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr", + "String.toLowerCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase", + "String.toString()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString", + "String.toUpperCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase", - // ======== MATH METHODS - "Math.max()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max", - "Math.min()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min", - "Math.pow()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow", - "Remainder" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_(.25)", + // ======== ARRAY METHODS + "Array.concat()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat", + "Array.every()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every", + "Array.filter()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter", + "Array.forEach()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach", + "Array.indexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf", + "Array.isArray()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray", + "Array.join()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join", + "Array.lastIndexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf", + "Array.map()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map", + "Array.pop()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop", + "Array.push()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push", + "Array.reduce()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce", + "Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse", + "Array.shift()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift", + "Array.slice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice", + "Array.some()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some", + "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", - "Details of the Object Model" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model", + // ======== MATH METHODS + "Math.max()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max", + "Math.min()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min", + "Math.pow()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow", + "Remainder": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_(.25)", + + // ======== 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", + "Details of the Object Model": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model", "For Loops": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for" - }; +}; module.exports = links; diff --git a/seed/challenges/advanced-bonfires.json b/seed/challenges/advanced-bonfires.json index b20b350c9b..e7cd4030d4 100644 --- a/seed/challenges/advanced-bonfires.json +++ b/seed/challenges/advanced-bonfires.json @@ -14,7 +14,7 @@ "Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code." ], "tests": [ - "expect(telephoneCheck(\"555-555-5555\")).to.be.a(\"boolean\");", + "assert.isBoolean(telephoneCheck(\"555-555-5555\"), 'should return a boolean.');", "assert.deepEqual(telephoneCheck(\"1 555-555-5555\"), true);", "assert.deepEqual(telephoneCheck(\"1 (555) 555-5555\"), true);", "assert.deepEqual(telephoneCheck(\"5555555555\"), true);", @@ -134,9 +134,9 @@ "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]]);" ], "tests": [ - "expect(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]])).to.be.a('array');", - "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.isArray(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]]), 'should return an array.');", + "assert.isString(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]]), 'should return a string.');", + "assert.isString(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]]), 'should return 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', 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');", @@ -190,8 +190,8 @@ "inventory(curInv, newInv);" ], "tests": [ - "expect(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']])).to.be.a('array');", - "assert.equal(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]).length, 6);", + "assert.isArray(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), 'should return an array.');", + "assert.equal(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]).length, 6, 'should return an array with a length of 6.');", "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[88, 'Bowling Ball'], [2, 'Dirty Sock'], [3, 'Hair Pin'], [3, 'Half-Eaten Apple'], [5, 'Microphone'], [7, 'Toothpaste']]);", "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], []), [[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']]);", "assert.deepEqual(inventory([], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[67, 'Bowling Ball'], [2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [7, 'Toothpaste']]);", @@ -230,13 +230,13 @@ "permAlone('aab');" ], "tests": [ - "expect(permAlone('aab')).to.be.a('number');", - "expect(permAlone('aab')).to.equal(2);", - "expect(permAlone('aaa')).to.equal(0);", - "expect(permAlone('aabb')).to.equal(8);", - "expect(permAlone('abcdefa')).to.equal(3600);", - "expect(permAlone('abfdefa')).to.equal(2640);", - "expect(permAlone('zzzzzzzz')).to.equal(0);" + "assert.isNumber(permAlone('aab'), 'should return a \"number\".');", + "assert.strictEqual(permAlone('aab'), 2, 'should return 2.');", + "assert.strictEqual(permAlone('aaa'), 0, 'should return 0.');", + "assert.strictEqual(permAlone('aabb'), 8, 'should return 8.');", + "assert.strictEqual(permAlone('abcdefa'), 3600, 'should return 3600.');", + "assert.strictEqual(permAlone('abfdefa'), 2640, 'should return 2640.');", + "assert.strictEqual(permAlone('zzzzzzzz'), 0, 'should return 0.');" ], "MDNlinks": [ "Permutations", diff --git a/seed/challenges/basejumps.json b/seed/challenges/basejumps.json index bf872054bf..2235eefc58 100644 --- a/seed/challenges/basejumps.json +++ b/seed/challenges/basejumps.json @@ -13,11 +13,11 @@ "If you don't already have Cloud 9 account, create one now at http://c9.io.", "Now let's get your development environment ready for a new Angular-Fullstack application provided by Yeoman.", "Open up http://c9.io and sign in to your account.", - "Click on Create New Workspace at the top right of the c9.io page, then click on the \"Create a new workspace\" popup that appears below it the button after you click on it.", - "Give your workspace a name.", + "Click on the \"+\" icon at the top right of the c9.io page to create a new workspace.", + "Give your workspace a name and an optional description.", "Choose Node.js in the selection area below the name field.", - "Click the Create button. Then click into your new workspace.", - "In the lower right hand corner you should see a terminal window. In this window use the following commands. You don't need to know what these mean at this point.", + "Click the \"Create workspace\" button.", + "Once C9 builds and loads your workspace, you should see a terminal window in the lower right hand corner. In this window use the following commands. You don't need to know what these mean at this point.", "Never run this command on your local machine. But in your Cloud 9 terminal window, run: rm -rf * && echo \"export NODE_PATH=$NODE_PATH:/home/ubuntu/.nvm/v0.10.35/lib/node_modules\" >> ~/.bashrc && source ~/.bashrc && npm install -g yo grunt grunt-cli generator-angular-fullstack && yo angular-fullstack", "Yeoman will prompt you to answer some questions. Answer them like this:", "What would you like to write scripts with? JavaScript", @@ -79,14 +79,14 @@ "User Story: As an authenticated user, I can see the aggregate results of my polls.", "User Story: As an authenticated user, I can delete polls that I decide I don't want anymore.", "User Story: As an authenticated user, I can create a poll with any number of possible items.", - "Bonus User Story: As an unauthenticated user, I can see everyone's polls, but I can't vote on anything.", + "Bonus User Story: As an unauthenticated or authenticated user, I can see and vote on everyone's polls.", "Bonus User Story: As an unauthenticated or authenticated user, I can see the results of polls in chart form. (This could be implemented using Chart.js or Google Charts.)", "Bonus User Story: As an authenticated user, if I don't like the options on a poll, I can create a new option.", "If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.", "Once you've finished implementing these user stories, click the \"I've completed this challenge\" button and enter the URLs for both your GitHub repository and your live app running on Heroku. If you pair programmed with a friend, enter his or her Free Code Camp username as well so that you both get credit for completing it.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your Heroku project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], - "type": "basejumps", + "type": "basejump", "challengeType": 4, "tests": [], "nameCn": "", @@ -118,9 +118,9 @@ "Hint: Try using the Yelp API to find venues in the cities your users search for.", "If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.", "Once you've finished implementing these user stories, click the \"I've completed this challenge\" button and enter the URLs for both your GitHub repository and your live app running on Heroku. If you pair programmed with a friend, enter his or her Free Code Camp username as well so that you both get credit for completing it.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your Heroku project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], - "type": "basejumps", + "type": "basejump", "challengeType": 4, "tests": [], "nameCn": "", @@ -151,9 +151,9 @@ "Bonus User Story: As a user, I can see changes in real-time when any other user adds or removes a stock.", "If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.", "Once you've finished implementing these user stories, click the \"I've completed this challenge\" button and enter the URLs for both your GitHub repository and your live app running on Heroku. If you pair programmed with a friend, enter his or her Free Code Camp username as well so that you both get credit for completing it.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your Heroku project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], - "type": "basejumps", + "type": "basejump", "challengeType": 4, "tests": [], "nameCn": "", @@ -184,9 +184,9 @@ "Bonus User Story: As an authenticated user, I can propose a trade and wait for the other user to accept the trade.", "If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.", "Once you've finished implementing these user stories, click the \"I've completed this challenge\" button and enter the URLs for both your GitHub repository and your live app running on Heroku. If you pair programmed with a friend, enter his or her Free Code Camp username as well so that you both get credit for completing it.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your Heroku project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], - "type": "basejumps", + "type": "basejump", "challengeType": 4, "tests": [], "nameCn": "", @@ -220,9 +220,9 @@ "Hint: Masonry.js is a library that allows for Pinterest-style image grids.", "If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.", "Once you've finished implementing these user stories, click the \"I've completed this challenge\" button and enter the URLs for both your GitHub repository and your live app running on Heroku. If you pair programmed with a friend, enter his or her Free Code Camp username as well so that you both get credit for completing it.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your Heroku project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], - "type": "basejumps", + "type": "basejump", "challengeType": 4, "tests": [], "nameCn": "", diff --git a/seed/challenges/basic-bonfires.json b/seed/challenges/basic-bonfires.json index 250e4a9a2a..34c4c809ad 100644 --- a/seed/challenges/basic-bonfires.json +++ b/seed/challenges/basic-bonfires.json @@ -1,6 +1,6 @@ { "name": "Basic Algorithm Scripting", - "order": 0.006, + "order": 0.007, "challenges": [ { "id": "ad7123c8c441eddfaeb5bdef", @@ -8,13 +8,13 @@ "difficulty": "0", "description": [ "Your goal is to fix the failing test.", - "First, run all the tests by clicking \"Run code\" or by pressing Control + Enter.", + "First, run all the tests by clicking \"Run tests\" or by pressing Control + Enter.", "The failing test is in red. Fix the code so that all tests pass. Then you can move on to the next Bonfire.", "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,23 +46,23 @@ "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.", "You may need to turn the string into an array before you can reverse it.", "Your result must be a string.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function reverseString(str) {", " return str;", "}", "", - "reverseString('hello');" + "reverseString(\"hello\", \"\");" ], "MDNlinks": [ "Global String Object", @@ -87,26 +87,26 @@ "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);", - "expect(factorialize(0)).to.equal(1);" + "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(factorialize(0) === 1, '0 should return 1.');" ], "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", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "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": [ "function factorialize(num) {", " return num;", "}", "", - "factorialize(5);" + "factorialize(5, '');" ], "MDNlinks": [ "Arithmetic Operators" @@ -133,20 +133,20 @@ "A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.", "You'll need to remove punctuation and turn everything lower case in order to check for palindromes.", "We'll pass strings with varying formats, such as \"racecar\", \"RaceCar\", and \"race CAR\" among others.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "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.deepEqual(palindrome(\"My age is 0, 0 si ega ym.\"), true);", - "assert.deepEqual(palindrome(\"I'm 23 non 32 m'I?\"), true);", - "assert.deepEqual(palindrome(\"1 eye for of 1 eye.\"), 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.');", + "assert(palindrome(\"My age is 0, 0 si ega ym.\") === true, '\"My age is 0, 0 si ega ym.\" should return true.');", + "assert(palindrome(\"1 eye for of 1 eye.\") === false, '\"1 eye for of 1 eye.\" should return false.');", + "assert(palindrome(\"0_0 (: /-\\ :) 0-0\") === true, '\"0_0 (: /-\\\\ :) 0-0\" should return true.');" ], "challengeSeed": [ "function palindrome(str) {", @@ -182,22 +182,22 @@ "description": [ "Return the length of the longest word in the provided sentence.", "Your response should be a number.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function findLongestWord(str) {", " 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(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 19.');" ], "MDNlinks": [ "String.split()", @@ -221,22 +221,22 @@ "title": "Title Case a Sentence", "difficulty": "1.05", "description": [ - "Return the provided string with the first letter of each word capitalized.", - "For the purpose of this exercise, you should also capitalize connecting words like 'the' and 'of'.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.", + "For the purpose of this exercise, you should also capitalize connecting words like \"the\" and \"of\".", + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function titleCase(str) {", " 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(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\", '\"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()" @@ -262,7 +262,7 @@ "Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays.", "Remember, you can iterate through an array with a simple for loop, and access each member with array syntax arr[i] .", "If you are writing your own Chai.js tests, be sure to use a deep equal statement instead of an equal statement when comparing arrays.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function largestOfFour(arr) {", @@ -270,12 +270,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');", - "assert.deepEqual( largestOfFour( [[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27,5,39,1001], 'arrays should match.');", - "assert.deepEqual( largestOfFour( [[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9,35,97,1000000], 'arrays should match.');" + "assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, 'largestOfFour() should return an array.');", + "assert.deepEqual(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.deepEqual(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" @@ -299,7 +299,7 @@ "difficulty": "1.07", "description": [ "Check if a string (first argument) ends with the given target string (second argument).", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function end(str, target) {", @@ -308,14 +308,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(end(\"Bastian\", \"n\") === true, '\"Bastian\", \"n\" should return true.');", + "assert(end(\"Connor\", \"n\") === false, '\"Connor\", \"n\" should return false.');", + "assert(end(\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") === false, '\"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, '\"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, '\"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()" @@ -339,7 +339,7 @@ "difficulty": "1.08", "description": [ "Repeat a given string (first argument) n times (second argument). Return an empty string if n is a negative number.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function repeat(str, num) {", @@ -347,12 +347,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(repeat(\"*\", 3) === \"***\", '\"*\", 3 should return \"***\".');", + "assert(repeat(\"abc\", 3) === \"abcabcabc\", '\"abc\", 3 should return \"abcabcabc\".');", + "assert(repeat(\"abc\", -2) === \"\", '\"abc\", -2 should return \"\".');" ], "MDNlinks": [ "Global String Object" @@ -375,9 +375,9 @@ "title": "Truncate a string", "difficulty": "1.09", "description": [ - "Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a '...' ending.", + "Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a \"...\" ending.", "Note that the three dots at the end add to the string length.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function truncate(str, num) {", @@ -385,13 +385,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) === \"A-tisket...\", '\"A-tisket a-tasket A green and yellow basket\", 1 should return \"A-tisket...\".');", + "assert(truncate(\"Peter Piper picked a peck of pickled peppers\", 14) === \"Peter Piper...\", '\"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\", '\"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', '\"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()" @@ -415,7 +415,7 @@ "difficulty": "1.10", "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.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function chunk(arr, size) {", @@ -423,13 +423,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\"]], '[\"a\", \"b\", \"c\", \"d\"], 2 should return [[\"a\", \"b\"], [\"c\", \"d\"]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], '[0, 1, 2, 3, 4, 5] should return [[0, 1, 2], [3, 4, 5]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 2 should return [[0, 1], [2, 3], [4, 5]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 4 should return [[0, 1, 2, 3], [4, 5]].');" ], "MDNlinks": [ "Array.push()" @@ -453,7 +453,7 @@ "difficulty": "1.11", "description": [ "Return the remaining elements of an array after chopping off n elements from the head.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function slasher(arr, howMany) {", @@ -461,12 +461,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], 'slasher([1, 2, 3], 2) should return [3].');", + "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'slasher([1, 2, 3], 0) should return [1, 2, 3].');", + "assert.deepEqual(slasher([1, 2, 3], 9), [], 'slasher([1, 2, 3], 9) should return [].');" ], "MDNlinks": [ "Array.slice()", @@ -491,27 +491,27 @@ "difficulty": "1.12", "description": [ "Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.", - "For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.", - "The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.", - "Lastly, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "For example, [\"hello\", \"Hello\"], should return true because all of the letters in the second string are present in the first, ignoring case.", + "The arguments [\"hello\", \"hey\"] should return false because the string \"hello\" does not contain a \"y\".", + "Lastly, [\"Alien\", \"line\"], should return true because all of the letters in \"line\" are present in \"Alien\".", + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function mutation(arr) {", " 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\"]) === false, '[\"hello\", \"hey\"] should return false.');", + "assert(mutation([\"hello\", \"Hello\"]) === true, '[\"hello\", \"Hello\"] should return true.');", + "assert(mutation([\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"]) === true, '[\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"] should return true.');", + "assert(mutation([\"Mary\", \"Army\"]) === true, '[\"Mary\", \"Army\"] should return true.');", + "assert(mutation([\"Mary\", \"Aarmy\"]) === true, '[\"Mary\", \"Aarmy\"] should return true.');", + "assert(mutation([\"Alien\", \"line\"]) === true, '[\"Alien\", \"line\"] should return true.');", + "assert(mutation([\"floor\", \"for\"]) === true, '[\"floor\", \"for\"] should return true.');", + "assert(mutation([\"hello\", \"neo\"]) === false, '[\"hello\", \"neo\"] should return false.');" ], "MDNlinks": [ "Array.indexOf()" @@ -536,7 +536,7 @@ "description": [ "Remove all falsy values from an array.", "Falsy values in javascript are false, null, 0, \"\", undefined, and NaN.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function bouncer(arr) {", @@ -544,12 +544,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 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, NaN, undefined, '']), [], 'should return empty array if all elements are falsy');" + "assert.deepEqual(bouncer([7, \"ate\", \"\", false, 9]), [7, \"ate\", 9], '[7, \"ate\", \"\", false, 9] should return [7, \"ate\", 9].');", + "assert.deepEqual(bouncer([\"a\", \"b\", \"c\"]), [\"a\", \"b\", \"c\"], '[\"a\", \"b\", \"c\"] should return [\"a\", \"b\", \"c\"].');", + "assert.deepEqual(bouncer([false, null, 0, NaN, undefined, '']), [], '[false, null, 0] should return [].');" ], "MDNlinks": [ "Boolean Objects", @@ -568,55 +568,13 @@ "namePt": "", "descriptionPt": [] }, - { - "id": "a8e512fbe388ac2f9198f0fa", - "title": "Where art thou", - "difficulty": "1.55", - "description": [ - "Make a function that looks through an array of objects (first argument) and returns an array of all objects that have matching property and value pairs (second argument). Each property and value pair of the source object has to be present in the object from the collection if it is to be included in the returned array.", - "For example, if the first argument is [{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], and the second argument is { last: 'Capulet' }, then you must return the third object from the array (the first argument), because it contains the property and it's value, that was passed on as the second argument.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." - ], - "challengeSeed": [ - "function where(collection, source) {", - " var arr = [];", - " // What's in a name?", - " return arr;", - "}", - "", - "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([{ 'a': 1, 'b': 2 }, { 'a': 1 }, { 'a': 1, 'b': 2, 'c': 2 }], { 'a': 1, 'b': 2 }), [{ 'a': 1, 'b': 2 }, { 'a': 1, 'b': 2, 'c': 2 }], 'should return two objects in array');", - "assert.deepEqual(where([{ 'a': 5 }, { 'a': 5 }, { 'a': 5, 'b': 10 }], { 'a': 5, 'b': 10 }), [{ 'a': 5, 'b': 10 }], 'should return a single object in array');" - ], - "MDNlinks": [ - "Global Object", - "Object.hasOwnProperty()", - "Object.keys()" - ], - "type": "bonfire", - "challengeType": 5, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, { "id": "a39963a4c10bc8b4d4f06d7e", "title": "Seek and Destroy", "difficulty": "1.60", "description": [ "You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function destroyer(arr) {", @@ -624,14 +582,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], '[1, 2, 3, 1, 2, 3], 2, 3 should return [1, 1].');", + "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], '[1, 2, 3, 5, 1, 2, 3], 2, 3 should return [1, 5, 1].');", + "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], '[3, 5, 1, 2, 2], 2, 3, 5 should return [1].');", + "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], '[2, 3, 2, 3], 2, 3 should return [].');", + "assert.deepEqual(destroyer([\"tree\", \"hamburger\", 53], \"tree\", 53), [\"hamburger\"], '[\"tree\", \"hamburger\", 53], \"tree\", 53) should return [\"hamburger\"].');" ], "MDNlinks": [ "Arguments object", @@ -657,7 +615,7 @@ "description": [ "Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).", "For example, where([1,2,3,4], 1.5) should return 1 because it is greater than 1 (0th index), but less than 2 (1st index).", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ "function where(arr, num) {", @@ -665,18 +623,18 @@ " return num;", "}", "", - "where([40, 60], 50);" + "where([40, 60], 50, \"\");" ], "MDNlinks": [ "Array.sort()" ], "tests": [ - "assert.strictEqual(where([10, 20, 30, 40, 50], 35), 3, '35 should be placed at index 3');", - "assert.strictEqual(where([10, 20, 30, 40, 50], 30), 2, '30 should be placed at index 2');", - "assert.strictEqual(where([40, 60], 50), 1, '50 should be placed at index 1');", - "assert.strictEqual(where([5, 3, 20, 3], 3), 0, '3 should be placed at index 0');", - "assert.strictEqual(where([2, 20, 10], 1), 0, '1 should be placed at index 0');", - "assert.strictEqual(where([2, 5, 10], 15), 3, '15 should be placed at index 3');" + "assert(where([10, 20, 30, 40, 50], 35) === 3, '[10, 20, 30, 40, 50], 35 should return 3.');", + "assert(where([10, 20, 30, 40, 50], 30) === 2, '[10, 20, 30, 40, 50], 30) should return 2.');", + "assert(where([40, 60], 50) === 1, '[40, 60,], 50 should return 1.');", + "assert(where([5, 3, 20, 3], 3) === 0, '[5, 3, 20, 3], 3 should return 0.');", + "assert(where([2, 20, 10], 1) === 0, '[2, 20, 10], 1 should return 0.');", + "assert(where([2, 5, 10], 15) === 3, '[2, 5, 10], 15 should return 3.');" ], "type": "bonfire", "challengeType": 5, diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index b42dcf7db4..80ff4839bf 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -18,7 +18,7 @@ ], "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(/(\\/\\*)[\\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":[ @@ -42,7 +42,7 @@ "challengeSeed": [ "function welcomeToBooleans() {", "", - "// don't change code above here", + "// Only change code below this line.", "", " return false;", "", @@ -66,7 +66,7 @@ "Look at the ourName example if you get stuck." ], "tests": [ - "assert((function(){/**/if(typeof(myName) !== \"undefined\" && typeof(myName) === \"string\" && myName.length > 0){return true;}else{return false;}/**/})(), 'myName should be a string that contains at least one character in it');" + "assert((function(){if(typeof(myName) !== \"undefined\" && typeof(myName) === \"string\" && myName.length > 0){return true;}else{return false;}})(), 'myName should be a string that contains at least one character in it.');" ], "challengeSeed": [ "// var ourName = \"Free Code Camp\";", @@ -90,11 +90,11 @@ "Now let's create two new string variables: myFirstNameand myLastName and assign them the values of your first and last name, respectively." ], "tests": [ - "assert((function(){if(typeof(myFirstName) !== \"undefined\" && typeof(myFirstName) === \"string\" && myFirstName.length > 0){return true;}else{return false;}})(), 'myFirstName should be a string with a least one character in it');", - "assert((function(){if(typeof(myLastName) !== \"undefined\" && typeof(myLastName) === \"string\" && myLastName.length > 0){return true;}else{return false;}})(), 'myLastName should be a string with a least one character in it');" + "assert((function(){if(typeof(myFirstName) !== \"undefined\" && typeof(myFirstName) === \"string\" && myFirstName.length > 0){return true;}else{return false;}})(), 'myFirstName should be a string with at least one character in it.');", + "assert((function(){if(typeof(myLastName) !== \"undefined\" && typeof(myLastName) === \"string\" && myLastName.length > 0){return true;}else{return false;}})(), 'myLastName should be a string with at least one character in it.');" ], "challengeSeed": [ - "// name = \"Alan Turing\";", + "// var name = \"Alan Turing\";", "// var firstName = \"Alan\";", "// var lastName = \"Turing\";", "", @@ -112,13 +112,13 @@ "title": "Check the Length Property of a String Variable", "difficulty": "9.9809", "description": [ - "data structures have properties. For example, strings have a property called .length that will tell you how many characters are in the string.", + "Data structures have properties. For example, strings have a property called .length that will tell you how many characters are in the string.", "For example, if we created a variable var firstName = \"Charles\", we could find out how long the string \"Charles\" is by using the firstName.length property.", "Use the .length property to count the number of characters in the lastName variable." ], "tests": [ - "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'lastNameLength should be equal to eight.');", - "assert((function(){if(editor.getValue().match(/\\.length/gi) && editor.getValue().match(/\\.length/gi).length >= 2 && editor.getValue().match(/var lastNameLength \\= 0;/gi) && editor.getValue().match(/var lastNameLength \\= 0;/gi).length >= 1){return true;}else{return false;}})(), 'You should be getting the length of lastName by using .length like this: lastName.length');" + "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'lastNameLength should be equal to eight.');", + "assert((function(){if(editor.getValue().match(/\\.length/gi) && editor.getValue().match(/\\.length/gi).length >= 2 && editor.getValue().match(/var lastNameLength \\= 0;/gi) && editor.getValue().match(/var lastNameLength \\= 0;/gi).length >= 1){return true;}else{return false;}})(), 'You should be getting the length of lastName by using .length like this: lastName.length.');" ], "challengeSeed": [ "var firstNameLength = 0;", @@ -129,7 +129,7 @@ "", "var lastName = \"Lovelace\";", "", - "// don't change code above here", + "// Only change code below this line.", "", "lastNameLength = lastName;", "", @@ -155,7 +155,7 @@ "Try looking at the firstLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "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');" + "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 firstLetterOfFirstName = \"\";", @@ -189,7 +189,7 @@ "Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "assert(thirdLetterOfLastName === 'v', 'The third letter of lastName should be a \"v\"');" + "assert(thirdLetterOfLastName === 'v', 'The third letter of lastName should be a \"v\".');" ], "challengeSeed": [ "var firstName = \"Ada\";", @@ -220,8 +220,8 @@ "Try looking at the lastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "assert(lastLetterOfLastName === \"e\", 'lastLetterOfLastName should be \"e\"');", - "assert(editor.getValue().match(/\\.length/g).length === 2, 'You have to use .length to get the last letter');" + "assert(lastLetterOfLastName === \"e\", 'lastLetterOfLastName should be \"e\".');", + "assert(editor.getValue().match(/\\.length/g).length === 2, 'You have to use .length to get the last letter.');" ], "challengeSeed": [ "var firstName = \"Ada\";", @@ -252,7 +252,7 @@ "Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "assert(secondToLastLetterOfLastName === 'c', 'secondToLastLetterOfLastName should be \"c\".');", + "assert(secondToLastLetterOfLastName === 'c', 'secondToLastLetterOfLastName should be \"c\".');", "assert(editor.getValue().match(/\\.length/g).length === 2, 'You have to use .length to get the second last letter.');" ], "challengeSeed": [ @@ -302,11 +302,11 @@ "difficulty": "9.98142", "description": [ "We can also subtract one number from another.", - "JavaScript uses use the - symbol for subtraction.", + "JavaScript uses the - symbol for subtraction.", "Replace the 0 with the correct number so you can get the result mentioned in the comment." ], "tests": [ - "assert((function(){if(difference === 12 && editor.getValue().match(/\\-/g)){return true;}else{return false;}})(), 'Make the variable difference equal 12');" + "assert((function(){if(difference === 12 && editor.getValue().match(/\\-/g)){return true;}else{return false;}})(), 'Make the variable difference equal 12.');" ], "challengeSeed": [ "var difference = 45 - 0; //make this equal to 12 by changing the 0 into the appropriate number.", @@ -325,14 +325,14 @@ "difficulty": "9.98143", "description": [ "We can also multiply one number by another.", - "JavaScript uses use the * symbol for multiplication.", + "JavaScript uses the * symbol for multiplication.", "Replace the 0 with the correct number so you can get the result mentioned in the comment." ], "tests": [ "assert((function(){if(product === 80 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'Make the variable product equal 80.');" ], "challengeSeed": [ - "var product = 8 * 0; //make this equal to 80 by changing the 0 into the appropriate number.", + "var product = 8 * 0; // Make this equal to 80 by changing the 0 into the appropriate number.", "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", @@ -348,7 +348,7 @@ "difficulty": "9.9814", "description": [ "We can also divide one number by another.", - "JavaScript uses use the / symbol for division.", + "JavaScript uses the / symbol for division.", "Replace the 0 with the correct number so you can get the result mentioned in the comment." ], "tests": [ @@ -421,17 +421,17 @@ "difficulty": "9.9816", "description": [ "With JavaScript array variables, we can store several pieces of data in one place.", - "You start an array declaration with an opening bracket, end it with a closing bracket, and put a comma between each entry, like this: var sandwich = [\"peanut butter\", \"jelly\", \"bread\"].", + "You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this: var sandwich = [\"peanut butter\", \"jelly\", \"bread\"].", "Now let's create a new array called myArray that contains both a string and a number (in that order).", - "Refer to the comments if you get stuck." + "Refer to the commented code in the text editor if you get stuck." ], "tests": [ - "assert(typeof(myArray) == 'object', 'myArray should be an array');", - "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The first item in myArray should be a string');", - "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number');" + "assert(typeof(myArray) == 'object', 'myArray should be an array.');", + "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The first item in myArray should be a string.');", + "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number.');" ], "challengeSeed": [ - "//var array = [\"John\", 23];", + "// var array = [\"John\", 23];", "", "// Only change code below this line.", "", @@ -450,7 +450,7 @@ "title": "Nest one Array within Another Array", "difficulty":"9.98161", "description":[ - "You can also nest arrays within other arrays, like this: [[\"Bulls\", 43]].", + "You can also nest arrays within other arrays, like this: [[\"Bulls\", 23]].", "Let's now go create a nested array called myArray." ], "tests":[ @@ -484,11 +484,11 @@ "Create a variable called myData and set it to equal the first value of myArray." ], "tests":[ - "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'The variable myData should equal the first value of myArray');" + "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'The variable myData should equal the first value of myArray.');" ], "challengeSeed":[ - "//var ourArray = [1,2,3];", - "//var ourData = ourArray[0]; // equals 1", + "// var ourArray = [1,2,3];", + "// var ourData = ourArray[0]; // equals 1", "", "var myArray = [1,2,3];", "// Only change code below this line.", @@ -514,13 +514,13 @@ "Now modify the data stored at index 0 of myArray to the value of 3." ], "tests":[ - "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'myArray should now be [3,2,3]');", - "assert((function(){if(editor.getValue().match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'You should be using correct index to modify the value in myArray');" + "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'myArray should now be [3,2,3].');", + "assert((function(){if(editor.getValue().match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'You should be using correct index to modify the value in myArray.');" ], "challengeSeed":[ "var ourArray = [1,2,3];", "ourArray[1] = 3;", - "// ourArray[1] now equals [1,3,3].", + "// ourArray now equals [1,3,3].", "var myArray = [1,2,3];", "// Only change code below this line.", "", @@ -541,18 +541,18 @@ "Another way to change the data in an array is with the .pop() function.", ".pop()is used to \"pop\" a value off of the end of an array. We can retrieve this value by performing pop() in a variable declaration.", "Any type of variable can be \"popped\" off of an array.", - "Use the .pop() function to remove the last item from myArray." + "Use the .pop() function to remove the last item from myArray." ], "tests": [ - "assert((function(d){if(d[0] == 'John' && d[1] == 23 && 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[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removed), 'myArray should only have the first two values left([\"cat\"], 2)');" + "assert((function(d){if(d[0] == 'John' && d[1] == 23 && 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[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removed), 'removed should only have the first two values left([\"cat\"], 2).');" ], "challengeSeed": [ - "//var numbers = [1,2,3];", - "//console.log(numbers); // logs [1,2,3]", - "//var removed = numbers.pop();", - "//console.log(numbers); // logs [1,2]", - "//console.log(removed); // logs 3", + "// var numbers = [1,2,3];", + "// console.log(numbers); // logs [1,2,3]", + "// var removed = numbers.pop();", + "// console.log(numbers); // logs [1,2]", + "// console.log(removed); // logs 3", "", "var myArray = [\"John\", 23, [\"cat\", 2]];", "// Only change code below this line.", @@ -573,20 +573,20 @@ "difficulty": "9.9818", "description": [ "Not only can you pop() data off of the end of an array, you can also push() data onto the end of an array.", - "Take the myArray array and push() this value to the end of it: [\"dog\", 3]." + "Take the myArray array and push() this value to the end of it: [\"dog\", 3]." ], "tests": [ - "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]])');" + "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]]).');" ], "challengeSeed": [ "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", "ourArray.pop();", "ourArray.push([\"happy\", \"joy\"]);", - "// ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]]", + "// ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]].", "", "var myArray = [\"John\", 23, [\"cat\", 2]];", "myArray.pop();", - "//Add a [\"dog\", 3] to the end of myArray using push()", + "// Add a [\"dog\", 3] to the end of myArray using push().", "// Only change code below this line.", "", "", @@ -604,21 +604,21 @@ "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. Set myRemoved to the first value of myArray using shift()." + "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]])');", - "assert((function(d){if(d === 'John' && typeof(myRemoved) === 'string'){return true;}else{return false;}})(myRemoved), 'myRemoved should contain \"John\"');" + "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]]).');", + "assert((function(d){if(d === 'John' && typeof(myRemoved) === 'string'){return true;}else{return false;}})(myRemoved), 'myRemoved should contain \"John\".');" ], "challengeSeed": [ "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", "ourRemoved = ourArray.shift();", - "// ourArray now equals [\"J\", [\"cat\"]]", + "// ourArray now equals [\"J\", [\"cat\"]].", "", "var myArray = [\"John\", 23, [\"dog\", 3]];", "// Only change code below this line.", "", - "var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]", + "var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]].", "", "// Only change code above this line.", "", @@ -634,8 +634,8 @@ "title": "Manipulate Arrays With unshift()", "difficulty": "9.9818", "description": [ - "Now that we've learned how to shiftthings from the start of the array, we need to learn how to unshiftstuff back to the start", - "Let's take the code we had last time and unshiftthis value to the start: \"Paul\" " + "Now that we've learned how to shiftthings from the start of the array, we need to learn how to unshiftstuff back to the start.", + "Let's take the code we had last time and unshiftthis value to the start: \"Paul\"." ], "tests": [ "assert((function(d){if(typeof(d[0]) === \"string\" && d[0].toLowerCase() == 'paul' && d[1] == 23 && d[2][0] != undefined && d[2][0] == 'dog' && d[2][1] != undefined && d[2][1] == 3){return true;}else{return false;}})(myArray), 'myArray should now have [\"Paul\", 23, [\"dog\", 3]]).');" @@ -643,13 +643,14 @@ "challengeSeed": [ "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", "ourArray.shift();", - "ourArray.unshift([\"happy\", \"joy\"]);", - "// ourArray now equals [[\"happy\", \"joy\"], \"J\", [\"cat\"]]", + "// ourArray now equals [\"J\", [\"cat\"]]", + "ourArray.unshift(\"happy\");", + "// ourArray now equals [\"happy\", \"J\", [\"cat\"]]", "", "var myArray = [\"John\", 23, [\"dog\", 3]];", "myArray.shift();", "", - "// Add \"Paul\" to the start of myArray", + "// Add \"Paul\" to the start of myArray.", "// Only change code below this line.", "", "", @@ -666,26 +667,27 @@ "title": "Write Reusable JavaScript with Functions", "difficulty":"9.9819", "description":[ - "In JavaScript, we can divide up our code into reusable parts called functions.", + "In JavaScript, we can divide up our code into reusable parts called functions.", "Here's an example of a function:", - "function functionName (a, b) {", + "function functionName(a, b) {", "  return a + b;", "}", - "We can \"call\" our function like this: functionName();, and it will run and return its return value to us.", - "Create and call a function called myFunction that returns the sum of a and b." + "After writing the above lines in our code, we can then pass values to our function and the result following the return statement will be returned.", + "For example, we can pass numbers 4 and 2 by “calling” the function later in our code like this: functionName(4, 2).", + "In this example, the function will return the number 6 as this is the result of 4 + 2.", + "Create and call a function called myFunction that returns the sum of a and b." ], "tests":[ - "assert((function(){if(typeof(f) !== \"undefined\" && typeof(f) === \"number\" && f === a + b && editor.getValue().match(/return/gi).length >= 1 && editor.getValue().match(/a/gi).length >= 1 && editor.getValue().match(/b/gi).length >= 1 && editor.getValue().match(/\\+/gi).length >= 1){return true;}else{return false;}})(), 'Your function should return the value of a + b');" + "assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'Your function should return the value of a + b');" ], "challengeSeed":[ "var a = 4;", "var b = 5;", "", - "ourFunction = function() {", + "function ourFunction(a, b) {", " return a - b;", - "};", + "}", "", - "// Don't modify above this line", "// Create a function called myFunction that returns the value of a plus b.", "// Only change code below this line.", "", @@ -719,23 +721,23 @@ "};", "", "Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.", - "Let's try to make an Object that represents a dog called myDog which contains the properties 'name' (String), 'legs' (Number), 'tails' (Number) and 'friends' (Array)!" + "Let's try to make an object that represents a dog called myDog which contains the properties 'name' (String), 'legs' (Number), 'tails' (Number) and 'friends' (Array)!" ], "tests":[ - "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'myDog should contain the property name and it should be a string');", - "assert((function(z){if(z.hasOwnProperty(\"legs\") && z.legs !== undefined && typeof(z.legs) === \"number\"){return true;}else{return false;}})(myDog), 'myDog should contain the property legs and it should be a number');", - "assert((function(z){if(z.hasOwnProperty(\"tails\") && z.tails !== undefined && typeof(z.tails) === \"number\"){return true;}else{return false;}})(myDog), 'myDog should contain the property tails and it should be a number');", - "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), 'myDog should contain the property friends and it should be an array');" + "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'myDog should contain the property name and it should be a string.');", + "assert((function(z){if(z.hasOwnProperty(\"legs\") && z.legs !== undefined && typeof(z.legs) === \"number\"){return true;}else{return false;}})(myDog), 'myDog should contain the property legs and it should be a number.');", + "assert((function(z){if(z.hasOwnProperty(\"tails\") && z.tails !== undefined && typeof(z.tails) === \"number\"){return true;}else{return false;}})(myDog), 'myDog should contain the property tails and it should be a number.');", + "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), 'myDog should contain the property friends and it should be an array.');" ], "challengeSeed":[ - "//var ourDog = {", + "// var ourDog = {", "// \"name\": \"Camper\",", "// \"legs\": 4,", "// \"tails\": 1,", "// \"friends\": [\"everything!\"]", - "//};", + "// };", "", - "// add the name(string), legs(number), tails(number) and friends(array) properties to myDog.", + "// Add the name (string), legs (number), tails (number) and friends (array) properties to myDog.", "// You can set them to whatever you want.", "", "// Only change code below this line.", @@ -761,11 +763,11 @@ "myObject.myProperty = \"myValue\";", "We can also delete them like this:", "delete myObject.myProperty;", - "Let's add the property \"bark\", and delete the property \"tails\"." + "Let's add the property \"bark\", and delete the property \"tails\"." ], "tests":[ - "assert(myDog.bark !== undefined, 'Add the property \"bark\" to myDog.');", - "assert(myDog.tails === undefined, 'Delete the property \"tails\" from myDog.');" + "assert(myDog.bark !== undefined, 'Add the property \"bark\" to myDog.');", + "assert(myDog.tails === undefined, 'Delete the property \"tails\" from myDog.');" ], "challengeSeed":[ "// var ourDog = {", @@ -815,8 +817,8 @@ "Let's try getting a for loop to work by pushing values to an array." ], "tests":[ - "assert(editor.getValue().match(/for/g), 'You should be using a for loop for this.');", - "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + "assert(editor.getValue().match(/for/g), 'You should be using a for loop for this.');", + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4].');" ], "challengeSeed":[ "ourArray = [];", @@ -854,8 +856,8 @@ "Let's try getting a while loop to work by pushing values to an array." ], "tests":[ - "assert(editor.getValue().match(/while/g), 'You should be using a while loop for this.');", - "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + "assert(editor.getValue().match(/while/g), 'You should be using a while loop for this.');", + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4].');" ], "challengeSeed":[ "var myArray = [];", @@ -882,18 +884,18 @@ "Use Math.random() to get myFunction to return a random number." ], "tests":[ - "assert(typeof(myFunction()) === \"number\", 'myFunction should return a random number');", - "assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction should be a decimal');", - "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random to generate the random decimal number');" + "assert(typeof(myFunction()) === \"number\", 'myFunction should return a random number.');", + "assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction should be a decimal.');", + "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random to generate the random decimal number.');" ], "challengeSeed":[ "function myFunction() {", - " //Change the 0 to Math.random()", + " // Change the 0 to Math.random().", " // Only change code below this line.", "", " return 0;", "", - "// Only change code above this line.", + " // Only change code above this line.", "}", "", "// We use this function to show you the value of your variable in your output box.", @@ -908,21 +910,21 @@ "difficulty":"9.9828", "description":[ "It's great that we can create random decimal numbers, but it's even more useful if we use it to generate a random whole number.", - "To achieve this we can multiply the random number by ten and use the Math.floor() to convert the decimal number to a whole number.", + "To achieve this we can multiply the random number by ten and use the Math.floor() to convert the decimal number to the nearest less than or equal whole number.", "This technique gives us a whole number between zero and nine.", "Example:", "Math.floor(Math.random()*10);", "Let's give this technique a go now." ], "tests":[ - "assert(typeof(myFunction()) === \"number\", 'The result of myFunction should be a number');", - "assert(editor.getValue().match(/Math.random/g), 'You should be using Math.random to create a random number');", - "assert(!(''+myFunction()).match(/\\./g), 'You should have multiplied the result of Math.random by 10 to make it a number that\\'s greater than zero');", - "assert(editor.getValue().match(/Math.floor/g), 'You should use Math.floor to remove the decimal part of the number');" + "assert(typeof(myFunction()) === \"number\", 'The result of myFunction should be a number.');", + "assert(editor.getValue().match(/Math.random/g), 'You should be using Math.random to create a random number.');", + "assert(editor.getValue().match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || editor.getValue().match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'You should have multiplied the result of Math.random by 10 to make it a number that\\'s between zero and nine.');", + "assert(editor.getValue().match(/Math.floor/g), 'You should use Math.floor to remove the decimal part of the number.');" ], "challengeSeed":[ "function myFunction(){", - " // Make myFunction return a random number betweenzero and nine> instead of a decimal", + " // Make myFunction return a random number between zero and nine instead of a decimal.", "", " // Only change code below this line.", "", @@ -944,7 +946,7 @@ "description":[ "We can use a certain mathematical expression to get a random number between two numbers.", "Math.floor(Math.random() * (max - min + 1)) + min", - "By using this we can control the output of a random number." + "By using this, we can control the output of a random number." ], "tests":[ "assert(myFunction() >= min, 'The random number that\\'s generated by myFunction should be greater than or equal to the minimum number');", @@ -971,20 +973,19 @@ }, { "id":"cf1111c1c12feddfaeb3bdef", - "title": "Use Conditional Logic with If-Else Statements", + "title": "Use Conditional Logic with If and Else Statements", "difficulty":"9.983", "description":[ - "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 to evaluate.", - "Example:", + "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 to evaluate.", + "For example:", " if (1 === 2) {", "  return true;", - "}", - "else {", + "} else {", "  return false;", "}", "Let's use if and else statements to make a coin-flip game.", - "Create an if-else statement to return heads if the flip var is zero, or else return tails if it's not." + "Create if and else statements to return the string \"heads\" if the flip variable is zero, or else return the string \"tails\" if the flip variable is not zero." ], "tests":[ "assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'myFunction should either return heads or tails.');", @@ -1021,17 +1022,17 @@ "the is the pattern we want to match.", "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." + "Regular expressions are written by surrounding the pattern with / symbols.", + "Let's try selecting all the occurrences of the word and in the string Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it. 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(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.');" ], "challengeSeed":[ "var test = (function() {", - " var testString = \"George Boole and Alan Turing went to the shop and got some milk\";", - " var expressionToGetMilk = /milk/gi;", + " var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";", + " var expressionToGetSoftware = /software/gi;", " // Only change code below this line.", "", " var expression = /./gi;", @@ -1051,12 +1052,13 @@ "description":[ "We can use special selectors in Regular Expressions to select a particular type of value.", "One such selector is the digit selector \\d which is used to grab the numbers in a string.", - "It is used like this: /\\d+/g.", - "Use the \\d selector to select the number of numbers in the string." + "It is used like this: /\\d/g.", + "For numbers this is often written as /\\d+/g, where the + following the digit selector allows this regular expression to match multi-digit numbers.", + "Use the \\d selector to select the number of numbers in the string, allowing for the possibility of multi-digit numbers." ], "tests":[ - "assert(test === 2, 'Your RegEx should have found two numbers in the testString');", - "assert(editor.getValue().match(/\\/\\\\d\\+\\//gi), 'You should be using the following expression /\\\\d+/gi to find the numbers in the testString');" + "assert(test === 2, 'Your RegEx should have found two numbers in the testString.');", + "assert(editor.getValue().match(/\\/\\\\d\\+\\//gi), 'You should be using the following expression /\\\\d+/gi to find the numbers in the testString.');" ], "challengeSeed":[ "var test = (function() {", @@ -1086,7 +1088,7 @@ ], "tests":[ "assert(test === 7, 'Your RegEx should have found seven spaces in the testString.');", - "assert(editor.getValue().match(/\\/\\\\s\\+\\//gi), 'You should be using the following expression /\\\\s+/gi to find the spaces in the testString.');" + "assert(editor.getValue().match(/\\/\\\\s\\+\\//gi), 'You should be using the following expression /\\\\s+/gi to find the spaces in the testString.');" ], "challengeSeed":[ "var test = (function(){", @@ -1140,7 +1142,7 @@ "We are now going to try and combine some of the stuff we've just learned and create the logic for a slot machine game.", "For this we will need to generate three random numbers between 1 and 3 to represent the possible values of each individual slot.", "Store the three random numbers in slotOne, slotTwo and slotThree.", - "Generate the random numbers by using the system we used earlier:", + "Generate the random numbers by using the system we used earlier (an explanation of the formula can be found here):", "Math.floor(Math.random() * (3 - 1 + 1)) + 1;" ], "tests":[ @@ -1301,7 +1303,7 @@ "}" ], "tests":[ - "assert((function(){var data = runSlots();if(data === null){return true}else{if(data[0] === data[1] && data[1] === data[2]){return true;}else{return false;}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.')" + "assert((function(){var data = runSlots();if(data === null){return true}else{if(data[0] === data[1] && data[1] === data[2]){return true;}else{return false;}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.')" ], "challengeSeed":[ "fccss", @@ -1459,8 +1461,8 @@ "Use the above selector to display each number in its corresponding slot." ], "tests":[ - "assert((function(){runSlots();if($($(\".slot\")[0]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[1]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[2]).html().replace(/\\s/gi, \"\") !== \"\"){return true;}else{return false;}})(), 'You should be displaying the result of the slot numbers in the corresponding slots')", - "assert((function(){if(editor.match( /\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)/gi )){if(editor.match( /\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\)/gi ) && editor.match( /\\.html\\(slotTwo\\)/gi ) && editor.match( /\\.html\\(slotThree\\)/gi )){return true;}else{return false;}}else{return false;}})(), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne, slotTwo and slotThree respectively')" + "assert((function(){runSlots();if($($(\".slot\")[0]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[1]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[2]).html().replace(/\\s/gi, \"\") !== \"\"){return true;}else{return false;}})(), 'You should be displaying the result of the slot numbers in the corresponding slots.')", + "assert((editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi) && editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\)/gi ) && editor.match( /\\.html\\(slotTwo\\)/gi ) && editor.match( /\\.html\\(slotThree\\)/gi )), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne, slotTwo and slotThree respectively.')" ], "challengeSeed":[ "fccss", @@ -1624,13 +1626,13 @@ "Set up all three slots like this, then click the \"Go\" button to play the slot machine." ], "tests":[ - "assert((editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi) && editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi).length >= 3) || (editor.match(/\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi) && editor.match(/\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi).length >= 3), 'Use the provided code three times. One for each slot')", - "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[0\\]\\)/gi), 'You should have used $('.slot')[0] at least once')", - "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[1\\]\\)/gi), 'You should have used $('.slot')[1] at least once')", - "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[2\\]\\)/gi), 'You should have used $('.slot')[2] at least once')", - "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne value at least once')", - "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the slotTwo value at least once')", - "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once')" + "assert((editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\\\'\\s*?\\);/gi) && editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\\\'\\s*?\\);/gi).length >= 3), 'Use the provided code three times. One for each slot.')", + "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[0\\]\\s*?\\)/gi), 'You should have used $('.slot')[0] at least once.')", + "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[1\\]\\s*?\\)/gi), 'You should have used $('.slot')[1] at least once.')", + "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[2\\]\\s*?\\)/gi), 'You should have used $('.slot')[2] at least once.')", + "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne value at least once.')", + "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the slotTwo value at least once.')", + "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once.')" ], "challengeSeed":[ "fccss", diff --git a/seed/challenges/basic-ziplines.json b/seed/challenges/basic-ziplines.json index 289a34ba50..113d9e7de5 100644 --- a/seed/challenges/basic-ziplines.json +++ b/seed/challenges/basic-ziplines.json @@ -16,7 +16,8 @@ "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 under the \"Add External CSS\" section, use the \"Quick-add\" select box to select Bootstrap. Then click \"Save & Close\".", "Verify that bootstrap is active by adding the following code to your HTML: <h1 class='text-primary'>Hello CodePen!</h1>. The text's color should be Bootstrap blue.", - "Click the gear next to JavaScript. Click the \"Quick-add\" select box and choose jQuery (not jQuery UI). Then click \"Save & Close\".", + "Click the gear next to JavaScript. Click the \"Quick-add\" select box and choose jQuery (not jQuery UI).", + "Click the \"Quick-add\" select box again and choose Bootstrap. Then click \"Save & Close\".", "Now add the following code to your JavaScript: $(document).ready(function() { $('.text-primary').text('Hi CodePen!') });. 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." @@ -28,8 +29,22 @@ "descriptionCn": [], "nameFr": "", "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], + "nameRu": "Приготовьтесь к Zipline'ам", + "descriptionRu": [ + "Теперь вы готовы приступить к Zipline'ам. Это задания по фронт-энд разработке, в них вы примените ранее изученные HTML, CSS, jQuery и JavaScript и создадите статические (не использующие базу данных) приложения.", + "Ни в коем случае не унывайте! Воспользуйтесь Read-Search-Ask, если что-то не получается.", + "Задания мы будем выполнять используя CodePen - популярный инструмент для создания и обмена статическими веб приложениями.", + "Перейдите по ссылке http://codepen.io и создайте аккаунт.", + "Нажмите на ваш аватар в правом верхнем углу, а затем в открывшемся меню на кнопку \"New pen\".", + "Выберите удобное расположение окон с помощью кнопок в правом нижнем углу, отрегулируйте их ширину.", + "Нажмите на звездочку рядом с CSS. Затем в секции \"Add External CSS\" выберите \"Quick-add\" и добавьте Bootstrap. Нажмите \"Save & Close\".", + "Проверьте, что Bootstrap подключен добавив следующий HTML код: <h1 class='text-primary'>Hello CodePen!</h1>. Цвет текста должен быть синим.", + "Нажмите на звездочку рядом с JavaScript. Нажмите \"Quick-add\" и выберите jQuery (не jQuery UI). Нажмите \"Save & Close\".", + "Снова нажмите на поле \"Quick-add\", выберите Bootstrap и затем нажмите \"Save & Close\".", + "Теперь добавьте следующий код в окошко JavaScript: $(document).ready(function() { $('.text-primary').text('Hi CodePen!') });. Нажмите на кнопку \"Save\" расположенную наверху. Текст \"Hello CodePen!\" должен измениться на \"Hi CodePen!\". Это значит что jQuery работает.", + "CodePen, который мы создали, можно использовать в качестве отправной точки для ваших Zipline'ов. Кликните кнопку \"fork\", чтобы создать копию текущего CodePen'a.", + "Все готово для первого Zipline'а. Жмите кнопку \"I've completed this challenge\"." + ], "nameEs": "", "descriptionEs": [], "namePt": "", @@ -56,7 +71,7 @@ "Note that CodePen.io overrides the Window.open() function, so if you want to open windows using jquery, you will need to target invisible anchor elements like this one: <a target='_blank'>.", "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.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], "type": "zipline", "challengeType": 3, @@ -65,8 +80,25 @@ "descriptionCn": [], "nameFr": "", "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], + "nameRu": "Создайте сайт-портфолио", + "descriptionRu": [ + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", + "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", + "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", + "Подсказка: Если вы не хотите создавать портфолио с нуля, можете взять за основу этот простой Bootstrap шаблон: http://codepen.io/FreeCodeCamp/pen/mJNqQj.", + "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:", + "Пользовательская история: В качестве пользователя, я могу получить доступ ко всей информации на странице просто прокрутив ее сверху вниз.", + "Пользовательская история: В качестве пользователя, я могу нажать на различные кнопки и перейти к социальным страницам владельца портфолио.", + "Пользовательская история: В качестве пользователя, я могу увидеть эскизы проектов, которые были созданы владельцем портфолио (используйте временную картинку если у вас пока нету собственных веб-страниц).", + "Бонусная пользовательская история: В качестве пользователя, я могу перемещаться к различным частям страницы нажимая на соответствующие навигационные кнопки.", + "Не переживайте если вам пока нечего показать в портфолио - вы создадите несколько веб приложений в следующих заданиях, а затем вернетесь и обновите портфолио.", + "В сети существует много шаблонов для портфолио, но в этом задании вам необходимо создать собственную уникальную страницу. Использование Bootstrap сделает этот процесс намного проще.", + "Обратите внимание, что CodePen.io переопределяет функцию Window.open(), поэтому, если вы хотите открывать окна используя jQuery, необходимо будет адресовать невидимые якорные элементы, такие как этот: <a target='_blank'&rt;.", + "Если что-то не получается, воспользуйтесь Read-Search-Ask.", + "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.", + "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.

Click here then add your link to your tweet's text" + ], "nameEs": "", "descriptionEs": [], "namePt": "", @@ -88,7 +120,7 @@ "Note that you can either put your quotes into an array and show them at random, or use an API to get quotes, such as http://forismatic.com/en/api/.", "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.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], "type": "zipline", "challengeType": 3, @@ -97,8 +129,20 @@ "descriptionCn": [], "nameFr": "", "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], + "nameRu": "Создайте генератор случайных цитат", + "descriptionRu": [ + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/AdventureBear/full/vEoVMw.", + "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", + "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", + "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", + "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:", + "Пользовательская история: В качестве пользователя, я могу нажать на кнопку и получить случайную цитату.", + "Бонусная пользовательская история: В качестве пользователя, я могу нажать на кнопку и опубликовать цитату в Twitter'e.", + "Цитаты можно добавить в массив и случайным образом выводить одну из них, либо можно воспользоваться соответствующим API, например http://forismatic.com/en/api/.", + "Если что-то не получается, воспользуйтесь Read-Search-Ask.", + "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.", + "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.

Click here then add your link to your tweet's text" + ], "nameEs": "", "descriptionEs": [], "namePt": "", @@ -116,12 +160,12 @@ "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.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], "type": "zipline", "challengeType": 3, @@ -130,8 +174,21 @@ "descriptionCn": [], "nameFr": "", "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], + "nameRu": "Покажите местную погоду", + "descriptionRu": [ + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/AdventureBear/full/yNBJRj.", + "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", + "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", + "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", + "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:", + "Пользовательская история: В качестве пользователя, я могу узнать погоду с учетом моего текущего местоположения.", + "Бонусная пользовательская история: В качестве пользователя, я могу в зависимости от погоды видеть различные температурные значки.", + "Бонусная пользовательская история: В качестве пользователя, я могу в зависимости от погоды видеть различные фоновые изображения (снежные горы, знойная пустыня).", + "Бонусная пользовательская история: В качестве пользователя, я могу нажать на кнопку чтобы переключится между градусами по Цельсию или по Фаренгейту.", + "Если что-то не получается, воспользуйтесь Read-Search-Ask.", + "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.", + "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.

Click here then add your link to your tweet's text" + ], "nameEs": "", "descriptionEs": [], "namePt": "", @@ -153,7 +210,7 @@ "Bonus User Story: As a user, I can customize the length of each pomodoro.", "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.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], "type": "zipline", "challengeType": 3, @@ -162,8 +219,20 @@ "descriptionCn": [], "nameFr": "", "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], + "nameRu": "Создайте таймер Pomodoro", + "descriptionRu": [ + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/GeoffStorbeck/full/RPbGxZ/.", + "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", + "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", + "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", + "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:", + "Пользовательская история: В качестве пользователя, я могу запустить 25 минутную 'помидорку', по истечении которой таймер выключится.", + "Бонусная пользовательская история: В качестве пользователя, я могу сбросить таймер для установки следующей 'помидорки'.", + "Бонусная пользовательская история: В качестве пользователя, я могу выбирать длительность 'помидорки'.", + "Если что-то не получается, воспользуйтесь Read-Search-Ask.", + "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.", + "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.

Click here then add your link to your tweet's text" + ], "nameEs": "", "descriptionEs": [], "namePt": "", @@ -190,7 +259,7 @@ "Hint: Here's an array of the Twitch.tv usernames of people who regularly stream coding: [\"freecodecamp\", \"storbeck\", \"terakilobyte\", \"habathcx\",\"RobotCaleb\",\"thomasballinger\",\"noobs2ninjas\",\"beohoff\"]", "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.", - "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.

Click here then add your link to your tweet's text" + "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.

Click here then add your link to your tweet's text" ], "type": "zipline", "challengeType": 3, @@ -199,8 +268,25 @@ "descriptionCn": [], "nameFr": "", "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], + "nameRu": "Используйте Twitch.tv JSON API", + "descriptionRu": [ + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/GeoffStorbeck/full/GJKRxZ.", + "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", + "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", + "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", + "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:", + "Пользовательская история: В качестве пользователя, я могу увидеть идет ли в данный момент на Twitch.tv трансляция Free Code Camp.", + "Пользовательская история: В качестве пользователя, я могу, кликнув на описание трансляции, перейти на канал Free Code Camp.", + "Пользовательская история: В качестве пользователя, я могу видеть дополнительную информацию о текущей трансляции Free Code Camp.", + "Бонусная пользовательская история: В качестве пользователя, я могу произвести поиск среди перечисленных каналов.", + "Бонусная пользовательская история: В качестве пользователя, я могу видеть уведомление, если создатель канала закрыл свой аккаунт на Twitch.tv. Добавьте в массив имена пользователей brunofin и comster404, чтобы убедиться, что эта функция реализована правильно.", + "Подсказка: Пример запроса к Twitch.tv JSON API: https://api.twitch.tv/kraken/streams/freecodecamp.", + "Подсказка: Документацию об этом запросе можно найти по ссылке: https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streamschannel.", + "Подсказка: В этом массиве приведены имена пользователей, которые регулярно пишут код онлайн: [\"freecodecamp\", \"storbeck\", \"terakilobyte\", \"habathcx\",\"RobotCaleb\",\"comster404\",\"brunofin\",\"thomasballinger\",\"noobs2ninjas\",\"beohoff\"]", + "Если что-то не получается, воспользуйтесь Read-Search-Ask.", + "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.", + "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.

Click here then add your link to your tweet's text" + ], "nameEs": "", "descriptionEs": [], "namePt": "", diff --git a/seed/challenges/bootstrap.json b/seed/challenges/bootstrap.json index 196ecb08c4..fb4f864474 100644 --- a/seed/challenges/bootstrap.json +++ b/seed/challenges/bootstrap.json @@ -347,7 +347,7 @@ "description": [ "Normally, your button elements are only as wide as the text that they contain. By making them block elements, your button will stretch to fill your page's entire horizontal space.", "This image illustrates the difference between inline elements and block-level elements:", - "\"An", + "\"An", "Note that these buttons still need the btn class.", "Add Bootstrap's btn-block class to your Bootstrap button." ], @@ -700,7 +700,7 @@ "description": [ "Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div element.", "Here's a diagram of how Bootstrap's 12-column grid layout works:", - "\"an", + "\"an", "Note that in this illustration, the col-md-* class is being used. Here, md means medium, and * is a number specifying how many columns wide the element should be. In this case, the column width of an element on a medium-sized screen, such as a laptop, is being specified.", "In the Cat Photo App that we're building, we'll use col-xs-*, where xs means extra small (like an extra-small mobile phone screen), and * is the number of columns specifying how many columns wide the element should be.", "Put the Like, Info and Delete buttons side-by-side by nesting all three of them within one <div class=\"row\"> element, then each of them within a <div class=\"col-xs-4\"> element.", @@ -895,7 +895,7 @@ "description": [ "You can use spans to create inline elements. Remember when we used the btn-block class to make the button fill the entire row?", "This image illustrates the difference between inline elements and block-level elements:", - "\"An", + "\"An", "By using the span 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 span element. Then give that span the class text-danger to make the text red.", "Here's how you would do this with the \"Top 3 things cats hate\" element: <p>Top 3 things cats <span class = \"text-danger\">hate</span></p>" @@ -984,7 +984,7 @@ "We will make a simple heading for our Cat Photo App by putting them in the same row.", "Remember, Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div element.", "Here's a diagram of how Bootstrap's 12-column grid layout works:", - "\"an", + "\"an", "Note that in this illustration, the col-md-* class is being used. Here, md means medium, and * is a number specifying how many columns wide the element should be. In this case, the column width of an element on a medium-sized screen, such as a laptop, is being specified.", "In the Cat Photo App that we're building, we'll use col-xs-*, where xs means extra small (like an extra-small mobile phone screen), and * is the number of columns specifying how many columns wide the element should be.", "Nest your first image and your h2 element within a single <div class=\"row\"> element. Nest your h2 text within a <div class=\"col-xs-8\"> and your image in a <div class=\"col-xs-4\"> so that they are on the same line.", @@ -1159,9 +1159,9 @@ "Use Font Awesome to add a info-circle icon to your info button and a trash icon to your delete button." ], "tests": [ - "assert($(\"i\").hasClass(\"fa fa-trash\"), 'You should add a <i class=\"fa fa-trash\"></i> within your delete button element.')", - "assert($(\"i\").hasClass(\"fa fa-info-circle\"), 'You should add a <i class=\"fa fa-info-circle\"></i> within your info button element.')", - "assert(editor.match(/<\\/i>/g) && editor.match(/<\\/i/g).length > 2, 'Make sure each of your i elements has a closing tag.')" + "assert($(\".btn-danger > i\").hasClass(\"fa fa-trash\"), 'You should add a <i class=\"fa fa-trash\"></i> within your delete button element.')", + "assert($(\".btn-info > i\").hasClass(\"fa fa-info-circle\"), 'You should add a <i class=\"fa fa-info-circle\"></i> within your info button element.')", + "assert(editor.match(/<\\/i>/g) && editor.match(/<\\/i>/g).length > 2 && $(\".btn-primary > i\").hasClass(\"fa fa-thumbs-up\"), 'Make sure each of your i elements has a closing tag and <i class=\"fa fa-thumbs-up\"></i> is in your like button element.')" ], "challengeSeed": [ "", @@ -1722,7 +1722,7 @@ "Create two div elements within your row, both with the class col-xs-6." ], "tests": [ - "assert($(\"div.row\").children(\"div.col-xs-6\").length > 1, 'Nest two div class=\"col-xs-6\" elements within your div class=\"row\" element.')", + "assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest two div class=\"col-xs-6\" elements within your div class=\"row\" element.')", "assert(editor.match(/<\\/div>/g) && editor.match(/
/g).length === editor.match(/
div elements have closing tags.')" ], "challengeSeed": [ @@ -1756,8 +1756,8 @@ "Nest one div element with the class well within each of your col-xs-6 div elements." ], "tests": [ - "assert($(\"div\").length > 4, 'Add a div element with the class well inside each of your div class=\"col-xs-6\" elements')", - "assert($(\"div.col-xs-6 div.well\").length > 1, 'Nest both of your div class=\"col-xs-6\" elements within your div class=\"row\" element.')", + "assert($(\"div.col-xs-6\").not(\":has(>div.well)\").length < 1, 'Add a div element with the class well inside each of your div elements with the class \"col-xs-6\"')", + "assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest both of your div elements with the class \"col-xs-6\" within your div element with the class \"row\".')", "assert(editor.match(/<\\/div>/g) && editor.match(/
/g).length === editor.match(/
div elements have closing tags.')" ], "challengeSeed": [ @@ -1983,7 +1983,7 @@ "Above your right-well, inside its col-xs-6 div element, add a h4 element with the text #right-well." ], "tests": [ - "assert($(\".col-xs-6\").children(\"h4\") && $(\".col-xs-6\").children(\"h4\").length > 1, 'Add an h4 element to each of your <div class=\\\"col-xs-6\\\"> elements.');", + "assert($(\".col-xs-6\").children(\"h4\") && $(\".col-xs-6\").children(\"h4\").length > 1, 'Add an h4 element to each of your <div class=\"col-xs-6\"> elements.');", "assert(new RegExp(\"#left-well\",\"gi\").test($(\"h4\").text()), 'One h4 element should have the text #left-well.');", "assert(new RegExp(\"#right-well\",\"gi\").test($(\"h4\").text()), 'One h4 element should have the text #right-well.');", "assert(editor.match(/<\\/h4>/g) && editor.match(/

/g).length === editor.match(/

h4 elements have closing tags.')" diff --git a/seed/challenges/getting-started.json b/seed/challenges/getting-started.json new file mode 100644 index 0000000000..5ac330c4e3 --- /dev/null +++ b/seed/challenges/getting-started.json @@ -0,0 +1,321 @@ +{ + "name": "Get Started with Free Code Camp", + "order": 0.000, + "challenges": [ + { + "id": "560add10cb82ac38a17513be", + "title": "Learn how Free Code Camp Works", + "difficulty": 0.00, + "challengeSeed": [], + "description": [ + [ + "http://i.imgur.com/RlEk2IF.jpg", + "a picture of Free Code Camp's 4 benefits: Get connected, Learn JavaScript, Build your Portfolio, Help nonprofits", + "Welcome to Free Code Camp. We're an open source community of busy people who learn to code and help nonprofits.", + "" + ], + [ + "http://i.imgur.com/pYsTbjI.jpg", + "a screenshot of our curriculum alongside a screenshot of our chat room.", + "Learning to code is hard. To succeed, you'll need lots of practice and support. That's why we've created a rigorous curriculum and supportive community.", + "" + ], + [ + "http://i.imgur.com/D7Y5luw.jpg", + "A graph of the rate of job growth against growth in computer science degree graduates. There are 1.4 million jobs and only 400 million people to fill them.", + "There are thousands of coding jobs currently going unfilled, and the demand for coders grows every year. If you want a coding job, we can help prepare you to get one.", + "" + ], + [ + "http://i.imgur.com/dLx8nrg.jpg", + "An illustration showing that you will learn HTML5, CSS3, JavaScript, Databases, Git, Node.js, Angular.js and Agile.", + "First you'll work through our rigorous 800-hour curriculum learn technologies like HTML5, Node.js and databases. It's self-paced and 100% free.", + "" + ], + [ + "http://i.imgur.com/q4IjuCL.jpg", + "a screenshot of our Front End Development Certificate", + "About half way through our curriculum, you'll earn a verified Front End Development Certificate. If you can finish our entire curriculum, you'll earn a verified Full Stack Development Certificate.", + "" + ], + [ + "http://i.imgur.com/yXyxbDd.jpg", + "a screen shot of our nonprofit project directory.", + "Then you'll build several real-life projects for nonprofits. By the time you finish, you'll have a portfolio of real apps that people use every day.", + "" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "560add37cb82ac38a17513bf", + "title": "Create a GitHub Account and Join our Chat Rooms", + "difficulty": 0.01, + "challengeSeed": [], + "description": [ + [ + "http://i.imgur.com/EAR7Lvh.jpg", + "a screenshot of our one of our Gitter chat rooms.", + "Now let's join Free Code Camp's chat rooms. You can come here any time of day to hang out, ask questions, or find another camper to pair program with. First you'll need a GitHub account.", + "" + ], + [ + "http://i.imgur.com/FEImaEN.gif", + "A gif showing you to click the link below to go to GitHub. Fill in the necessary fields and click submit.", + "Create an account with GitHub. Be sure to use your real email address - GitHub will keep this private.", + "https://github.com/join" + ], + [ + "http://i.imgur.com/ALN6zPK.gif", + "A gif showing you how to click the profile image in the upper right hand corner of GitHub. Upload a photo of yourself or you will continue to use the automatically generated pixel art. Then fill in the remaining form fields and click submit.", + "Click the pixel art in the upper right hand corner of GitHub, then choose settings. Upload a picture of yourself. A picture of your face works best. This is how your fellow campers will see you in our chat rooms, so put your best foot forward. You can add your city and your name if you want.", + "https://github.com/settings/profile" + ], + [ + "http://i.imgur.com/OXL3G3n.gif", + "Click the link below to navigate to Free Code Camp's open-source repository. In the upper right hand corner, you can click the \"star\" button to star this repository.", + "Go to Free Code Camp's open-source repository and \"star\" it. \"Starring\" is the GitHub equivalent of \"liking\" something.", + "https://github.com/freecodecamp/freecodecamp" + ], + [ + "http://i.imgur.com/EZHzKCV.gif", + "A gif showing you how to click the link below to go to our chat room and click the \"sign in with GitHub\" button. Then you can click into the text input field and type a message to your fellow campers.", + " Now that you have a GitHub account, you can join our main chat room by logging in with GitHub. Introduce yourself by saying \"Hello world!\". Tell your fellow campers how you found Free Code Camp. Also tell us why you want to learn to code.", + "https://gitter.im/FreeCodeCamp/FreeCodeCamp" + ], + [ + "http://i.imgur.com/Ecs5XAd.gif", + "A gif showing you how you can click the settings button in the upper right hand corner and modify your notification settings.", + "Our chat rooms are extremely active. You should change your settings so you're only notified if someone mentions you.", + "" + ], + [ + "http://i.imgur.com/T0bGJPe.gif", + "A gif showing how you can click on a user profile image to initiate a private message with that user.", + "Please note that all of our chat rooms are visible to the public. If you need to share sensitive information, such as an email address or phone number, do it in a private message.", + "" + ], + [ + "http://i.imgur.com/vDTMJSh.gif", + "A gif showing that you can tab back and forth between challenges and our chat rooms.", + "Keep our chat room open while you work through our challenges. That way, you can ask for help if you get stuck. You can also socialize with other campers when you feel like taking a break.", + "" + ], + [ + "http://i.imgur.com/SLQ27Gr.gif", + "A gif showing how you can click the link below to download a native chat room app for your computer.", + "You can also download the chat room app to your computer or phone.", + "https://gitter.im/apps" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "560add56cb82ac38a17513c0", + "title": "Configure your Public Profile", + "difficulty": 0.02, + "challengeSeed": [], + "description": [ + [ + "http://i.imgur.com/FkEzbto.gif", + "A gif showing how you can click your profile image in your upper right hand corner to access the account page and connect GitHub.", + "Check out your portfolio page. Click your picture your upper right hand corner. To activate your portfolio page, you'll need to link your GitHub account with Free Code Camp.", + "" + ], + [ + "http://i.imgur.com/WKzEr1q.gif", + "A gif showing how you can access your profile page and hover over different days to see how many brownie points you got on those days.", + "Your portfolio page shows your progress and how many Brownie Points you have. You can get Brownie Points by completing challenges and by helping other campers in our chat rooms. If you get Brownie Points on several days in a row, you'll get a streak.", + "" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "560add65cb82ac38a17513c1", + "title": "Try our Wiki and Camper News", + "difficulty": 0.03, + "challengeSeed": [], + "description": [ + [ + "http://i.imgur.com/DoOqkNW.gif", + "A gif showing how you can click the \"Wiki\" button in your upper-right corner to access the wiki.", + "Try this: Click the \"Wiki\" button in your upper right hand corner. Our community has contributed lots of useful information to this searchable wiki.", + "" + ], + [ + "http://i.imgur.com/nmSiMy1.gif", + "A gif showing how you can access our Camper News page and click the \"upvote\" button to upvote a story.", + "Click the \"News\" button in your upper right hand corner. You can browse links on Camper News and upvote ones that you enjoy.", + "" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "560add71cb82ac38a17513c2", + "title": "Join a Campsite in Your City", + "difficulty": 0.04, + "challengeSeed": [], + "description": [ + [ + "http://i.imgur.com/Elb3dfj.jpg", + "A picture of some of our campers meeting in a local cafe. 3 men and 3 women are sitting around a table with laptops out, and are smiling and coding.", + "Our Campsites help you code with campers in your city. You can coordinate study groups or attend local coding events together.", + "" + ], + [ + "http://i.imgur.com/EZHzKCV.gif", + "A gif showing how you can click the link below, find your city on the list of Campsites, then click on the Facebook link for your city and join your city's Facebook group.", + "Find your city on this list, click the \"Facebook\" link, then click the \"Join group\" button to apply to join your city's Facebook group (someone from the campsite should approve you shortly). If your city isn't on this list, scroll to the bottom of the wiki article for instructions for how you can create your city's Campsite.", + "https://github.com/FreeCodeCamp/freecodecamp/wiki/List-of-Free-Code-Camp-city-based-Campsites" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "560add8ccb82ac38a17513c3", + "title": "Join our Alumni Network and Commit to Your Goal", + "difficulty": 0.05, + "challengeSeed": [], + "description": [ + [ + "http://i.imgur.com/P7qfJXt.gif", + "A gif showing how you can click the link below and fill in the necessary fields to add your Free Code Camp studies to your LinkedIn profile.", + "You can add Free Code Camp to your LinkedIn education background. Set your graduation date as next year. For \"Degree\", type \"Full Stack Web Development\". For \"Field of study\", type \"Computer Software Engineering\". Then click \"Save Changes\".", + "https://www.linkedin.com/profile/edit-education?school=Free+Code+Camp" + ], + [ + "", + "", + "Free Code Camp will always be free. If you want to feel more motivated to earn our certificates faster, we encourage you to instead donate each month to a nonprofit.", + "" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "560add8ccb82ac38a17513c4", + "title": "Learn What to Do If You Get Stuck", + "difficulty": 0.06, + "challengeSeed": [], + "description": [ + [ + "http://i.imgur.com/EWWZBag.jpg", + "An image with the text \"1. Read the error 2. Search Google 3. Ask for help.", + "Let's cover one last thing before you start working through our challenges: how to get help. Any time you get stuck or don't know what to do next: Read-Search-Ask.", + "" + ], + [ + "http://i.imgur.com/99BfAcK.jpg", + "An image showing jQuery documentation", + "First, read the documentation or error message. A key skill that good coders have is the ability to interpret and then follow instructions.", + "" + ], + [ + "http://i.imgur.com/GxvrsFb.gif", + "A gif showing you how to do an advanced Google search. First, we enter the query \"jquery doesn't run when my page loads\". Then we click search tools button and change the \"Any time\" select box to \"within the last year\". Then we click on a result and read through the article and find our answer.", + "If that didn't help, search Google. Good Google queries take a lot of practice. When you search Google, you usually want to include the language or framework you're using. You also want to limit the results to a recent period.", + "" + ], + [ + "http://i.imgur.com/LZYU7p2.gif", + "A gif showing us following the link below to go to the help chat room and ask \"jquery doesn't run when my page loads\".", + "If that didn't help, ask your friends. If you have trouble, you can ask your fellow campers in our help chat room.", + "https://gitter.im/FreeCodeCamp/Help" + ], + [ + "http://i.imgur.com/WsfzvVo.gif", + "A gif showing us clicking the \"map\" button in our upper right hand corner and browsing our challenge map.", + "Now you're ready to start coding! The \"Map\" button in your upper right hand corner will show you our challenge map. This map shows all our coding challenges. We recommend that you complete these from top to bottom, at a sustainable pace. You can also return to your next challenge by clicking the \"Learn\" button.", + "" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + } + ] +} diff --git a/seed/challenges/git.json b/seed/challenges/git.json index aa03fb0a18..4cb9c7c930 100644 --- a/seed/challenges/git.json +++ b/seed/challenges/git.json @@ -11,11 +11,11 @@ "We'll build this Waypoint on Cloud 9, a powerful online code editor with a full Ubuntu Linux workspace, all running in the cloud.", "If you don't already have Cloud 9 account, create one now at http://c9.io.", "Open up http://c9.io and sign in to your account.", - "Click on Create New Workspace at the top right of the c9.io page, then click on the \"Create a new workspace\" popup that appears below it the button after you click on it.", - "Give your workspace a name.", + "Click on the \"+\" icon at the top right of the c9.io page to create a new workspace.", + "Give your workspace a name and an optional description.", "Choose Node.js in the selection area below the name field.", - "Click the Create button. Then click into your new workspace.", - "In the lower right hand corner you should see a terminal window. In this window use the following commands. You don't need to know what these mean at this point.", + "Click the \"Create workspace\" button.", + "Once C9 builds and loads your workspace, you should see a terminal window in the lower right hand corner. In this window use the following commands. You don't need to know what these mean at this point.", "Install git-it with this command: npm install -g git-it", "Now start the tutorial by running git-it.", "Note that you can resize the c9.io's windows by dragging their borders.", diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index f67197acf5..d865ce2d56 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(/