diff --git a/.gitignore b/.gitignore index 86cbd7b0c8..0f96fb3ee1 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,20 @@ coverage .remote-sync.json server/*.bundle.js -public/js/*.bundle.js +public/js/bundle* + *.map + +// revision manifest +server/rev-manifest.json +server/manifests/* +!server/manifests/README.md + +public/js/main* +public/js/commonFramework* +public/js/sandbox* +public/js/iFrameScripts* +public/js/plugin* +public/css/main* + +server/rev-manifest.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..6830f00dc5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +We're getting a lot of duplicate issues and bug reports that just aren't reporting actual bugs. +So, before you submit your issue, please read the [Help I've Found a Bug](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Help-I've-Found-a-Bug) wiki page. + +We welcome pull requests from Free Code Camp campers (our students) and seasoned JavaScript developers alike! Follow these steps to contribute: + +1. Check our [public Waffle Board](https://waffle.io/freecodecamp/freecodecamp). +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` 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 d62477d7bd..9b0c87d631 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - +![](https://s3.amazonaws.com/freecodecamp/wide-social-banner.png) [![Throughput Graph](https://graphs.waffle.io/freecodecamp/freecodecamp/throughput.svg)](https://waffle.io/freecodecamp/freecodecamp/metrics) @@ -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,10 +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 `user-xxx` where user is your username and xxx is the issue number you are addressing. -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 [AirBnB's JavaScript Style Guide](https://github.com/airbnb/javascript). Please do not ignore any linting errors, as they are meant to **help** you. 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. -8. Once we accept one of your pull requests, one of the project owners (currently @quincylarson, @terakilobyte, and @berkeleytrue) will add you to our camper contributor group. +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 ------------- @@ -66,12 +65,13 @@ bower install # Create a .env file and populate it with the necessary API keys and secrets: touch .env +# Install Gulp globally +npm install -g gulp ``` -Edit your .env file with the following API keys accordingly (if you only use email login, only the MONGOHQ_URL, SESSION_SECRET, MANDRILL_USER and MANDRILL_PASSWORD fields are necessary. Keep in mind if you want to use more services you'll have to get your own API keys for those services. +Edit your `.env` file with the following API keys accordingly (if you only use email login, only the `MONGOHQ_URL`, `SESSION_SECRET`, `MANDRILL_USER` and `MANDRILL_PASSWORD` fields are necessary. Keep in mind if you want to use more services you'll have to get your own API keys for those services. ``` - MONGOHQ_URL='mongodb://localhost:27017/freecodecamp' FACEBOOK_ID=stuff @@ -104,20 +104,22 @@ COOKIE_SECRET='this is a secret' PEER=stuff DEBUG=true - ``` ```bash - # Start the mongo server mongod +# Create your mongo database. +# Type "mongo" in your terminal to access the mongo shell +use freecodecamp +# Exit the mongo shell with control + d + # Seed your database with the challenges node seed/ # start the application gulp - ``` License 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/README.md b/client/README.md index 5ba2586944..b722fceb9c 100644 --- a/client/README.md +++ b/client/README.md @@ -1,4 +1,4 @@ -This is the entry point for the client +This is the entry point for the client code Code that should only run on the client should be put here. NOTE(berks): For react specific stuff this should be the entry point diff --git a/client/commonFramework.js b/client/commonFramework.js new file mode 100644 index 0000000000..6e5bb4f2cf --- /dev/null +++ b/client/commonFramework.js @@ -0,0 +1,808 @@ +/* globals jailed, CodeMirror, challenge_Id, challenge_Name, challengeType */ +// codeStorage +var codeStorageFactory = (function($, localStorage) { + + var CodeStorageProps = { + version: 0.01, + keyVersion: 'saveVersion', + keyValue: null, + updateWait: 2000, + updateTimeoutId: null + }; + + var CodeStorage = { + hasSaved: function() { + return this.updateTimeoutId === null; + }, + + onSave: function(func) { + this.eventArray.push(func); + }, + + setSaveKey: function(key) { + this.keyValue = key + 'Val'; + }, + + getStoredValue: function() { + return '' + localStorage.getItem(this.keyValue); + }, + + setEditor: function(editor) { + this.editor = editor; + }, + + isAlive: function() { + var val = this.getStoredValue(); + return val !== 'null' && + val !== 'undefined' && + (val && val.length > 0); + }, + + updateStorage: function() { + if (typeof localStorage !== 'undefined') { + var value = this.editor.getValue(); + localStorage.setItem(this.keyValue, value); + } else { + console.log('no web storage'); + } + this.updateTimeoutId = null; + } + }; + + function codeStorageFactory(editor, challengeName) { + var codeStorage = Object.create(CodeStorage); + $.extend(codeStorage, CodeStorageProps); + codeStorage.setEditor(editor); + codeStorage.setSaveKey(challengeName); + return codeStorage; + } + + var savedVersion = localStorage.getItem(CodeStorageProps.keyVersion); + if (savedVersion === null) { + localStorage.setItem( + CodeStorageProps.keyVersion, + CodeStorageProps.version + ); + } + + return codeStorageFactory; +}($, localStorage)); + +var sandBox = (function() { + + var plugin = null; + + var sandBox = { + }; + + var printCallback; + + // sends the input to the plugin for evaluation + function submit(code, callback) { + printCallback = callback; + + // postpone the evaluation until the plugin is initialized + plugin.whenConnected(function() { + if (requests === 0) { + startLoading(); + } + + requests++; + plugin.remote.run(code); + }); + } + + // puts the message on the terminal + var print = function(cls, msg) { + printCallback(cls, msg); + }; + + + // will restart the plugin if it does not respond + var disconnectTimeout = null; + var startLoading = function() { + disconnectTimeout = setTimeout(disconnect, 3000); + }; + + var endLoading = function() { + clearTimeout(disconnectTimeout); + }; + + var disconnect = function() { + plugin.disconnect(); + }; + + + // interface provided to the plugin + var api = { + output: function(data) { + endLoading(); + // print('input', data.input); + + if (data.error) { + print('Error', data); + reset(); + } else { + print(null, data); + reset(); + } + } + }; + + + // obtaining absolute path of this script + var scripts = document.getElementsByTagName('script'); + var path = scripts[scripts.length - 1].src + .split('?')[0] + .split('/') + .slice(0, -1) + .join('/') + '/'; + + var requests; + + // (re)initializes the plugin + var reset = function() { + requests = 0; + plugin = new jailed.Plugin(path + 'plugin.js', api); + plugin.whenDisconnected( function() { + // give some time to handle the last responce + setTimeout( function() { + endLoading(); + console.log('resetting on fatal plugin error'); + + if (challengeType === 0) { + codeOutput.setValue( + 'Sorry, your code is either too slow, has a fatal error, ' + + 'or contains an infinite loop.' + ); + } + reset(); + }, 10); + }); + }; + reset(); + sandBox.submit = submit; + return sandBox; +}()); + +function replaceSafeTags(value) { + return value + .replace(/fccss/gi, ''); +} + +var BDDregex = new RegExp( + '(expect(\\s+)?\\(.*\\;)|' + + '(assert(\\s+)?\\(.*\\;)|' + + '(assert\\.\\w.*\\;)|' + + '(.*\\.should\\..*\\;)/' +); + +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 codeStorage = codeStorageFactory(editor, challenge_Name); +var myCodeMirror = editor; + +editor.on('keyup', function() { + clearTimeout(codeStorage.updateTimeoutId); + codeStorage.updateTimeoutId = setTimeout( + codeStorage.updateStorage.bind(codeStorage), + codeStorage.updateWait + ); +}); + +var editorValue; +var challengeSeed = challengeSeed || null; +var tests = tests || []; +var allSeeds = ''; + +(function() { + challengeSeed.forEach(function(elem) { + allSeeds += elem + '\n'; + }); +})(); + +if (typeof emmetCodeMirror !== 'undefined') { + var defaultKeymap = { + 'Cmd-E': 'emmet.expand_abbreviation', + 'Tab': 'emmet.expand_abbreviation_with_tab', + 'Enter': 'emmet.insert_formatted_line_break_only' + }; + + emmetCodeMirror(editor, defaultKeymap); +} + +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; + } +}); + +editor.setSize('100%', 'auto'); + +var libraryIncludes = "" + + "" + + "" + + "" + + "" + + "" + + "" + + '' + + ''; + +var editorValueForIFrame; +var iFrameScript = ""; +var delay; + +function workerError(error) { + var display = $('.runTimeError'); + var housing = $('#testSuite'); + if (display.html() !== error) { + display.remove(); + housing.prepend( + '
' + + error.replace(/j\$/gi, '$').replace(/jdocument/gi, 'document').replace(/jjQuery/gi, 'jQuery') + + '
' + ); + display.hide().fadeIn(function() { + setTimeout(function() { + display.fadeOut(function() { + display.remove(); + }); + }, 1000); + }); + } +} + +function scopejQuery(str) { + return str + .replace(/\$/gi, 'j$') + .replace(/document/gi, 'jdocument') + .replace(/jQuery/gi, 'jjQuery'); +} + +function safeHTMLRun(test) { + if (challengeType === '0') { + var previewFrame = document.getElementById('preview'); + var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; + if (editor.getValue().match(/\/gi) !== null) { + var s = editor + .getValue() + .split(/\<\s?script\s?\>/gi)[1] + .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; + + sandBox.submit(scopejQuery(s), function(cls, message) { + if (cls) { + console.log(message.error); + workerError(message.error); + } else if (test) { + preview.open(); + preview.write(libraryIncludes + editor.getValue() + iFrameScript); + codeStorage.updateStorage(); + preview.close(); + } else { + preview.open(); + preview.write(libraryIncludes + editor.getValue()); + codeStorage.updateStorage(); + preview.close(); + } + }); + } else if (test) { + preview.open(); + preview.write(libraryIncludes + editor.getValue() + iFrameScript); + codeStorage.updateStorage(); + preview.close(); + } else { + preview.open(); + preview.write(libraryIncludes + editor.getValue()); + codeStorage.updateStorage(); + preview.close(); + } + } +} + +function updatePreview() { + editorValueForIFrame = editor.getValue(); + var failedCommentTest = false; + if ( + editorValueForIFrame.match(/\<\!\-\-/gi) && + editorValueForIFrame.match(/\-\-\>/gi) == null + ) { + failedCommentTest = true; + } else if ( + editorValueForIFrame.match(/\<\!\-\-/gi) && + editorValueForIFrame.match(/\<\!\-\-/gi).length > editorValueForIFrame.match(/\-\-\>/gi).length + ) { + failedCommentTest = true; + } + + if (failedCommentTest) { + editor.setValue(editor.getValue() + '-->'); + editorValueForIFrame = editorValueForIFrame + '-->'; + } + + if (!editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi)) { + safeHTMLRun(false); + } else { + workerError('Unsafe $($)'); + } +} + +if (typeof prodOrDev !== 'undefined') { + + var nodeEnv = prodOrDev === 'production' ? + 'http://www.freecodecamp.com' : + 'http://localhost:3001'; + + if (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 + */ + +var testResults = []; +var postSuccess = function(data) { + var testDoc = document.createElement('div'); + $(testDoc).html( + "
" + + JSON.parse(data) + + '
' + ); + + $('#testSuite').append(testDoc); + testSuccess(); +}; + +var postError = function(data) { + var testDoc = document.createElement('div'); + + $(testDoc).html( + "
" + + JSON.parse(data) + + '
' + ); + + $('#testSuite').append(testDoc); +}; + +var goodTests = 0; +var testSuccess = function() { + goodTests++; + // test successful run show completion + if (goodTests === tests.length) { + 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; + return; + } + var time = Math.floor(Date.now()) - started; + ga( + 'send', + 'event', + 'Challenge', + 'solved', + challenge_Name + ', Time: ' + time + ', Attempts: ' + attempts + ); + var bonfireSolution = myCodeMirror.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(); + + $('#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') + // .removeClass('zoomInDown') + .delay(1000) + .queue(function(next) { + $(this).replaceWith( + '
submitting...
' + ); + next(); + }); + + $.post( + '/completed-bonfire/', { + challengeInfo: { + challengeId: challenge_Id, + challengeName: challenge_Name, + completedWith: didCompleteWith, + challengeType: challengeType, + solution: bonfireSolution + } + }, + function(res) { + if (res) { + window.location = '/challenges/next-challenge?id=' + challenge_Id; + } + } + ); + }); +} + +var resetEditor = function resetEditor() { + editor.setValue(replaceSafeTags(allSeeds)); + $('#testSuite').empty(); + bonfireExecute(true); + codeStorage.updateStorage(); +}; + +var attempts = 0; +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(); + + +var scrapeTests = function(userJavaScript) { + + // insert tests from mongo + for (var i = 0; i < tests.length; i++) { + userJavaScript += '\n' + tests[i]; + } + + var counter = 0; + var match = BDDregex.exec(userJavaScript); + + while (match) { + var replacement = '//' + counter + testSalt; + userJavaScript = userJavaScript.substring(0, match.index) + + replacement + + userJavaScript.substring(match.index + match[0].length); + + if (!userTests) { + userTests = []; + } + + userTests.push({ + 'text': match[0], + 'line': counter, + 'err': null + }); + + counter++; + match = BDDregex.exec(userJavaScript); + } + + return userJavaScript; +}; + +function removeComments(userJavaScript) { + var regex = new RegExp(/(\/\*[^(\*\/)]*\*\/)|\/\/[^\n]*/g); + return userJavaScript.replace(regex, ''); +} + +function removeLogs(userJavaScript) { + return userJavaScript.replace(/(console\.[\w]+\s*\(.*\;)/g, ''); +} + +var pushed = false; +var createTestDisplay = function() { + if (pushed) { + userTests.pop(); + } + for (var i = 0; i < userTests.length; i++) { + var test = userTests[i]; + var testDoc = document.createElement('div'); + + if (test.err) { + console.log('Should be displaying bad tests'); + + $(testDoc).html( + "
" + + test.text + "
" + + test.err + "
" + ) + .appendTo($('#testSuite')); + + } else { + + $(testDoc).html( + "
" + + test.text + + "
" + ) + .appendTo($('#testSuite')); + } + } +}; + +var expect = chai.expect; +var assert = chai.assert; +var should = chai.should(); + + +var reassembleTest = function(test, data) { + var lineNum = test.line; + var regexp = new RegExp('\/\/' + lineNum + testSalt); + return data.input.replace(regexp, test.text); +}; + +var runTests = function(err, data) { + // userTests = userTests ? null : []; + var allTestsPassed = true; + pushed = false; + $('#testSuite').children().remove(); + if (err && userTests.length > 0) { + userTests = [{ + text: 'Program Execution Failure', + err: 'No user tests were run.' + }]; + createTestDisplay(); + + // Add blocks to test exploits here! + } else if (editorValue.match(/if\s\(null\)\sconsole\.log\(1\);/gi)) { + allTestsPassed = false; + userTests = [{ + text: 'Program Execution Failure', + err: 'Invalid if (null) console.log(1); detected' + }]; + createTestDisplay(); + } else if (userTests) { + userTests.push(false); + pushed = true; + userTests.forEach(function( + chaiTestFromJSON, + indexOfTestArray, + __testArray + ) { + try { + if (chaiTestFromJSON) { + /* eslint-disable no-eval */ + var output = eval(reassembleTest(chaiTestFromJSON, data)); + /* eslint-enable no-eval */ + } + } catch (error) { + allTestsPassed = false; + __testArray[indexOfTestArray].err = error.message; + } finally { + if (!chaiTestFromJSON) { + createTestDisplay(); + } + } + }); + + if (allTestsPassed) { + allTestsPassed = false; + showCompletion(); + } else { + isInitRun = false; + } + } +}; + +function bonfireExecute(shouldTest) { + initPreview = false; + goodTests = 0; + attempts++; + ga('send', 'event', 'Challenge', 'ran-code', challenge_Name); + userTests = null; + $('#testSuite').empty(); + + if ( + challengeType !== '0' && + !editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) + ) { + var userJavaScript = myCodeMirror.getValue(); + var failedCommentTest = false; + + // checks if the number of opening comments(/*) matches the number of + // closing comments(*/) + if ( + userJavaScript.match(/\/\*/gi) && + userJavaScript.match(/\/\*/gi).length > userJavaScript.match(/\*\//gi).length + ) { + failedCommentTest = true; + } + + userJavaScript = removeComments(userJavaScript); + userJavaScript = scrapeTests(userJavaScript); + // simple fix in case the user forgets to invoke their function + + if (userJavaScript.match(/function/gi)) { + if (userJavaScript.match(/function\s*?\(|function\s+\w+\s*?\(/gi)) { + sandBox.submit(userJavaScript, function(cls, message) { + if (failedCommentTest) { + myCodeMirror.setValue(myCodeMirror.getValue() + '*/'); + console.log('Caught Unfinished Comment'); + codeOutput.setValue('Unfinished multi-line comment'); + failedCommentTest = false; + } else if (cls) { + codeOutput.setValue(message.error); + if (shouldTest) { + runTests('Error', null); + } + } else { + codeOutput.setValue(message.output); + codeOutput.setValue(codeOutput.getValue().replace(/\\\"/gi, '')); + message.input = removeLogs(message.input); + if (shouldTest) { + runTests(null, message); + } + } + }); + } else { + codeOutput.setValue('Unsafe or unfinished function declaration'); + } + } else { + sandBox.submit(userJavaScript, function(cls, message) { + + if (failedCommentTest) { + myCodeMirror.setValue(myCodeMirror.getValue() + '*/'); + console.log('Caught Unfinished Comment'); + codeOutput.setValue('Unfinished mulit-line comment'); + failedCommentTest = false; + } else if (cls) { + codeOutput.setValue(message.error); + if (shouldTest) { + runTests('Error', null); + } + } else { + codeOutput.setValue(message.output); + codeOutput.setValue(codeOutput.getValue().replace(/\\\"/gi, '')); + message.input = removeLogs(message.input); + + if (shouldTest) { + runTests(null, message); + } + } + }); + } + } else { + + editorValueForIFrame = editor.getValue(); + + if (failedCommentTest) { + editor.setValue(editor.getValue() + '-->'); + editorValueForIFrame = editorValueForIFrame + '-->'; + } + if ( + !editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi) && + challengeType === '0' + ) { + safeHTMLRun(shouldTest); + } else { + workerError('Unsafe $($)'); + } + } + setTimeout(function() { + var $marginFix = $('.innerMarginFix'); + $marginFix.css('min-height', $marginFix.height()); + }, 1000); +} + +$('#submitButton').on('click', function() { + isInitRun = false; + bonfireExecute(true); +}); + +$(document).ready(function() { + + // 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)); + myCodeMirror.refresh(); + + if (typeof $preview.html() !== 'undefined') { + $preview.load(function() { + if (initPreview) { + bonfireExecute(true); + } + }); + } else { + 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/public/js/lib/coursewares/iFrameScripts_0.0.4.js b/client/iFrameScripts.js similarity index 100% rename from public/js/lib/coursewares/iFrameScripts_0.0.4.js rename to client/iFrameScripts.js diff --git a/client/index.js b/client/index.js index 95be7ca9ae..79c5c541c1 100644 --- a/client/index.js +++ b/client/index.js @@ -1,3 +1,4 @@ +import unused from './es6-shims'; // eslint-disable-line import Rx from 'rx'; import React from 'react'; import Fetchr from 'fetchr'; diff --git a/public/css/lib/animate.min.less b/client/less/lib/animate.min.less similarity index 100% rename from public/css/lib/animate.min.less rename to client/less/lib/animate.min.less diff --git a/public/css/lib/bootstrap-social/bootstrap-social.less b/client/less/lib/bootstrap-social/bootstrap-social.less similarity index 100% rename from public/css/lib/bootstrap-social/bootstrap-social.less rename to client/less/lib/bootstrap-social/bootstrap-social.less diff --git a/public/css/lib/bootstrap/alerts.less b/client/less/lib/bootstrap/alerts.less similarity index 100% rename from public/css/lib/bootstrap/alerts.less rename to client/less/lib/bootstrap/alerts.less diff --git a/public/css/lib/bootstrap/badges.less b/client/less/lib/bootstrap/badges.less similarity index 100% rename from public/css/lib/bootstrap/badges.less rename to client/less/lib/bootstrap/badges.less diff --git a/public/css/lib/bootstrap/bootstrap.less b/client/less/lib/bootstrap/bootstrap.less similarity index 100% rename from public/css/lib/bootstrap/bootstrap.less rename to client/less/lib/bootstrap/bootstrap.less diff --git a/public/css/lib/bootstrap/breadcrumbs.less b/client/less/lib/bootstrap/breadcrumbs.less similarity index 100% rename from public/css/lib/bootstrap/breadcrumbs.less rename to client/less/lib/bootstrap/breadcrumbs.less diff --git a/public/css/lib/bootstrap/button-groups.less b/client/less/lib/bootstrap/button-groups.less similarity index 100% rename from public/css/lib/bootstrap/button-groups.less rename to client/less/lib/bootstrap/button-groups.less diff --git a/public/css/lib/bootstrap/buttons.less b/client/less/lib/bootstrap/buttons.less similarity index 100% rename from public/css/lib/bootstrap/buttons.less rename to client/less/lib/bootstrap/buttons.less diff --git a/public/css/lib/bootstrap/carousel.less b/client/less/lib/bootstrap/carousel.less similarity index 100% rename from public/css/lib/bootstrap/carousel.less rename to client/less/lib/bootstrap/carousel.less diff --git a/public/css/lib/bootstrap/close.less b/client/less/lib/bootstrap/close.less similarity index 100% rename from public/css/lib/bootstrap/close.less rename to client/less/lib/bootstrap/close.less diff --git a/public/css/lib/bootstrap/code.less b/client/less/lib/bootstrap/code.less similarity index 100% rename from public/css/lib/bootstrap/code.less rename to client/less/lib/bootstrap/code.less diff --git a/public/css/lib/bootstrap/component-animations.less b/client/less/lib/bootstrap/component-animations.less similarity index 100% rename from public/css/lib/bootstrap/component-animations.less rename to client/less/lib/bootstrap/component-animations.less diff --git a/public/css/lib/bootstrap/dropdowns.less b/client/less/lib/bootstrap/dropdowns.less similarity index 100% rename from public/css/lib/bootstrap/dropdowns.less rename to client/less/lib/bootstrap/dropdowns.less diff --git a/public/css/lib/bootstrap/forms.less b/client/less/lib/bootstrap/forms.less similarity index 100% rename from public/css/lib/bootstrap/forms.less rename to client/less/lib/bootstrap/forms.less diff --git a/public/css/lib/bootstrap/glyphicons.less b/client/less/lib/bootstrap/glyphicons.less similarity index 100% rename from public/css/lib/bootstrap/glyphicons.less rename to client/less/lib/bootstrap/glyphicons.less diff --git a/public/css/lib/bootstrap/grid.less b/client/less/lib/bootstrap/grid.less similarity index 100% rename from public/css/lib/bootstrap/grid.less rename to client/less/lib/bootstrap/grid.less diff --git a/public/css/lib/bootstrap/input-groups.less b/client/less/lib/bootstrap/input-groups.less similarity index 100% rename from public/css/lib/bootstrap/input-groups.less rename to client/less/lib/bootstrap/input-groups.less diff --git a/public/css/lib/bootstrap/jumbotron.less b/client/less/lib/bootstrap/jumbotron.less similarity index 100% rename from public/css/lib/bootstrap/jumbotron.less rename to client/less/lib/bootstrap/jumbotron.less diff --git a/public/css/lib/bootstrap/labels.less b/client/less/lib/bootstrap/labels.less similarity index 100% rename from public/css/lib/bootstrap/labels.less rename to client/less/lib/bootstrap/labels.less diff --git a/public/css/lib/bootstrap/list-group.less b/client/less/lib/bootstrap/list-group.less similarity index 100% rename from public/css/lib/bootstrap/list-group.less rename to client/less/lib/bootstrap/list-group.less diff --git a/public/css/lib/bootstrap/media.less b/client/less/lib/bootstrap/media.less similarity index 100% rename from public/css/lib/bootstrap/media.less rename to client/less/lib/bootstrap/media.less diff --git a/public/css/lib/bootstrap/mixins.less b/client/less/lib/bootstrap/mixins.less similarity index 100% rename from public/css/lib/bootstrap/mixins.less rename to client/less/lib/bootstrap/mixins.less diff --git a/public/css/lib/bootstrap/mixins/alerts.less b/client/less/lib/bootstrap/mixins/alerts.less similarity index 100% rename from public/css/lib/bootstrap/mixins/alerts.less rename to client/less/lib/bootstrap/mixins/alerts.less diff --git a/public/css/lib/bootstrap/mixins/background-variant.less b/client/less/lib/bootstrap/mixins/background-variant.less similarity index 100% rename from public/css/lib/bootstrap/mixins/background-variant.less rename to client/less/lib/bootstrap/mixins/background-variant.less diff --git a/public/css/lib/bootstrap/mixins/border-radius.less b/client/less/lib/bootstrap/mixins/border-radius.less similarity index 100% rename from public/css/lib/bootstrap/mixins/border-radius.less rename to client/less/lib/bootstrap/mixins/border-radius.less diff --git a/public/css/lib/bootstrap/mixins/buttons.less b/client/less/lib/bootstrap/mixins/buttons.less similarity index 100% rename from public/css/lib/bootstrap/mixins/buttons.less rename to client/less/lib/bootstrap/mixins/buttons.less diff --git a/public/css/lib/bootstrap/mixins/center-block.less b/client/less/lib/bootstrap/mixins/center-block.less similarity index 100% rename from public/css/lib/bootstrap/mixins/center-block.less rename to client/less/lib/bootstrap/mixins/center-block.less diff --git a/public/css/lib/bootstrap/mixins/clearfix.less b/client/less/lib/bootstrap/mixins/clearfix.less similarity index 100% rename from public/css/lib/bootstrap/mixins/clearfix.less rename to client/less/lib/bootstrap/mixins/clearfix.less diff --git a/public/css/lib/bootstrap/mixins/forms.less b/client/less/lib/bootstrap/mixins/forms.less similarity index 100% rename from public/css/lib/bootstrap/mixins/forms.less rename to client/less/lib/bootstrap/mixins/forms.less diff --git a/public/css/lib/bootstrap/mixins/gradients.less b/client/less/lib/bootstrap/mixins/gradients.less similarity index 100% rename from public/css/lib/bootstrap/mixins/gradients.less rename to client/less/lib/bootstrap/mixins/gradients.less diff --git a/public/css/lib/bootstrap/mixins/grid-framework.less b/client/less/lib/bootstrap/mixins/grid-framework.less similarity index 100% rename from public/css/lib/bootstrap/mixins/grid-framework.less rename to client/less/lib/bootstrap/mixins/grid-framework.less diff --git a/public/css/lib/bootstrap/mixins/grid.less b/client/less/lib/bootstrap/mixins/grid.less similarity index 100% rename from public/css/lib/bootstrap/mixins/grid.less rename to client/less/lib/bootstrap/mixins/grid.less diff --git a/public/css/lib/bootstrap/mixins/hide-text.less b/client/less/lib/bootstrap/mixins/hide-text.less similarity index 100% rename from public/css/lib/bootstrap/mixins/hide-text.less rename to client/less/lib/bootstrap/mixins/hide-text.less diff --git a/public/css/lib/bootstrap/mixins/image.less b/client/less/lib/bootstrap/mixins/image.less similarity index 100% rename from public/css/lib/bootstrap/mixins/image.less rename to client/less/lib/bootstrap/mixins/image.less diff --git a/public/css/lib/bootstrap/mixins/labels.less b/client/less/lib/bootstrap/mixins/labels.less similarity index 100% rename from public/css/lib/bootstrap/mixins/labels.less rename to client/less/lib/bootstrap/mixins/labels.less diff --git a/public/css/lib/bootstrap/mixins/list-group.less b/client/less/lib/bootstrap/mixins/list-group.less similarity index 100% rename from public/css/lib/bootstrap/mixins/list-group.less rename to client/less/lib/bootstrap/mixins/list-group.less diff --git a/public/css/lib/bootstrap/mixins/nav-divider.less b/client/less/lib/bootstrap/mixins/nav-divider.less similarity index 100% rename from public/css/lib/bootstrap/mixins/nav-divider.less rename to client/less/lib/bootstrap/mixins/nav-divider.less diff --git a/public/css/lib/bootstrap/mixins/nav-vertical-align.less b/client/less/lib/bootstrap/mixins/nav-vertical-align.less similarity index 100% rename from public/css/lib/bootstrap/mixins/nav-vertical-align.less rename to client/less/lib/bootstrap/mixins/nav-vertical-align.less diff --git a/public/css/lib/bootstrap/mixins/opacity.less b/client/less/lib/bootstrap/mixins/opacity.less similarity index 100% rename from public/css/lib/bootstrap/mixins/opacity.less rename to client/less/lib/bootstrap/mixins/opacity.less diff --git a/public/css/lib/bootstrap/mixins/pagination.less b/client/less/lib/bootstrap/mixins/pagination.less similarity index 100% rename from public/css/lib/bootstrap/mixins/pagination.less rename to client/less/lib/bootstrap/mixins/pagination.less diff --git a/public/css/lib/bootstrap/mixins/panels.less b/client/less/lib/bootstrap/mixins/panels.less similarity index 100% rename from public/css/lib/bootstrap/mixins/panels.less rename to client/less/lib/bootstrap/mixins/panels.less diff --git a/public/css/lib/bootstrap/mixins/progress-bar.less b/client/less/lib/bootstrap/mixins/progress-bar.less similarity index 100% rename from public/css/lib/bootstrap/mixins/progress-bar.less rename to client/less/lib/bootstrap/mixins/progress-bar.less diff --git a/public/css/lib/bootstrap/mixins/reset-filter.less b/client/less/lib/bootstrap/mixins/reset-filter.less similarity index 100% rename from public/css/lib/bootstrap/mixins/reset-filter.less rename to client/less/lib/bootstrap/mixins/reset-filter.less diff --git a/public/css/lib/bootstrap/mixins/resize.less b/client/less/lib/bootstrap/mixins/resize.less similarity index 100% rename from public/css/lib/bootstrap/mixins/resize.less rename to client/less/lib/bootstrap/mixins/resize.less diff --git a/public/css/lib/bootstrap/mixins/responsive-visibility.less b/client/less/lib/bootstrap/mixins/responsive-visibility.less similarity index 100% rename from public/css/lib/bootstrap/mixins/responsive-visibility.less rename to client/less/lib/bootstrap/mixins/responsive-visibility.less diff --git a/public/css/lib/bootstrap/mixins/size.less b/client/less/lib/bootstrap/mixins/size.less similarity index 100% rename from public/css/lib/bootstrap/mixins/size.less rename to client/less/lib/bootstrap/mixins/size.less diff --git a/public/css/lib/bootstrap/mixins/tab-focus.less b/client/less/lib/bootstrap/mixins/tab-focus.less similarity index 100% rename from public/css/lib/bootstrap/mixins/tab-focus.less rename to client/less/lib/bootstrap/mixins/tab-focus.less diff --git a/public/css/lib/bootstrap/mixins/table-row.less b/client/less/lib/bootstrap/mixins/table-row.less similarity index 100% rename from public/css/lib/bootstrap/mixins/table-row.less rename to client/less/lib/bootstrap/mixins/table-row.less diff --git a/public/css/lib/bootstrap/mixins/text-emphasis.less b/client/less/lib/bootstrap/mixins/text-emphasis.less similarity index 100% rename from public/css/lib/bootstrap/mixins/text-emphasis.less rename to client/less/lib/bootstrap/mixins/text-emphasis.less diff --git a/public/css/lib/bootstrap/mixins/text-overflow.less b/client/less/lib/bootstrap/mixins/text-overflow.less similarity index 100% rename from public/css/lib/bootstrap/mixins/text-overflow.less rename to client/less/lib/bootstrap/mixins/text-overflow.less diff --git a/public/css/lib/bootstrap/mixins/vendor-prefixes.less b/client/less/lib/bootstrap/mixins/vendor-prefixes.less similarity index 100% rename from public/css/lib/bootstrap/mixins/vendor-prefixes.less rename to client/less/lib/bootstrap/mixins/vendor-prefixes.less diff --git a/public/css/lib/bootstrap/modals.less b/client/less/lib/bootstrap/modals.less similarity index 100% rename from public/css/lib/bootstrap/modals.less rename to client/less/lib/bootstrap/modals.less diff --git a/public/css/lib/bootstrap/navbar.less b/client/less/lib/bootstrap/navbar.less similarity index 100% rename from public/css/lib/bootstrap/navbar.less rename to client/less/lib/bootstrap/navbar.less diff --git a/public/css/lib/bootstrap/navs.less b/client/less/lib/bootstrap/navs.less similarity index 100% rename from public/css/lib/bootstrap/navs.less rename to client/less/lib/bootstrap/navs.less diff --git a/public/css/lib/bootstrap/normalize.less b/client/less/lib/bootstrap/normalize.less similarity index 100% rename from public/css/lib/bootstrap/normalize.less rename to client/less/lib/bootstrap/normalize.less diff --git a/public/css/lib/bootstrap/pager.less b/client/less/lib/bootstrap/pager.less similarity index 100% rename from public/css/lib/bootstrap/pager.less rename to client/less/lib/bootstrap/pager.less diff --git a/public/css/lib/bootstrap/pagination.less b/client/less/lib/bootstrap/pagination.less similarity index 100% rename from public/css/lib/bootstrap/pagination.less rename to client/less/lib/bootstrap/pagination.less diff --git a/public/css/lib/bootstrap/panels.less b/client/less/lib/bootstrap/panels.less similarity index 100% rename from public/css/lib/bootstrap/panels.less rename to client/less/lib/bootstrap/panels.less diff --git a/public/css/lib/bootstrap/popovers.less b/client/less/lib/bootstrap/popovers.less similarity index 100% rename from public/css/lib/bootstrap/popovers.less rename to client/less/lib/bootstrap/popovers.less diff --git a/public/css/lib/bootstrap/print.less b/client/less/lib/bootstrap/print.less similarity index 100% rename from public/css/lib/bootstrap/print.less rename to client/less/lib/bootstrap/print.less diff --git a/public/css/lib/bootstrap/progress-bars.less b/client/less/lib/bootstrap/progress-bars.less similarity index 100% rename from public/css/lib/bootstrap/progress-bars.less rename to client/less/lib/bootstrap/progress-bars.less diff --git a/public/css/lib/bootstrap/responsive-embed.less b/client/less/lib/bootstrap/responsive-embed.less similarity index 100% rename from public/css/lib/bootstrap/responsive-embed.less rename to client/less/lib/bootstrap/responsive-embed.less diff --git a/public/css/lib/bootstrap/responsive-utilities.less b/client/less/lib/bootstrap/responsive-utilities.less similarity index 100% rename from public/css/lib/bootstrap/responsive-utilities.less rename to client/less/lib/bootstrap/responsive-utilities.less diff --git a/public/css/lib/bootstrap/scaffolding.less b/client/less/lib/bootstrap/scaffolding.less similarity index 100% rename from public/css/lib/bootstrap/scaffolding.less rename to client/less/lib/bootstrap/scaffolding.less diff --git a/public/css/lib/bootstrap/tables.less b/client/less/lib/bootstrap/tables.less similarity index 100% rename from public/css/lib/bootstrap/tables.less rename to client/less/lib/bootstrap/tables.less diff --git a/public/css/lib/bootstrap/theme.less b/client/less/lib/bootstrap/theme.less similarity index 100% rename from public/css/lib/bootstrap/theme.less rename to client/less/lib/bootstrap/theme.less diff --git a/public/css/lib/bootstrap/thumbnails.less b/client/less/lib/bootstrap/thumbnails.less similarity index 100% rename from public/css/lib/bootstrap/thumbnails.less rename to client/less/lib/bootstrap/thumbnails.less diff --git a/public/css/lib/bootstrap/tooltip.less b/client/less/lib/bootstrap/tooltip.less similarity index 100% rename from public/css/lib/bootstrap/tooltip.less rename to client/less/lib/bootstrap/tooltip.less diff --git a/public/css/lib/bootstrap/type.less b/client/less/lib/bootstrap/type.less similarity index 100% rename from public/css/lib/bootstrap/type.less rename to client/less/lib/bootstrap/type.less diff --git a/public/css/lib/bootstrap/utilities.less b/client/less/lib/bootstrap/utilities.less similarity index 100% rename from public/css/lib/bootstrap/utilities.less rename to client/less/lib/bootstrap/utilities.less diff --git a/public/css/lib/bootstrap/variables.less b/client/less/lib/bootstrap/variables.less similarity index 92% rename from public/css/lib/bootstrap/variables.less rename to client/less/lib/bootstrap/variables.less index 01e26f3433..8b8fefa81d 100755 --- a/public/css/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/public/css/lib/bootstrap/wells.less b/client/less/lib/bootstrap/wells.less similarity index 100% rename from public/css/lib/bootstrap/wells.less rename to client/less/lib/bootstrap/wells.less diff --git a/public/css/lib/font-awesome-4.3.0/css/font-awesome.css b/client/less/lib/font-awesome-4.3.0/css/font-awesome.css similarity index 100% rename from public/css/lib/font-awesome-4.3.0/css/font-awesome.css rename to client/less/lib/font-awesome-4.3.0/css/font-awesome.css diff --git a/public/css/lib/font-awesome-4.3.0/css/font-awesome.min.css b/client/less/lib/font-awesome-4.3.0/css/font-awesome.min.css similarity index 100% rename from public/css/lib/font-awesome-4.3.0/css/font-awesome.min.css rename to client/less/lib/font-awesome-4.3.0/css/font-awesome.min.css diff --git a/public/css/lib/font-awesome-4.3.0/fonts/FontAwesome.otf b/client/less/lib/font-awesome-4.3.0/fonts/FontAwesome.otf similarity index 100% rename from public/css/lib/font-awesome-4.3.0/fonts/FontAwesome.otf rename to client/less/lib/font-awesome-4.3.0/fonts/FontAwesome.otf diff --git a/public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.eot b/client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.eot similarity index 100% rename from public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.eot rename to client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.eot diff --git a/public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.svg b/client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.svg similarity index 100% rename from public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.svg rename to client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.svg diff --git a/public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.ttf b/client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.ttf similarity index 100% rename from public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.ttf rename to client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.ttf diff --git a/public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff b/client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff similarity index 100% rename from public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff rename to client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff diff --git a/public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff2 b/client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff2 similarity index 100% rename from public/css/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff2 rename to client/less/lib/font-awesome-4.3.0/fonts/fontawesome-webfont.woff2 diff --git a/public/css/lib/font-awesome-4.3.0/less/animated.less b/client/less/lib/font-awesome-4.3.0/less/animated.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/animated.less rename to client/less/lib/font-awesome-4.3.0/less/animated.less diff --git a/public/css/lib/font-awesome-4.3.0/less/bordered-pulled.less b/client/less/lib/font-awesome-4.3.0/less/bordered-pulled.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/bordered-pulled.less rename to client/less/lib/font-awesome-4.3.0/less/bordered-pulled.less diff --git a/public/css/lib/font-awesome-4.3.0/less/core.less b/client/less/lib/font-awesome-4.3.0/less/core.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/core.less rename to client/less/lib/font-awesome-4.3.0/less/core.less diff --git a/public/css/lib/font-awesome-4.3.0/less/fixed-width.less b/client/less/lib/font-awesome-4.3.0/less/fixed-width.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/fixed-width.less rename to client/less/lib/font-awesome-4.3.0/less/fixed-width.less diff --git a/public/css/lib/font-awesome-4.3.0/less/font-awesome.less b/client/less/lib/font-awesome-4.3.0/less/font-awesome.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/font-awesome.less rename to client/less/lib/font-awesome-4.3.0/less/font-awesome.less diff --git a/public/css/lib/font-awesome-4.3.0/less/icons.less b/client/less/lib/font-awesome-4.3.0/less/icons.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/icons.less rename to client/less/lib/font-awesome-4.3.0/less/icons.less diff --git a/public/css/lib/font-awesome-4.3.0/less/larger.less b/client/less/lib/font-awesome-4.3.0/less/larger.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/larger.less rename to client/less/lib/font-awesome-4.3.0/less/larger.less diff --git a/public/css/lib/font-awesome-4.3.0/less/list.less b/client/less/lib/font-awesome-4.3.0/less/list.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/list.less rename to client/less/lib/font-awesome-4.3.0/less/list.less diff --git a/public/css/lib/font-awesome-4.3.0/less/mixins.less b/client/less/lib/font-awesome-4.3.0/less/mixins.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/mixins.less rename to client/less/lib/font-awesome-4.3.0/less/mixins.less diff --git a/public/css/lib/font-awesome-4.3.0/less/path.less b/client/less/lib/font-awesome-4.3.0/less/path.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/path.less rename to client/less/lib/font-awesome-4.3.0/less/path.less diff --git a/public/css/lib/font-awesome-4.3.0/less/rotated-flipped.less b/client/less/lib/font-awesome-4.3.0/less/rotated-flipped.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/rotated-flipped.less rename to client/less/lib/font-awesome-4.3.0/less/rotated-flipped.less diff --git a/public/css/lib/font-awesome-4.3.0/less/stacked.less b/client/less/lib/font-awesome-4.3.0/less/stacked.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/stacked.less rename to client/less/lib/font-awesome-4.3.0/less/stacked.less diff --git a/public/css/lib/font-awesome-4.3.0/less/variables.less b/client/less/lib/font-awesome-4.3.0/less/variables.less similarity index 100% rename from public/css/lib/font-awesome-4.3.0/less/variables.less rename to client/less/lib/font-awesome-4.3.0/less/variables.less diff --git a/public/css/lib/font-awesome-4.3.0/scss/_animated.scss b/client/less/lib/font-awesome-4.3.0/scss/_animated.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_animated.scss rename to client/less/lib/font-awesome-4.3.0/scss/_animated.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_bordered-pulled.scss b/client/less/lib/font-awesome-4.3.0/scss/_bordered-pulled.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_bordered-pulled.scss rename to client/less/lib/font-awesome-4.3.0/scss/_bordered-pulled.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_core.scss b/client/less/lib/font-awesome-4.3.0/scss/_core.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_core.scss rename to client/less/lib/font-awesome-4.3.0/scss/_core.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_fixed-width.scss b/client/less/lib/font-awesome-4.3.0/scss/_fixed-width.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_fixed-width.scss rename to client/less/lib/font-awesome-4.3.0/scss/_fixed-width.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_icons.scss b/client/less/lib/font-awesome-4.3.0/scss/_icons.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_icons.scss rename to client/less/lib/font-awesome-4.3.0/scss/_icons.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_larger.scss b/client/less/lib/font-awesome-4.3.0/scss/_larger.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_larger.scss rename to client/less/lib/font-awesome-4.3.0/scss/_larger.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_list.scss b/client/less/lib/font-awesome-4.3.0/scss/_list.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_list.scss rename to client/less/lib/font-awesome-4.3.0/scss/_list.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_mixins.scss b/client/less/lib/font-awesome-4.3.0/scss/_mixins.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_mixins.scss rename to client/less/lib/font-awesome-4.3.0/scss/_mixins.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_path.scss b/client/less/lib/font-awesome-4.3.0/scss/_path.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_path.scss rename to client/less/lib/font-awesome-4.3.0/scss/_path.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_rotated-flipped.scss b/client/less/lib/font-awesome-4.3.0/scss/_rotated-flipped.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_rotated-flipped.scss rename to client/less/lib/font-awesome-4.3.0/scss/_rotated-flipped.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_stacked.scss b/client/less/lib/font-awesome-4.3.0/scss/_stacked.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_stacked.scss rename to client/less/lib/font-awesome-4.3.0/scss/_stacked.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/_variables.scss b/client/less/lib/font-awesome-4.3.0/scss/_variables.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/_variables.scss rename to client/less/lib/font-awesome-4.3.0/scss/_variables.scss diff --git a/public/css/lib/font-awesome-4.3.0/scss/font-awesome.scss b/client/less/lib/font-awesome-4.3.0/scss/font-awesome.scss similarity index 100% rename from public/css/lib/font-awesome-4.3.0/scss/font-awesome.scss rename to client/less/lib/font-awesome-4.3.0/scss/font-awesome.scss diff --git a/public/css/lib/ionicons/_ionicons-animation.less b/client/less/lib/ionicons/_ionicons-animation.less similarity index 100% rename from public/css/lib/ionicons/_ionicons-animation.less rename to client/less/lib/ionicons/_ionicons-animation.less diff --git a/public/css/lib/ionicons/_ionicons-font.less b/client/less/lib/ionicons/_ionicons-font.less similarity index 100% rename from public/css/lib/ionicons/_ionicons-font.less rename to client/less/lib/ionicons/_ionicons-font.less diff --git a/public/css/lib/ionicons/_ionicons-icons.less b/client/less/lib/ionicons/_ionicons-icons.less similarity index 100% rename from public/css/lib/ionicons/_ionicons-icons.less rename to client/less/lib/ionicons/_ionicons-icons.less diff --git a/public/css/lib/ionicons/_ionicons-variables.less b/client/less/lib/ionicons/_ionicons-variables.less similarity index 100% rename from public/css/lib/ionicons/_ionicons-variables.less rename to client/less/lib/ionicons/_ionicons-variables.less diff --git a/public/css/lib/ionicons/ionicons.less b/client/less/lib/ionicons/ionicons.less similarity index 100% rename from public/css/lib/ionicons/ionicons.less rename to client/less/lib/ionicons/ionicons.less diff --git a/public/css/lib/ionicons/ionicons.min.css b/client/less/lib/ionicons/ionicons.min.css similarity index 100% rename from public/css/lib/ionicons/ionicons.min.css rename to client/less/lib/ionicons/ionicons.min.css diff --git a/public/css/main.less b/client/less/main.less similarity index 79% rename from public/css/main.less rename to client/less/main.less index 2deec50cca..e21023754e 100644 --- a/public/css/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,16 +537,16 @@ thead { position: absolute; a { font-size: 20px; - color: #eee; + color: @gray-lighter; margin-left: 0px; margin-right: 0px; padding-left: 10px; padding-right: 10px; + padding-top: 14px; + padding-bottom: 12px; &:hover { - padding-top: 14px; - padding-bottom: 12px; 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; } @@ -1177,3 +946,104 @@ hr { // border-width: 1px; // border-style: solid; //} + +// source: https://github.com/jlong/css-spinners/blob/master/css/spinner/inner-circles.css +// license MIT +/* :not(:required) hides this rule from IE9 and below */ +.inner-circles-loader:not(:required) { + -moz-transform: translate3d(0, 0, 0); + -ms-transform: translate3d(0, 0, 0); + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + position: relative; + display: inline-block; + width: 125px; + height: 125px; + background: rgba(25, 165, 152, 0.5); + border-radius: 50%; + overflow: hidden; + text-indent: -9999px; + margin-top: 10%; + /* Hides inner circles outside base circle at safari */ + -webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC); +} +.inner-circles-loader:not(:required):before, .inner-circles-loader:not(:required):after { + content: ''; + position: absolute; + top: 0; + display: inline-block; + width: 125px; + height: 125px; + border-radius: 50%; +} +.inner-circles-loader:not(:required):before { + -moz-animation: inner-circles-loader 3s infinite; + -webkit-animation: inner-circles-loader 3s infinite; + animation: inner-circles-loader 3s infinite; + -moz-transform-origin: 0 50%; + -ms-transform-origin: 0 50%; + -webkit-transform-origin: 0 50%; + transform-origin: 0 50%; + left: 0; + background: #c7efcf; +} +.inner-circles-loader:not(:required):after { + -moz-animation: inner-circles-loader 3s 0.2s reverse infinite; + -webkit-animation: inner-circles-loader 3s 0.2s reverse infinite; + animation: inner-circles-loader 3s 0.2s reverse infinite; + -moz-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + -webkit-transform-origin: 100% 50%; + transform-origin: 100% 50%; + right: 0; + background: #eef5db; +} + +@-moz-keyframes inner-circles-loader { + 0% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -moz-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -moz-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@-webkit-keyframes inner-circles-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@keyframes inner-circles-loader { + 0% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } + 100% { + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} diff --git a/public/js/main_0.0.3.js b/client/main.js similarity index 78% rename from public/js/main_0.0.3.js rename to client/main.js index 3b4b37cee2..08b9a81158 100644 --- a/public/js/main_0.0.3.js +++ b/client/main.js @@ -1,14 +1,16 @@ $(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'; @@ -59,68 +61,70 @@ $(document).ready(function() { function reBindModals(){ - $('#i-want-help').unbind('click'); - $('#i-want-help').on('click', function() { - $('#help-modal').modal('hide'); - var editorValue = editor.getValue(); - var currentLocation = window.location.href; - $.post( - '/get-help', - { - payload: { - code: editorValue, - challenge: currentLocation - } - }, - function(res) { - if (res) { - window.open('https://gitter.im/FreeCodeCamp/Help', '_blank') - } - } - ); + $('.close-modal').unbind('click'); + $('.close-modal').on('click', function(){ + setTimeout(function() { + $('.close-modal').parent().parent().parent().parent().modal('hide'); + }, 200); }); - $('#i-want-help-editorless').unbind('click'); - $('#i-want-help-editorless').on('click', function() { - $('#help-editorless-modal').modal('hide'); - var currentLocation = window.location.href; - $.post( - '/get-help', - { - payload: { - challenge: currentLocation - } - }, - function(res) { - if (res) { - window.open('https://gitter.im/FreeCodeCamp/Help', '_blank') - } - } - ); + $('#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 ' + (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() { + window.open("https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Help-I've-Found-a-Bug", '_blank'); }); $('#report-issue').unbind('click'); $('#report-issue').on('click', function() { - $('#issue-modal').modal('hide'); - window.open('https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge '+ window.location.href +' has an issue. Please describe how to reproduce it, and include links to screenshots if possible.', '_blank') - }); + 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(''); - $('#i-want-help').unbind('click'); - $('#i-want-to-pair').on('click', function() { - $('#pair-modal').modal('hide'); - var currentLocation = window.location.href; - $.post( - '/get-pair', - { - payload: { - challenge: currentLocation - } - }, - function(res) { - if (res) { - window.open('https://gitter.im/FreeCodeCamp/LetsPair', '_blank') - } - } + 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( + 'https://github.com/freecodecamp/freecodecamp/issues/new?&body=' + + textMessage, '_blank' ); }); @@ -177,7 +181,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() { @@ -200,7 +204,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'; @@ -223,39 +227,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); - }); - - // Bonfire instructions functions - $('#more-info').unbind('click'); - $('#more-info').on('click', function() { - ga('send', 'event', 'Challenge', 'more-info', challengeName); - $('#brief-instructions').hide(); - $('#long-instructions').show().removeClass('hide'); - - }); - $('#less-info').unbind('click'); - $('#less-info').on('click', function() { - $('#brief-instructions').show(); - $('#long-instructions').hide(); - }); - $('#complete-courseware-dialog').on('hidden.bs.modal', function() { editor.focus(); }); @@ -381,6 +365,21 @@ $(document).ready(function() { lockTop(); }); } + var execInProgress = false; + document.getElementById('scroll-locker').addEventListener('previewUpdateSpy', function(e){ + if (!execInProgress){ + execInProgress = true; + setTimeout(function(){ + if($($('.scroll-locker').children()[0]).height()-800 > e.detail){ + $('.scroll-locker').scrollTop(e.detail); + } + else { + $('.scroll-locker').animate({"scrollTop":$($('.scroll-locker').children()[0]).height()}, 175); + } + execInProgress = false; + }, 750); + } + }, false); } }); diff --git a/public/js/lib/coursewares/plugin_v0.1.5.js b/client/plugin.js similarity index 65% rename from public/js/lib/coursewares/plugin_v0.1.5.js rename to client/plugin.js index 9e63a18b88..36f869db1a 100644 --- a/public/js/lib/coursewares/plugin_v0.1.5.js +++ b/client/plugin.js @@ -1,6 +1,17 @@ - +/* eslint-disable no-eval */ +/* global importScripts, application */ // executes the given code and handles the result -var run = function(code) { + +function importScript(url, error) { + try { + importScripts(url); + } catch (e) { + error = e; + } + return error; +} + +function run(code) { var result = { input: code, output: null, @@ -18,21 +29,13 @@ var run = function(code) { application.remote.output(result); self.close(); -}; +} // protects even the worker scope from being accessed -var runHidden = function(code) { +function runHidden(code) { - var importScript = function(url) { - var error = null; - try { - importScripts(url); - } catch (e) { - error = e; - console.log('Unable to load %s!', url); - } - }; + /* eslint-disable */ var indexedDB = null; var location = null; var navigator = null; @@ -55,25 +58,37 @@ var runHidden = function(code) { var dump = null; var onoffline = null; var ononline = null; - importScripts( - "https://cdnjs.cloudflare.com/ajax/libs/ramda/0.13.0/ramda.min.js"); - importScripts( - "https://cdnjs.cloudflare.com/ajax/libs/chai/2.2.0/chai.min.js" - ) + /* eslint-enable */ + var error = null; + error = importScript( + error, + 'https://cdnjs.cloudflare.com/ajax/libs/ramda/0.13.0/ramda.min.js' + ); + + error = importScript( + 'https://cdnjs.cloudflare.com/ajax/libs/chai/2.2.0/chai.min.js' + ); + + + /* eslint-disable*/ var expect = chai.expect; var assert = chai.assert; + /* eslint-enable */ + if (error) { + return error; + } return eval(code); } // converts the output into a string -var stringify = function(output) { +function stringify(output) { var result; - if (typeof output == 'undefined') { + if (typeof output === 'undefined') { result = 'undefined'; } else if (output === null) { result = 'null'; @@ -84,5 +99,4 @@ var stringify = function(output) { return result; } - -application.setInterface({run:run}); +application.setInterface({ run: run }); diff --git a/common/app/app-stream.jsx b/common/app/app-stream.jsx index dcba9b7ca0..25ae2a6300 100644 --- a/common/app/app-stream.jsx +++ b/common/app/app-stream.jsx @@ -1,5 +1,4 @@ import Rx from 'rx'; -import assign from 'object.assign'; import { Router } from 'react-router'; import App from './App.jsx'; import AppCat from './Cat'; @@ -8,7 +7,7 @@ import childRoutes from './routes'; const router$ = Rx.Observable.fromNodeCallback(Router.run, Router); -const routes = assign({ components: App }, childRoutes); +const routes = Object.assign({ components: App }, childRoutes); export default function app$(location) { return router$(routes, location) diff --git a/common/app/routes/Bonfires/README.md b/common/app/routes/Bonfires/README.md index d28c45c44e..047bc43183 100644 --- a/common/app/routes/Bonfires/README.md +++ b/common/app/routes/Bonfires/README.md @@ -1 +1 @@ -This folder contains things relative to the bonfires screens +This folder contains things relative to the bonfires' screens 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/Jobs.jsx b/common/app/routes/Jobs/components/Jobs.jsx index 7f31a329dd..a6bc6a9a9f 100644 --- a/common/app/routes/Jobs/components/Jobs.jsx +++ b/common/app/routes/Jobs/components/Jobs.jsx @@ -1,23 +1,39 @@ import React, { cloneElement, PropTypes } from 'react'; import { contain } from 'thundercats-react'; +import { Navigation } from 'react-router'; import { Button, Jumbotron, Row } from 'react-bootstrap'; -import ShowJobs from './Show.jsx'; +import ListJobs from './List.jsx'; export default contain( { store: 'jobsStore', - fetchAction: 'jobActions.getJobs' + fetchAction: 'jobActions.getJobs', + actions: 'jobActions' }, React.createClass({ displayName: 'Jobs', + propTypes: { children: PropTypes.element, + jobActions: PropTypes.object, jobs: PropTypes.array }, + mixins: [Navigation], - renderShow(jobs) { + handleJobClick(id) { + const { jobActions } = this.props; + if (!id) { + return null; + } + jobActions.findJob(id); + this.transitionTo(`/jobs/${id}`); + }, + + renderList(handleJobClick, jobs) { return ( - + ); }, @@ -53,7 +69,7 @@ export default contain( { this.renderChild(children, jobs) || - this.renderShow(jobs) } + this.renderList(this.handleJobClick, jobs) }
); diff --git a/common/app/routes/Jobs/components/List.jsx b/common/app/routes/Jobs/components/List.jsx new file mode 100644 index 0000000000..ec8325a98b --- /dev/null +++ b/common/app/routes/Jobs/components/List.jsx @@ -0,0 +1,83 @@ +import React, { PropTypes } from 'react'; +import { PanelGroup, Thumbnail, Panel, Well } from 'react-bootstrap'; +import moment from 'moment'; + +export default React.createClass({ + displayName: 'ListJobs', + + propTypes: { + handleClick: PropTypes.func, + jobs: PropTypes.array + }, + + renderJobs(handleClick, 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') } +
+

handleClick(id) }>{ description }

+
+
+ ); + }); + }, + + render() { + const { + handleClick, + jobs + } = this.props; + + return ( + + { this.renderJobs(handleClick, jobs) } + + ); + } +}); diff --git a/common/app/routes/Jobs/components/Show.jsx b/common/app/routes/Jobs/components/Show.jsx index 321e00cd02..0baedb82b3 100644 --- a/common/app/routes/Jobs/components/Show.jsx +++ b/common/app/routes/Jobs/components/Show.jsx @@ -1,58 +1,74 @@ import React, { PropTypes } from 'react'; import { contain } from 'thundercats-react'; -import { PanelGroup, Thumbnail, Panel, Well } from 'react-bootstrap'; +import { Row, Thumbnail, Panel, Well } from 'react-bootstrap'; import moment from 'moment'; +const thumbnailStyle = { + backgroundColor: 'white', + maxHeight: '100px', + maxWidth: '100px' +}; + 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; + } }, React.createClass({ - displayName: 'ShowJobs', - + displayName: 'ShowJob', propTypes: { - jobs: PropTypes.array + job: PropTypes.object, + params: PropTypes.object }, - renderJobs(jobs =[]) { - const thumbnailStyle = { - backgroundColor: 'white', - maxHeight: '200px', - maxWidth: '200px' - }; - return jobs.map(( - { - id, - company, - position, - description, - logo, - city, - state, - email, - phone, - postedOn - }, - index - ) => { - const header = ( -
-

{ company }

-
- { position } -
-
- ); - return ( - + 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 } @@ -64,17 +80,8 @@ export default contain(

{ description }

- - ); - }); - }, - - render() { - const { jobs } = this.props; - return ( - - { this.renderJobs(jobs) } - +
+
); } }) diff --git a/common/app/routes/Jobs/flux/Actions.js b/common/app/routes/Jobs/flux/Actions.js index 68d5eeae57..4df2ae42c6 100644 --- a/common/app/routes/Jobs/flux/Actions.js +++ b/common/app/routes/Jobs/flux/Actions.js @@ -5,9 +5,30 @@ const debug = debugFactory('freecc:jobs:actions'); 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 ? + Object.assign({}, oldState, { currentJob: foundJob }) : + null; + }; }, + setError: null, + getJob: null, getJobs(params) { return { params }; } @@ -15,13 +36,28 @@ export default Actions({ .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 }); + } + jobActions.setJobs({ currentJob: job }); + }); + }); return jobActions; }); diff --git a/common/app/routes/Jobs/flux/Store.js b/common/app/routes/Jobs/flux/Store.js index 803bc7b0bd..2fdfa50207 100644 --- a/common/app/routes/Jobs/flux/Store.js +++ b/common/app/routes/Jobs/flux/Store.js @@ -1,10 +1,17 @@ import { Store } from 'thundercats'; -const { setter } = Store; +const { + createRegistrar, + setter, + transformer +} = Store; export default Store() .refs({ displayName: 'JobsStore' }) .init(({ instance: jobsStore, args: [cat] }) => { - let jobActions = cat.getActions('JobActions'); - jobsStore.register(setter(jobActions.setJobs)); + const { setJobs, findJob, setError } = cat.getActions('JobActions'); + const register = createRegistrar(jobsStore); + register(setter(setJobs)); + register(transformer(findJob)); + register(setter(setError)); }); diff --git a/common/app/routes/Jobs/index.js b/common/app/routes/Jobs/index.js index 9d52bf2b53..ac6b07f866 100644 --- a/common/app/routes/Jobs/index.js +++ b/common/app/routes/Jobs/index.js @@ -1,14 +1,18 @@ import Jobs from './components/Jobs.jsx'; +import Show from './components/Show.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/:id', + component: Show + }] }; diff --git a/common/models/User-Identity.js b/common/models/User-Identity.js index 3b1bcb8750..a6c5241043 100644 --- a/common/models/User-Identity.js +++ b/common/models/User-Identity.js @@ -4,12 +4,13 @@ import debugFactory from 'debug'; import { setProfileFromGithub, getFirstImageFromProfile, + getUsernameFromProvider, getSocialProvider } from '../../server/utils/auth'; -const debug = debugFactory('freecc:models:userIdent'); - const { defaultProfileImage } = require('../utils/constantStrings.json'); +const githubRegex = (/github/i); +const debug = debugFactory('freecc:models:userIdent'); function createAccessToken(user, ttl, cb) { if (arguments.length === 2 && typeof ttl === 'function') { @@ -158,14 +159,13 @@ export default function(UserIdent) { userChanged = true; } - if (!(/github/).test(provider) && profile) { - debug('setting social', provider, (/github/g).test(provider)); - debug('profile username', profile.username); - user[provider] = profile.username; + if (!githubRegex.test(provider) && profile) { + user[provider] = getUsernameFromProvider(provider, profile); + userChanged = true; } // if user signed in with github refresh their info - if (/github/.test(provider) && profile && profile._json) { + if (githubRegex.test(provider) && profile && profile._json) { debug("user isn't github cool or username from github is different"); setProfileFromGithub(user, profile, profile._json); userChanged = true; diff --git a/common/models/user.js b/common/models/user.js index d1e24a9e96..e9dbecb0df 100644 --- a/common/models/user.js +++ b/common/models/user.js @@ -123,6 +123,14 @@ module.exports = function(User) { }); }); + User.beforeRemote('login', function(ctx, notUsed, next) { + const { body } = ctx.req; + if (body && typeof body.email === 'string') { + body.email = body.email.toLowerCase(); + } + next(); + }); + User.afterRemote('login', function(ctx, accessToken, next) { var res = ctx.res; var req = ctx.req; diff --git a/gulpfile.js b/gulpfile.js index 8e1e345716..afe9b421f5 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,8 +9,10 @@ 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'), - bower = require('bower-main-files'), // react app webpack = require('gulp-webpack'), @@ -18,16 +23,22 @@ var Rx = require('rx'), nodemon = require('gulp-nodemon'), sync = require('browser-sync'), - inject = require('gulp-inject'), // css less = require('gulp-less'), + // rev + rev = require('gulp-rev'), + revReplace = require('gulp-rev-replace'), + revDel = require('rev-del'), + // lint + jsonlint = require('gulp-jsonlint'), eslint = require('gulp-eslint'); Rx.config.longStackSupport = true; +var __DEV__ = process.env.NODE_ENV !== 'production'; var reloadDelay = 1000; var reload = sync.reload; var paths = { @@ -35,12 +46,15 @@ var paths = { serverIgnore: [ 'gulpfile.js', 'public/', - '!public/js/bundle.js', + '!public/js/bundle*', 'node_modules/', - 'client/' + 'client/', + 'server/manifests/*.json', + 'server/rev-manifest.json' ], publicJs: './public/js', + css: 'public/css', loopback: { client: './client/loopbackClient', @@ -53,6 +67,20 @@ var paths = { dest: 'public/js' }, + js: [ + 'client/main.js', + 'client/iFrameScripts.js', + 'client/plugin.js' + ], + + dependents: [ + 'client/commonFramework.js' + ], + + less: './client/less/main.less', + + manifest: 'server/manifests/', + node: { src: './client', dest: 'common/app' @@ -60,6 +88,11 @@ var paths = { syncWatch: [ 'public/**/*.*' + ], + + challenges: [ + 'seed/challenges/*.json', + 'seed/under-construction/*.json' ] }; @@ -80,52 +113,22 @@ function errorHandler() { this.emit('end'); } -gulp.task('inject', function() { - gulp.src('views/home.jade') - .pipe(plumber({ errorHandler: errorHandler })) - .pipe(inject(gulp.src(bower()), { - // ignorePath: '/public' - })) - .pipe(gulp.dest('views')); -}); - -gulp.task('pack-client', function() { - return gulp.src(webpackConfig.entry) - .pipe(plumber({ errorHandler: errorHandler })) - .pipe(webpack(Object.assign( - {}, - webpackConfig, - webpackOptions - ))) - .pipe(gulp.dest(webpackConfig.output.path)); -}); - -gulp.task('pack-watch', function() { - return gulp.src(webpackConfig.entry) - .pipe(plumber({ errorHandler: errorHandler })) - .pipe(webpack(Object.assign( - {}, - webpackConfig, - webpackOptions, - { watch: true } - ))) - .pipe(gulp.dest(webpackConfig.output.path)); -}); - -gulp.task('pack-node', function() { - return gulp.src(webpackConfigNode.entry) - .pipe(plumber({ errorHandler: errorHandler })) - .pipe(webpack(webpackConfigNode)) - .pipe(gulp.dest(webpackConfigNode.output.path)); -}); - -gulp.task('pack', ['pack-client', 'pack-node']); +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: { @@ -152,7 +155,16 @@ gulp.task('serve', function(cb) { }); }); -gulp.task('sync', ['serve'], function() { +var syncDepenedents = [ + 'serve', + 'js', + 'less', + 'dependents', + 'pack-watch', + 'build-manifest' +]; + +gulp.task('sync', syncDepenedents, function() { sync.init(null, { proxy: 'http://localhost:3000', logLeval: 'debug', @@ -163,26 +175,237 @@ gulp.task('sync', ['serve'], function() { }); }); -gulp.task('lint', function() { +gulp.task('lint-js', function() { return gulp.src(['public/js/lib/**/*']) .pipe(eslint()) .pipe(eslint.format()); }); -gulp.task('less', function() { - return gulp.src('./public/css/*.less') +gulp.task('lint-json', function() { + return gulp.src(paths.challenges) + .pipe(jsonlint()) + .pipe(jsonlint.reporter()); +}); + +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( + {}, + webpackConfig, + webpackOptions + ))) + .pipe(gulp.dest(dest)) + .pipe(rev()) + // copy files to public + .pipe(gulp.dest(dest)) + // create manifest + .pipe(rev.manifest(manifestName)) + // delete old rev + .pipe(delRev( + dest, + manifestName + )) + .pipe(gulp.dest(paths.manifest)); +}); + +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 } + ), 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(dest)) + // create manifest + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) + .pipe(gulp.dest(paths.manifest)); +}); + +gulp.task('pack-node', function() { + return gulp.src(webpackConfigNode.entry) + .pipe(plumber({ errorHandler: errorHandler })) + .pipe(webpack(webpackConfigNode)) + .pipe(gulp.dest(webpackConfigNode.output.path)); +}); + +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('./public/css/')); + .pipe(gulp.dest(dest)) + // add revision + .pipe(rev()) + // copy files to public + .pipe(gulp.dest(dest)) + // create and merge manifest + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) + .pipe(gulp.dest(paths.manifest)); }); -gulp.task('build', ['less']); +gulp.task('js', function() { + var manifestName = 'js-manifest.json'; + var dest = paths.publicJs; -gulp.task('watch', ['less', 'serve', 'sync'], function() { - gulp.watch('./public/css/*.less', ['less']); + return gulp.src(paths.js) + .pipe(plumber({ errorHandler: errorHandler })) + .pipe(gulp.dest(dest)) + // create registry file + .pipe(rev()) + // copy revisioned assets to dest + .pipe(gulp.dest(dest)) + // create manifest file + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) + // copy manifest file to dest + .pipe(gulp.dest(paths.manifest)); }); -gulp.task('default', ['less', 'serve', 'sync', 'watch', 'pack-watch']); +// 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') + ); + + return gulp.src(paths.dependents) + .pipe(plumber({ errorHandler: errorHandler })) + .pipe(revReplace({ manifest: manifest })) + .pipe(gulp.dest(dest)) + .pipe(rev()) + .pipe(gulp.dest(dest)) + .pipe(rev.manifest(manifestName)) + .pipe(delRev( + dest, + manifestName + )) + .pipe(gulp.dest(paths.manifest)); +}); + +function collector(file, memo) { + return Object.assign({}, JSON.parse(file.contents), memo); +} + +function done(manifest) { + return sortKeys(manifest); +} + +function buildManifest() { + return gulp.src(paths.manifest + '*.json') + .pipe(reduce('rev-manifest.json', collector, done, {})) + .pipe(gulp.dest('server/')); +} + +var buildDependents = ['less', 'js', 'dependents']; + +gulp.task('build-manifest', buildDependents, function() { + return buildManifest(); +}); + +gulp.task('build-manifest-watch', function() { + return buildManifest(); +}); + +gulp.task('build', [ + 'less', + 'js', + 'dependents', + 'pack-client', + 'build-manifest' +]); + +var watchDependents = [ + 'less', + 'js', + 'dependents', + 'serve', + 'sync', + 'build-manifest', + 'pack-watch', + 'pack-watch-manifest' +]; + +gulp.task('watch', watchDependents, function() { + gulp.watch(paths.less, ['less']); + gulp.watch(paths.js, ['js']); + gulp.watch(paths.challenges, ['test-challenges']); + 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', + 'pack-watch', + 'pack-watch-manifest', + 'watch', + 'sync' +]); diff --git a/package.json b/package.json index b14ee1e15f..901b54ea3a 100644 --- a/package.json +++ b/package.json @@ -6,30 +6,20 @@ "url": "https://github.com/freecodecamp/freecodecamp.git" }, "scripts": { - "build-production": "webpack", + "build": "gulp build", "start": "babel-node server/server.js", - "prestart-production": "bower cache clean && bower install && gulp build && npm run build-production", + "prestart-production": "bower cache clean && bower install && gulp build", "start-production": "node pm2Start", "lint": "eslint --ext=.js,.jsx .", "test": "mocha --compilers js:babel/register" }, "license": "(BSD-3-Clause AND CC-BY-SA-4.0)", - "contributors": [ - { - "name": "Quincy Larson", - "url": "https://github.com/QuincyLarson" - }, - { - "name": "Nathan Leniz", - "url": "https://github.com/terakilobyte" - } - ], "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", @@ -43,8 +33,10 @@ "csso": "~1.3.11", "dateformat": "~1.0.11", "debug": "~2.1.0", + "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", @@ -59,6 +51,10 @@ "github-api": "~0.7.0", "gulp-less": "^3.0.3", "gulp-minify-css": "~0.5.1", + "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", @@ -68,7 +64,7 @@ "less-middleware": "~2.0.1", "lodash": "^3.9.3", "loopback": "https://github.com/FreeCodeCamp/loopback.git#fix/no-password", - "loopback-boot": "^2.8.0", + "loopback-boot": "2.8.2", "loopback-component-passport": "https://github.com/FreeCodeCamp/loopback-component-passport.git#feature/flashfailure", "loopback-connector-mongodb": "^1.10.0", "lusca": "~1.0.2", @@ -91,13 +87,15 @@ "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-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", "thundercats": "^2.1.0", "thundercats-react": "^0.1.0", @@ -108,18 +106,16 @@ "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", + "gulp-jsonlint": "^1.1.0", "gulp-nodemon": "^2.0.3", "gulp-notify": "^2.2.0", "gulp-plumber": "^1.0.1", diff --git a/public/css/lib/Vimeo.css b/public/css/Vimeo.css similarity index 100% rename from public/css/lib/Vimeo.css rename to public/css/Vimeo.css 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/public/js/calculator.js b/public/js/calculator.js index 207611c9e6..9ae06e890a 100644 --- a/public/js/calculator.js +++ b/public/js/calculator.js @@ -28,7 +28,7 @@ $(document).ready(function () { $('#chosen').text('Coming from ' + city.replace(/-/g, ' ').replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }) + ', and making $' + lastYearsIncome.toString().replace(/0000$/, '0,000') + ', your true costs will be:'); - var categoryNames = ['Lost Wages', 'Financing Cost', 'Housing Cost', 'Tuition / Wage Garnishing']; + var categoryNames = ['Lost Wages', 'Financing Cost', 'Housing Cost', 'Tuition / Est. Wage Garnishing']; bootcamps.forEach(function (camp) { var x0 = 0; if (camp.cities.indexOf(city) > -1) { @@ -38,7 +38,7 @@ $(document).ready(function () { } camp.mapping = [{ name: camp.name, - label: 'Tuition / Wage Garnishing', + label: 'Tuition / Est. Wage Garnishing', value: +camp.cost, x0: x0, x1: x0 += +camp.cost diff --git a/public/js/lib/chai/chai.js b/public/js/lib/chai/chai.js index 77451223e0..4191939dfa 100644 --- a/public/js/lib/chai/chai.js +++ b/public/js/lib/chai/chai.js @@ -1,5 +1,5 @@ -;(function(){ +(function(){ /** * Require the module at `name`. @@ -4797,4 +4797,4 @@ } else { (this || window)["chai"] = require("chai"); } -})() \ No newline at end of file +})(); diff --git a/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.9.js b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.9.js deleted file mode 100644 index 4726dc2192..0000000000 --- a/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.9.js +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Created by nathanleniz on 2/2/15. - */ - -var widgets = []; -var editor = CodeMirror.fromTextArea(document.getElementById("codeEditor"), { - lineNumbers: true, - mode: "text/html", - theme: 'monokai', - runnable: true, - matchBrackets: true, - autoCloseBrackets: true, - scrollbarStyle: 'null', - lineWrapping: true, - gutters: ["CodeMirror-lint-markers"], - onKeyEvent: doLinting -}); - -var defaultKeymap = { - 'Cmd-E': 'emmet.expand_abbreviation', - 'Tab': 'emmet.expand_abbreviation_with_tab', - 'Enter': 'emmet.insert_formatted_line_break_only' -}; - -emmetCodeMirror(editor, defaultKeymap); - - -// Hijack tab key to insert two spaces instead -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); - } - } -}); - -editor.setSize("100%", "auto"); - -var libraryIncludes = "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; - - -var editorValueForIFrame; -var iFrameScript = ""; - -var delay; -// Initialize CodeMirror editor with a nice html5 canvas demo. -editor.on("keyup", function () { - clearTimeout(delay); - delay = setTimeout(updatePreview, 300); -}); - -var nodeEnv = prodOrDev === 'production' ? 'http://www.freecodecamp.com' : 'http://localhost:3001'; -function updatePreview() { - editorValueForIFrame = editor.getValue(); - var failedCommentTest = false; - if(editorValueForIFrame.match(/\<\!\-\-/gi) && editorValueForIFrame.match(/\-\-\>/gi) == null){ - failedCommentTest = true; - } - else if(editorValueForIFrame.match(/\<\!\-\-/gi) && editorValueForIFrame.match(/\<\!\-\-/gi).length > editorValueForIFrame.match(/\-\-\>/gi).length){ - failedCommentTest = true; - } - if(failedCommentTest){ - editor.setValue(editor.getValue()+ "-->"); - editorValueForIFrame = editorValueForIFrame + "-->"; - } - goodTests = 0; - var previewFrame = document.getElementById('preview'); - var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; - preview.open(); - $('#testSuite').empty(); - preview.write(libraryIncludes + editor.getValue() + iFrameScript); - codeStorage.updateStorage(); - preview.close(); - -} -setTimeout(updatePreview, 300); - -/** - * "post" methods - */ - -var testResults = []; -var postSuccess = function(data) { - var testDoc = document.createElement("div"); - $(testDoc) - .html("
" + JSON.parse(data) + "
"); - $('#testSuite').append(testDoc); - testSuccess(); -}; - -var postError = function(data) { - var testDoc = document.createElement("div"); - $(testDoc) - .html("
" + JSON.parse(data) + "
"); - $('#testSuite').append(testDoc); -}; -var goodTests = 0; -var testSuccess = function() { - goodTests++; - if (goodTests === tests.length) { - showCompletion(); - } -}; - -function doLinting () { - editor.operation(function () { - for (var i = 0; i < widgets.length; ++i) - editor.removeLineWidget(widgets[i]); - widgets.length = 0; - JSHINT(editor.getValue()); - for (var i = 0; i < JSHINT.errors.length; ++i) { - var err = JSHINT.errors[i]; - if (!err) continue; - var msg = document.createElement("div"); - var icon = msg.appendChild(document.createElement("span")); - icon.innerHTML = "!!"; - icon.className = "lint-error-icon"; - msg.appendChild(document.createTextNode(err.reason)); - msg.className = "lint-error"; - widgets.push(editor.addLineWidget(err.line - 1, msg, { - coverGutter: false, - noHScroll: true - })); - } - }); -}; - -//$('#testSuite').empty(); -function showCompletion() { - var time = Math.floor(Date.now()) - started; - ga('send', 'event', 'Challenge', 'solved', challenge_Name + ', Time: ' + time); - $('#next-courseware-button').removeAttr('disabled'); - $('#next-courseware-button').addClass('animated tada'); - if (!userLoggedIn) { - $('#complete-courseware-dialog').modal('show'); - } - $('body').keydown(function(e) { - if (e.ctrlKey && e.keyCode == 13) { - $('#next-courseware-button').click(); - $('#next-courseware-button').unbind('click'); - } - }); -} - -/* - Local Storage Update System By Andrew Cay(Resto) - codeStorage: singleton object that contains properties and methods related to - dealing with the localStorage system. - The keys work off of the variable challenge_name to make unique identifiers per bonfire - - Two extra functionalities: - Added anonymous version checking system incase of future updates to the system - Added keyup listener to editor(myCodeMirror) so the last update has been saved to storage - */ -var codeStorage = { - version: 0.01, - keyVersion:"saveVersion", - keyValue: null,//where the value of the editor is saved - updateWait: 2000,// 2 seconds - updateTimeoutId: null, - eventArray: []//for firing saves -}; -// Returns true if the editor code was saved since last key press (use this if you want to make a "saved" notification somewhere") -codeStorage.hasSaved = function(){ - return ( updateTimeoutId === null ); -}; -codeStorage.onSave = function(func){ - codeStorage.eventArray.push(func); -}; -codeStorage.setSaveKey = function(key){ - codeStorage.keyValue = key + 'Val'; -}; -codeStorage.getEditorValue = function(){ - return ('' + localStorage.getItem(codeStorage.keyValue)); -}; - -codeStorage.isAlive = function() { - var val = this.getEditorValue() - return val !== 'null' && - val !== 'undefined' && - (val && val.length > 0); -} -codeStorage.updateStorage = function(){ - if(typeof(Storage) !== undefined) { - var value = editor.getValue(); - localStorage.setItem(codeStorage.keyValue, value); - } else { - var debugging = false; - if( debugging ){ - console.log('no web storage'); - } - } - codeStorage.updateTimeoutId = null; - codeStorage.eventArray.forEach(function(func){ - func(); - }); -}; -//Update Version -(function(){ - var savedVersion = localStorage.getItem('saveVersion'); - if( savedVersion === null ){ - localStorage.setItem(codeStorage.keyVersion, codeStorage.version);//just write current version - }else{ - if( savedVersion !== codeStorage.version ){ - //Update version - } - } -})(); - - - -///Set everything up one page -/// Update local save when editor has changed -codeStorage.setSaveKey(challenge_Name); -editor.on('keyup', function(){ - window.clearTimeout(codeStorage.updateTimeoutId); - codeStorage.updateTimeoutId = window.setTimeout(codeStorage.updateStorage, codeStorage.updateWait); -}); - -var editorValue; - - -var challengeSeed = challengeSeed || null; -var tests = tests || []; - - -var allSeeds = ''; -(function() { - challengeSeed.forEach(function(elem) { - allSeeds += elem + '\n'; - }); -})(); - -editorValue = (codeStorage.isAlive())? codeStorage.getEditorValue() : allSeeds; - -editor.setValue(editorValue); -editor.refresh(); - -var resetEditor = function resetEditor() { - editor.setValue(allSeeds); - updatePreview(); - codeStorage.updateStorage(); -}; -/* -var challengeSeed = challengeSeed || null; -var allSeeds = ''; -(function() { - challengeSeed.forEach(function(elem) { - allSeeds += elem.replace(/fccss/g, '') + '\n'; - }); - editor.setValue(allSeeds); - (function() { - setTimeout(function() { - editor.refresh(); - }, 200); - })(); -})(); -*/ diff --git a/public/js/lib/coursewares/coursewaresJSFramework_0.0.6.js b/public/js/lib/coursewares/coursewaresJSFramework_0.0.6.js deleted file mode 100644 index ddeb9519f4..0000000000 --- a/public/js/lib/coursewares/coursewaresJSFramework_0.0.6.js +++ /dev/null @@ -1,394 +0,0 @@ -var widgets = []; -var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("codeEditor"), { - lineNumbers: true, - mode: "javascript", - theme: 'monokai', - runnable: true, - lint: true, - matchBrackets: true, - autoCloseBrackets: true, - scrollbarStyle: 'null', - lineWrapping: true, - gutters: ["CodeMirror-lint-markers"], - onKeyEvent: doLinting -}); -var editor = myCodeMirror; -editor.setSize("100%", "auto"); - -// Hijack tab key to enter two spaces intead -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(); - return false; - } -}); - - -var attempts = 0; -if (attempts) { - attempts = 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); - -function doLinting() { - editor.operation(function() { - for (var i = 0; i < widgets.length; ++i) - editor.removeLineWidget(widgets[i]); - widgets.length = 0; - JSHINT(editor.getValue()); - for (var i = 0; i < JSHINT.errors.length; ++i) { - var err = JSHINT.errors[i]; - if (!err) continue; - var msg = document.createElement("div"); - var icon = msg.appendChild(document.createElement("span")); - icon.innerHTML = "!!"; - icon.className = "lint-error-icon"; - msg.appendChild(document.createTextNode(err.reason)); - msg.className = "lint-error"; - widgets.push(editor.addLineWidget(err.line - 1, msg, { - coverGutter: false, - noHScroll: true - })); - } - }); -} - -$('#submitButton').on('click', function() { - bonfireExecute(); -}); - -function bonfireExecute() { - attempts++; - ga('send', 'event', 'Challenge', 'ran-code', challenge_Name); - userTests = null; - $('#codeOutput').empty(); - var userJavaScript = myCodeMirror.getValue(); - var failedCommentTest = false; - if(userJavaScript.match(/\/\*/gi) && userJavaScript.match(/\*\//gi) == null){ - failedCommentTest = true; - } - else if(!failedCommentTest && userJavaScript.match(/\/\*/gi) && userJavaScript.match(/\/\*/gi).length > userJavaScript.match(/\*\//gi).length){ - failedCommentTest = true; - } - userJavaScript = removeComments(userJavaScript); - userJavaScript = scrapeTests(userJavaScript); - // simple fix in case the user forgets to invoke their function - - submit(userJavaScript, function(cls, message) { - if(failedCommentTest){ - myCodeMirror.setValue(myCodeMirror.getValue() + "*/"); - console.log('Caught Unfinished Comment'); - codeOutput.setValue("Unfinished mulit-line comment"); - failedCommentTest = false; - } - else if (cls) { - codeOutput.setValue(message.error); - runTests('Error', null); - } else { - codeOutput.setValue(message.output); - codeOutput.setValue(codeOutput.getValue().replace(/\\\"/gi,'')); - message.input = removeLogs(message.input); - runTests(null, message); - } - }); -} - - -var userTests; -var testSalt = Math.random(); - - -var scrapeTests = function(userJavaScript) { - - // insert tests from mongo - for (var i = 0; i < tests.length; i++) { - userJavaScript += '\n' + tests[i]; - } - - var counter = 0; - var regex = new RegExp( - /(expect(\s+)?\(.*\;)|(assert(\s+)?\(.*\;)|(assert\.\w.*\;)|(.*\.should\..*\;)/ - ); - var match = regex.exec(userJavaScript); - while (match != null) { - var replacement = '//' + counter + testSalt; - userJavaScript = userJavaScript.substring(0, match.index) + replacement + - userJavaScript.substring(match.index + match[0].length); - - if (!userTests) { - userTests = []; - } - userTests.push({ - "text": match[0], - "line": counter, - "err": null - }); - counter++; - match = regex.exec(userJavaScript); - } - - return userJavaScript; -}; - -function removeComments(userJavaScript) { - var regex = new RegExp(/(\/\*[^(\*\/)]*\*\/)|\/\/[^\n]*/g); - return userJavaScript.replace(regex, ''); -} - -function removeLogs(userJavaScript) { - return userJavaScript.replace(/(console\.[\w]+\s*\(.*\;)/g, ''); -} - -var pushed = false; -var createTestDisplay = function() { - if (pushed) { - userTests.pop(); - } - for (var i = 0; i < userTests.length; i++) { - var test = userTests[i]; - var testDoc = document.createElement("div"); - if (test.err != null) { - console.log('Should be displaying bad tests'); - $(testDoc) - .html( - "
" + - test.text + "
" + - test.err + "
") - .appendTo($('#testSuite')); - } else { - $(testDoc) - .html( - "
" + - test.text + "
") - .appendTo($('#testSuite')); - } - }; -}; - -var expect = chai.expect; -var assert = chai.assert; -var should = chai.should(); - - -var reassembleTest = function(test, data) { - var lineNum = test.line; - var regexp = new RegExp("\/\/" + lineNum + testSalt); - return data.input.replace(regexp, test.text); -}; - -var runTests = function(err, data) { - var allTestsPassed = true; - pushed = false; - $('#testSuite').children().remove(); - if (err && userTests.length > 0) { - userTests = [{ - text: "Program Execution Failure", - err: "No user tests were run." - }]; - createTestDisplay(); - } - //Add blocks to test exploits here! - else if(editorValue.match(/if\s\(null\)\sconsole\.log\(1\);/gi)){ - allTestsPassed = false; - userTests = [{ - text: "Program Execution Failure", - err: "Invalid if (null) console.log(1); detected" - }]; - createTestDisplay(); - } - else if (userTests) { - userTests.push(false); - pushed = true; - userTests.forEach(function(chaiTestFromJSON, indexOfTestArray, - __testArray) { - try { - if (chaiTestFromJSON) { - var output = eval(reassembleTest(chaiTestFromJSON, data)); - } - } catch (error) { - allTestsPassed = false; - __testArray[indexOfTestArray].err = error.message; - } finally { - if (!chaiTestFromJSON) { - createTestDisplay(); - } - } - }); - - if (allTestsPassed) { - allTestsPassed = false; - showCompletion(); - } - - } -}; - -function showCompletion() { - var time = Math.floor(Date.now()) - started; - ga('send', 'event', 'Challenge', 'solved', challenge_Name + ', Time: ' + time + - ', Attempts: ' + attempts); - var bonfireSolution = myCodeMirror.getValue(); - var didCompleteWith = $('#completed-with').val() || null; - $.post( - '/completed-bonfire/', { - challengeInfo: { - challengeId: challenge_Id, - challengeName: challenge_Name, - completedWith: didCompleteWith, - challengeType: challengeType, - solution: bonfireSolution - } - }, - function(res) { - if (res) { - $('#complete-courseware-dialog').modal('show'); - $('#complete-courseware-dialog').keydown(function(e) { - if (e.ctrlKey && e.keyCode == 13) { - $('#next-courseware-button').click(); - } - }); - } - } - ); - -} - - -/* - Local Storage Update System By Andrew Cay(Resto) - codeStorage: singleton object that contains properties and methods related to - dealing with the localStorage system. - The keys work off of the variable challenge_name to make unique identifiers per bonfire - - Two extra functionalities: - Added anonymous version checking system incase of future updates to the system - Added keyup listener to editor(myCodeMirror) so the last update has been saved to storage - */ -var codeStorage = { - version: 0.01, - keyVersion:"saveVersion", - keyValue: null,//where the value of the editor is saved - updateWait: 2000,// 2 seconds - updateTimeoutId: null, - eventArray: []//for firing saves -}; -// Returns true if the editor code was saved since last key press (use this if you want to make a "saved" notification somewhere") -codeStorage.hasSaved = function(){ - return ( updateTimeoutId === null ); -}; -codeStorage.onSave = function(func){ - codeStorage.eventArray.push(func); -}; -codeStorage.setSaveKey = function(key){ - codeStorage.keyValue = key + 'Val'; -}; -codeStorage.getEditorValue = function(){ - return ('' + localStorage.getItem(codeStorage.keyValue)); -}; - -codeStorage.isAlive = function() { - var val = this.getEditorValue() - return val !== 'null' && - val !== 'undefined' && - (val && val.length > 0); -} -codeStorage.updateStorage = function(){ - if(typeof(Storage) !== undefined) { - var value = editor.getValue(); - localStorage.setItem(codeStorage.keyValue, value); - } else { - var debugging = false; - if( debugging ){ - console.log('no web storage'); - } - } - codeStorage.updateTimeoutId = null; - codeStorage.eventArray.forEach(function(func){ - func(); - }); -}; -//Update Version -(function(){ - var savedVersion = localStorage.getItem('saveVersion'); - if( savedVersion === null ){ - localStorage.setItem(codeStorage.keyVersion, codeStorage.version);//just write current version - }else{ - if( savedVersion !== codeStorage.version ){ - //Update version - } - } -})(); - - - -///Set everything up one page -/// Update local save when editor has changed -codeStorage.setSaveKey(challenge_Name); -editor.on('keyup', function(){ - window.clearTimeout(codeStorage.updateTimeoutId); - codeStorage.updateTimeoutId = window.setTimeout(codeStorage.updateStorage, codeStorage.updateWait); -}); - -var editorValue; - - -var challengeSeed = challengeSeed || null; -var tests = tests || []; - - -var allSeeds = ''; -(function() { - challengeSeed.forEach(function(elem) { - allSeeds += elem + '\n'; - }); -})(); - -editorValue = (codeStorage.isAlive())? codeStorage.getEditorValue() : allSeeds; - -myCodeMirror.setValue(editorValue); - -var resetEditor = function resetEditor() { - editor.setValue(allSeeds); - codeStorage.updateStorage(); -}; - -$(document).ready(function(){ - bonfireExecute(); -}); diff --git a/public/js/lib/coursewares/sandbox.js b/public/js/lib/coursewares/sandbox.js deleted file mode 100644 index 55c80ea99d..0000000000 --- a/public/js/lib/coursewares/sandbox.js +++ /dev/null @@ -1,87 +0,0 @@ -var printCallback; -// sends the input to the plugin for evaluation -var submit = function(code,callback) { - printCallback = callback; - // postpone the evaluation until the plugin is initialized - plugin.whenConnected( - function() { - if (requests == 0) { - startLoading(); - } - - requests++; - plugin.remote.run(code); - } - ); -}; - -// puts the message on the terminal -var print = function(cls, msg) { - printCallback(cls,msg); -}; - - -// will restart the plugin if it does not respond -var disconnectTimeout = null; -var startLoading = function() { - disconnectTimeout = setTimeout(disconnect, 3000); -}; - -var endLoading = function() { - clearTimeout(disconnectTimeout); -}; - -var disconnect = function() { - plugin.disconnect(); -}; - - -// interface provided to the plugin -var api = { - output: function(data) { - endLoading(); - //print('input', data.input); - if (data.error) { - print('Error', data); - reset(); - } else { - print(null, data); - reset(); - } - } -}; - - -// obtaining absolute path of this script -var scripts = document.getElementsByTagName('script'); -var path = scripts[scripts.length-1].src - .split('?')[0] - .split('/') - .slice(0, -1) - .join('/')+'/'; - - - -var requests; - -// (re)initializes the plugin -var reset = function() { - requests = 0; - plugin = new jailed.Plugin(path+'plugin_v0.1.5.js', api); - plugin.whenDisconnected( function() { - // give some time to handle the last responce - setTimeout( function() { - endLoading(); - console.log("resetting on fatal plugin error"); - codeOutput.setValue("Sorry, your code is either too slow, has a fatal error, or contains an infinite loop."); - reset(); - }, 10); - }); -}; - - - -// initialize everything -var plugin = null; - -reset(); diff --git a/public/json/bootcamps.json b/public/json/bootcamps.json index 41b906c20b..19b016607c 100644 --- a/public/json/bootcamps.json +++ b/public/json/bootcamps.json @@ -221,7 +221,28 @@ "cities": [ "portland" ] -}, { +}, + { + "name": "Viking Code School", + "cost": "18000", + "housing": "0", + "finance": false, + "weeks": "16", + "cities": [ + "online" + ] + }, + { + "name": "App Academy", + "cost": "18000", + "housing": "500", + "finance": false, + "weeks": "12", + "cities": [ + "san-francisco" + ] + }, + { "name": "Turing School", "cost": "17500", "housing": "400", @@ -230,13 +251,4 @@ "cities": [ "denver" ] -}, { - "name": "Free Code Camp", - "cost": "0", - "housing": "0", - "finance": false, - "weeks": "0", - "cities": [ - "online" - ] }] 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 62a5f2cd3c..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);", @@ -80,10 +80,10 @@ "sym([1, 2, 3], [5, 2, 1, 4]);" ], "tests": [ - "assert.deepEqual(sym([1, 2, 3], [5, 2, 1, 4]), [3, 5, 4], 'should return an array of unique values');", - "assert.deepEqual(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'should return the symmetric difference of the given arrays');", - "assert.deepEqual(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'should return an array of unique values');", - "assert.deepEqual(sym([1, 1]), [1], 'should return an array of unique values');" + "assert.sameMembers(sym([1, 2, 3], [5, 2, 1, 4]), [3, 5, 4], 'should return an array of unique values');", + "assert.sameMembers(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'should return the symmetric difference of the given arrays');", + "assert.sameMembers(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'should return an array of unique values');", + "assert.sameMembers(sym([1, 1]), [1], 'should return an array of unique values');" ], "MDNlinks": [ "Array.reduce()", @@ -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/automated-testing-and-debugging.json b/seed/challenges/automated-testing-and-debugging.json index 9cf677a024..2fbb5352d7 100644 --- a/seed/challenges/automated-testing-and-debugging.json +++ b/seed/challenges/automated-testing-and-debugging.json @@ -28,9 +28,9 @@ "title":"Using typeof", "difficulty":0, "description":[ - "typeof is a useful method that we can use to check the type of a variable.", - "One thing to be careful of is that an array has the type objects.", - "Try using each of these to see the types they have.", + "You can use typeof to check the data structure, or type, of a variable.", + "Note that in JavaScript, arrays are technically a type of object.", + "Try using typeof on each of the following to see which types they have.", "console.log(typeof(\"\"));", "console.log(typeof(0));", "console.log(typeof([]));", diff --git a/seed/challenges/basejumps.json b/seed/challenges/basejumps.json index fcad55c0d9..26f091cbcb 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", @@ -54,7 +54,7 @@ "Run the following command in a Cloud9 terminal prompt tab: npm install grunt-contrib-imagemin --save-dev && npm install --save-dev && heroku login. At this point, the terminal will prompt you to log in to Heroku from the command line.", "Now run yo angular-fullstack:heroku. You can choose a name for your Heroku project, or Heroku will create a random one for you. You can choose whether you want to deploy to servers the US or the EU.", "Set the config flag for your Heroku environment and add MongoLab for your MongoDB instance by running the following command: cd ~/workspace/dist && heroku config:set NODE_ENV=production && heroku addons:create mongolab.", - "As you build your app, you should frequently commit changes to your codebase. Make sure you're in the ~/workspace directory by running cd ~/workspace. Then you can this code to stage the changes to your changes and commit them: git commit -am \"your commit message\". Note that you should replace \"your commit message\" with a short summary of the changes you made to your code, such as \"added a records controller and corresponding routes\".", + "As you build your app, you should frequently commit changes to your codebase. Make sure you're in the ~/workspace directory by running cd ~/workspace. Then you can use this code to stage the changes to your changes and commit them: git commit -am \"your commit message\". Note that you should replace \"your commit message\" with a short summary of the changes you made to your code, such as \"added a records controller and corresponding routes\".", "You can push these new commits to GitHub by running git push origin master, and to Heroku by running grunt --force && grunt buildcontrol:heroku.", "If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.", "Now you're ready to move on to your first Basejump. Click the \"I've completed this challenge\" and move on." @@ -79,12 +79,12 @@ "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", "challengeType": 4, @@ -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 6f1cf7b9d4..cbcdbd1b83 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,25 +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);" + "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" @@ -132,17 +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(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) {", @@ -178,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()", @@ -217,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()" @@ -258,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) {", @@ -266,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');", - "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,39,1001]);", - "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));" + "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" @@ -295,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) {", @@ -304,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()" @@ -335,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) {", @@ -343,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" @@ -371,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) {", @@ -381,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()" @@ -411,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) {", @@ -419,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()" @@ -449,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) {", @@ -457,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 when n < 1');", - "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array when n >= array.length');" + "assert.deepEqual(slasher([1, 2, 3], 2), [3], '[1, 2, 3], 2, [3] should return [3].');", + "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], '[1, 2, 3], 0 should return [1, 2, 3].');", + "assert.deepEqual(slasher([1, 2, 3], 9), [], '[1, 2, 3], 9 should return [].');" ], "MDNlinks": [ "Array.slice()", @@ -487,26 +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;" + "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()" @@ -526,12 +531,12 @@ }, { "id": "adf08ec01beb4f99fc7a68f2", - "title": "Falsey Bouncer", + "title": "Falsy Bouncer", "difficulty": "1.50", "description": [ - "Remove all falsey values from an array.", - "Falsey values in javascript are false, null, 0, \"\", undefined, and NaN.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "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." ], "challengeSeed": [ "function bouncer(arr) {", @@ -539,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 falsey values');", - "assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');", - "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');" + "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", @@ -563,52 +568,13 @@ "namePt": "", "descriptionPt": [] }, - { - "id": "a8e512fbe388ac2f9198f0fa", - "title": "Where art thou", - "difficulty": "1.55", - "description": [ - "Make a function that looks through an array (first argument) and returns an array of all objects that have equivalent property values (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');" - ], - "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) {", @@ -616,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", @@ -649,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) {", @@ -657,14 +623,18 @@ " return num;", "}", "", - "where([40, 60], 50);" + "where([40, 60], 50, \"\");" ], "MDNlinks": [ "Array.sort()" ], "tests": [ - "expect(where([10, 20, 30, 40, 50], 35)).to.equal(3);", - "expect(where([10, 20, 30, 40, 50], 30)).to.equal(2);" + "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 348cd4b189..e3542ee41d 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -13,12 +13,13 @@ "// This is a comment.", "The slash-star-star-slash comment will comment out everything between the /* and the */ characters:", "/* This is also a comment */", - "Try creating one of each." + "Try creating one of each.", + "And one more thing you need to notice. Starting at this waypoint in JavaScript related challenges (except AngularJS, all Ziplines, Git, Node.js and Express.js, MongoDB and Full Stack JavaScript Projects) you can see contents of assert() functions (in some challenges except(), assert.equal() and so on) which are used to test your code. It's part of these challenges that you are able to see the tests that are running against your code." ], "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(/(\\*\\/)/g), 'Make sure that you close the comment with a \\*\/');" + "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":[ ], @@ -41,7 +42,7 @@ "challengeSeed": [ "function welcomeToBooleans() {", "", - "// don't change code above here", + "// Only change code below this line.", "", " return false;", "", @@ -65,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\";", @@ -75,7 +76,7 @@ "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", "", - "if(typeof(myName) !== \"undefined\"){(function(v){return(v);})(myName);}" + "if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}" ], "type": "waypoint", "challengeType": 1 @@ -89,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\";", "", @@ -101,7 +102,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return(myFirstName + ', ' + myLastName);})();}" + "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return myFirstName + ', ' + myLastName;})();}" ], "type": "waypoint", "challengeType": 1 @@ -111,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;", @@ -128,7 +129,7 @@ "", "var lastName = \"Lovelace\";", "", - "// don't change code above here", + "// Only change code below this line.", "", "lastNameLength = lastName;", "", @@ -137,7 +138,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "if(typeof(lastNameLength) !== \"undefined\"){(function(){return(lastNameLength);})();}" + "if(typeof(lastNameLength) !== \"undefined\"){(function(){return lastNameLength;})();}" ], "type": "waypoint", "challengeType": 1 @@ -154,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 = \"\";", @@ -172,7 +173,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(v){return(v);})(firstLetterOfLastName);" + "(function(v){return v;})(firstLetterOfLastName);" ], "type": "waypoint", "challengeType": 1 @@ -188,7 +189,7 @@ "Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "assert(thirdLetterOfLastName === 'v', 'The third last letter of lastName should be a \"v\"');" + "assert(thirdLetterOfLastName === 'v', 'The third letter of lastName should be a \"v\".');" ], "challengeSeed": [ "var firstName = \"Ada\";", @@ -203,7 +204,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(v){return(v);})(thirdLetterOfLastName);" + "(function(v){return v;})(thirdLetterOfLastName);" ], "type": "waypoint", "challengeType": 1 @@ -219,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), '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\";", @@ -235,7 +236,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(v){return(v);})(lastLetterOfLastName);" + "(function(v){return v;})(lastLetterOfLastName);" ], "type": "waypoint", "challengeType": 1 @@ -248,11 +249,11 @@ "In order to get the last letter of a string, you can subtract one from the string's length.", "For example, you can get the value of the third-to-last letter of the var firstName = \"Charles\" string by using firstName[firstName.length - 3].", "Use bracket notation to find the second-to-last character in the lastName string.", - "Try looking at the lastLetterOfLastName variable declaration if you get stuck." + "Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "assert(secondToLastLetterOfLastName === 'c', 'secondToLastLetterOfLastName should be \"c\".');", - "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the third last letter.');" + "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": [ "var firstName = \"Ada\";", @@ -267,7 +268,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(v){return(v);})(secondToLastLetterOfLastName);" + "(function(v){return v;})(secondToLastLetterOfLastName);" ], "type": "waypoint", "challengeType": 1 @@ -282,7 +283,7 @@ "Replace the 0 with the correct number so you can get the result mentioned in the comment." ], "tests": [ - "assert((function(){if(sum === 20 && editor.getValue().match(/\\+/g)){return(true);}else{return(false);}})(), 'Make the variable sum equal 20');" + "assert((function(){if(sum === 20 && editor.getValue().match(/\\+/g).length >= 2){return true;}else{return false;}})(), 'Make the variable sum equal 20.');" ], "challengeSeed": [ "var sum = 10 + 0; //make this equal to 20 by changing the 0 into the appropriate number.", @@ -290,7 +291,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(z){return('sum='+z);})(sum);" + "(function(z){return 'sum='+z;})(sum);" ], "type": "waypoint", "challengeType": 1 @@ -301,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.", @@ -313,7 +314,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(z){return('difference='+z);})(difference);" + "(function(z){return 'difference='+z;})(difference);" ], "type": "waypoint", "challengeType": 1 @@ -324,19 +325,19 @@ "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.');" + "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.", "// You'll learn about functions soon.", - "(function(z){return('product='+z);})(product);" + "(function(z){return 'product='+z;})(product);" ], "type": "waypoint", "challengeType": 1 @@ -347,11 +348,11 @@ "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": [ - "assert((function(){if(quotient === 2 && editor.getValue().match(/\\//g)){return(true);}else{return(false);}})(), 'Make the variable quotient equal 2.');" + "assert((function(){if(quotient === 2 && editor.getValue().match(/var\\s*?quotient\\s*?\\=\\s*?\\d+\\s*?\\/\\s*?\\d+\\s*?;/g)){return true;}else{return false;}})(), 'Make the variable quotient equal 2.');" ], "challengeSeed": [ "var quotient = 66 / 0; //make this equal to 2 by changing the 0 into the appropriate number.", @@ -359,7 +360,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(z){return('quotient='+z);})(quotient);" + "(function(z){return 'quotient='+z;})(quotient);" ], "type": "waypoint", "challengeType": 1 @@ -373,7 +374,7 @@ "Let's create a variable myDecimal and give it a decimal value." ], "tests": [ - "assert((function(){if(typeof(myDecimal) !== \"undefined\" && typeof(myDecimal) === \"number\" && editor.getValue().match(/\\./g).length >=2){return(true);}else{return(false);}})(), 'myDecimal should be a decimal point number.');" + "assert((function(){if(typeof(myDecimal) !== \"undefined\" && typeof(myDecimal) === \"number\" && editor.getValue().match(/\\./g).length >=2){return true;}else{return false;}})(), 'myDecimal should be a decimal point number.');" ], "challengeSeed": [ "// var ourDecimal = 5.7;", @@ -384,7 +385,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(){if(typeof(myDecimal) !== \"undefined\"){return(myDecimal);}})();" + "(function(){if(typeof(myDecimal) !== \"undefined\"){return myDecimal;}})();" ], "type": "waypoint", "challengeType": 1 @@ -398,8 +399,8 @@ "Replace the 0.0 with the correct number so that you get the result mentioned in the comments." ], "tests": [ - "assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return(true);}else{return(false);}})(), 'Make the variable product equal 5.0.');", - "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return(true);}else{return(false);}})(), 'Make the variable quotient equal 2.2.');" + "assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'Make the variable product equal 5.0.');", + "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return true;}else{return false;}})(), 'Make the variable quotient equal 2.2.');" ], "challengeSeed": [ "var quotient = 4.4 / 2.0; // equals 2.2", @@ -409,7 +410,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(y){return('product='+y);})(product);" + "(function(y){return 'product='+y;})(product);" ], "type": "waypoint", "challengeType": 1 @@ -420,26 +421,26 @@ "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\"].", - "Now let's create a new array called myArray that contains both a string and a number.", - "Refer to the comments if you get stuck." + "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 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];", "", - "var myArray = [];", "// Only change code below this line.", "", + "var myArray = [];", "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(z){return(z);})(myArray);" + "(function(z){return z;})(myArray);" ], "type": "waypoint", "challengeType": 1 @@ -449,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":[ @@ -457,14 +458,14 @@ ], "challengeSeed":[ "var ourArray = [[\"the universe\", \"everything\", 42]];", - "var myArray = [];", "// Only change code below this line.", "", + "var myArray = [];", "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}" + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" ], "type": "waypoint", "challengeType": 1 @@ -483,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.", @@ -496,7 +497,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z));})(myArray, myData);}" + "if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}" ], "type": "waypoint", "challengeType": 1 @@ -513,8 +514,8 @@ "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(/[0]/g).length >= 1 && editor.getValue().match(/=/g).length >= 2){return(true);}else{return(false);}})(), 'You should be using indexes to modify the values 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];", @@ -527,7 +528,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}" + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" ], "type": "waypoint", "challengeType": 1 @@ -540,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.", @@ -561,7 +562,7 @@ "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);" + "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);" ], "type": "waypoint", "challengeType": 1 @@ -572,27 +573,27 @@ "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.", "", "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);" + "(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);" ], "type": "waypoint", "challengeType": 1 @@ -603,27 +604,27 @@ "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." + "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 first two values left([\"John\", 23])');", - "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.", "", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);" + "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z);})(myArray, myRemoved);" ], "type": "waypoint", "challengeType": 1 @@ -633,29 +634,29 @@ "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 end: \"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(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]])');" + "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]]).');" ], "challengeSeed": [ "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", "ourArray.shift();", - "ourArray.unshift([\"happy\", \"joy\"]);", - "// ourArray now equals [[\"happy\", \"joy\"], \"J\", [\"cat\"]]", + "// ourArray now equals [\"happy\", \"J\", [\"cat\"]]", + "ourArray.unshift(\"happy\");", "", "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.", "", "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", "// You'll learn about functions soon.", - "(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);" + "(function(y, z){return 'myArray = ' + JSON.stringify(y);})(myArray);" ], "type": "waypoint", "challengeType": 1 @@ -665,28 +666,29 @@ "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) {", - "  return(a + b);", + "function functionName(a, b) {", + "  return a + b;", "}", - "We can \"call\" our function like this: functionName();, and it will run and return it's return value to us.", - "Create and call a function called myFunction." + "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.", + "// Create a function called myFunction that returns the value of a plus b.", + "// Only change code below this line.", "", "", "", @@ -696,7 +698,7 @@ "// You'll learn about functions soon.", "if(typeof(myFunction) !== \"undefined\"){", "var f=myFunction(a,b);", - "(function(){return(f);})();", + "(function(){return f;})();", "}" ], "type": "waypoint", @@ -717,24 +719,24 @@ " \"enemies\": [\"Water\", \"Dogs\"]", "};", "", - "Objects are useful for storing data in a structured way, and can represents real world objects, like a cats.", - "Let's try to make an Object that represents a dog called myDog!" + "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)!" ], "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.", @@ -745,7 +747,7 @@ "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", - "(function(z){return(z);})(myDog);" + "(function(z){return z;})(myDog);" ], "type": "waypoint", "challengeType": 1 @@ -759,12 +761,12 @@ "For example, we can add properties to objects like this:", "myObject.myProperty = \"myValue\";", "We can also delete them like this:", - "delete(myObject.myProperty);", - "Let's add the property \"bark\", and delete the property \"tails\"." + "delete myObject.myProperty;", + "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 = {", @@ -774,8 +776,8 @@ "// \"friends\": [\"everything!\"]", "// };", "", - "// ourDog.bark(\"arf!\");", - "// delete(ourDog.tails);", + "// ourDog.bark = \"arf!\";", + "// delete ourDog.tails;", "", "var myDog = {", " \"name\": \"Camper\",", @@ -794,7 +796,7 @@ "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", - "(function(z){return(z);})(myDog);" + "(function(z){return z;})(myDog);" ], "type": "waypoint", "challengeType": 1 @@ -814,13 +816,24 @@ "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 = [];", + "for(var i = 0; i < 5; i++){", + " ourArray.push(i);", + "}", "var myArray = [];", - "//Push the numbers zero through four to myArray using a \"for loop\" like above.", "", + "// Only change code below this line.", + "", + "// Push the numbers zero through four to myArray using a \"for loop\" like above.", + "", + "// Only change code above this line.", + "// We use this function to show you the value of your variable in your output box.", + "// You'll learn about functions soon.", + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}", "" ], "type": "waypoint", @@ -839,16 +852,22 @@ "  ourArray.push(i);", "  i++;", "}", - "Let's try getting a for loop to work by pushing values to an array." + "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 = [];", - "//Push the numbers zero through four to myArray", + "// Only change code below this line.", "", + "// Push the numbers zero through four to myArray using a \"while loop\".", + "", + "// Only change code above this line.", + "// We use this function to show you the value of your variable in your output box.", + "// You'll learn about functions soon.", + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}", "" ], "type": "waypoint", @@ -864,22 +883,22 @@ "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);", + " 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.", - "(function(){return(myFunction());})();" + "(function(){return myFunction();})();" ], "type": "waypoint", "challengeType": 1 @@ -889,32 +908,32 @@ "title": "Generate Random Whole Numbers with JavaScript", "difficulty":"9.9828", "description":[ - "It's great that we can create random decimal numbers, but it's even more useful if we lot more useful 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", - "This technique gives us a whole number between zero and nine", + "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 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" + "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 but 10 to make it a number that\\'s greater then 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.", "", - " return(Math.random());", + " return Math.random();", "", " // Only change code above this line.", "}", "", "// We use this function to show you the value of your variable in your output box.", - "(function(){return(myFunction());})();" + "(function(){return myFunction();})();" ], "type": "waypoint", "challengeType": 1 @@ -926,12 +945,13 @@ "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');", "assert(myFunction() <= max, 'The random number that\\'s generated by myFunction should be less than or equal to the maximum number');", - "assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 2 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return(true);}else{return(false);}})(), 'You should be using the function given in the description to calculate the random in number in a range');" + "assert(myFunction() % 1 === 0 , 'The random number that\\'s generated by myFunction should be an integer');", + "assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 2 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'You should be using the function given in the description to calculate the random in number in a range');" ], "challengeSeed":[ "var min = 0;", @@ -940,51 +960,52 @@ " // Make myFunction return a random number between zero and nine instead of a decimal", " // Only change code below this line.", "", - " return(Math.random());", + " return Math.random();", "}", "", "// Only change code above this line.", "// We use this function to show you the value of your variable in your output box.", - "(function(){return(myFunction());})();" + "(function(){return myFunction();})();" ], "type": "waypoint", "challengeType": 1 }, { "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 {", - "  return(false);", + "  return true;", + "} 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(){if(myFunction() === \"heads\" || myFunction() === \"tails\"){return(true);}else{return(false);}})(), 'myFunction should either return heads or tails');", - "assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');", - "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');" + "assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'myFunction should either return heads or tails.');", + "assert((function(){var result = myFunction();if(result === 'heads' && flip === 0 || result === 'tails' && flip !== 0){return true;} else {return false;}})(), 'myFunction should return heads when flip equals 0 and tails when flip equals 1.');", + "assert(editor.getValue().match(/if/g).length >= 4, 'You should have created a new if statement.');", + "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement.');" ], "challengeSeed":[ + "var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", "function myFunction(){", - " var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", " // Create an if-else statement here to return \"heads\" if flip is 0. Otherwise return \"tails\".", "", " // Only change code below this line.", "", "", + "", + " // 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.", - "(function(){return(myFunction());})();" + "var result = myFunction();if(typeof(flip) !== \"undefined\" && typeof(flip) === \"number\" && typeof(result) !== \"undefined\" && typeof(result) === \"string\"){(function(y,z){return 'flip = ' + y.toString() + ', text = ' + z;})(flip, result);}" ], "type": "waypoint", "challengeType": 1 @@ -995,31 +1016,30 @@ "difficulty":"9.984", "description":[ "Regular expressions are used to find certain words or patterns inside of strings.", - "For example, if we wanted to find the number of times the word the occurred in the string The dog chased the cat, we could use the following regular expression: \/the+\/gi", + "For example, if we wanted to find the word the in the string The dog chased the cat, we could use the following regular expression: \/the\/gi", "Let's break this down a bit:", "the is the pattern we want to match.", - "+ means we want to find one or more occurrences of this pattern.", - "g means that we want to search the entire string for this pattern.", + "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 usually surrounded by / symbols.", - "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;", + " var expression = /./gi;", "", " // Only change code above this line.", " // We use this function to show you the value of your variable in your output box.", - " return(testString.match(expression).length);", - "})();(function(){return(test);})();" + " return testString.match(expression).length;", + "})();(function(){return test;})();" ], "type": "waypoint", "challengeType": 1 @@ -1031,12 +1051,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() {", @@ -1048,8 +1069,8 @@ "", " // Only change code above this line.", " // We use this function to show you the value of your variable in your output box.", - " return(testString.match(expression).length);", - "})();(function(){return(test);})();" + " return testString.match(expression).length;", + "})();(function(){return test;})();" ], "type": "waypoint", "challengeType": 1 @@ -1066,7 +1087,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(){", @@ -1078,8 +1099,8 @@ "", " // Only change code above this line.", " // We use this function to show you the value of your variable in your output box.", - " return(testString.match(expression).length);", - "})();(function(){return(test);})();" + " return testString.match(expression).length;", + "})();(function(){return test;})();" ], "type": "waypoint", "challengeType": 1 @@ -1089,12 +1110,12 @@ "title": "Invert Regular Expression Matches with JavaScript", "difficulty":"9.987", "description":[ - "Use /\\S/gi; to match everything that isn't a space in the string.", + "Use /\\S/gi to match everything that isn't a space in the string.", "You can invert any match by using the uppercase version of the selector \\s versus \\S for example." ], "tests":[ "assert(test === 49, 'Your RegEx should have found forty nine non-space characters in the testString.');", - "assert(editor.getValue().match(/\\/\\\\S\\/gi/gi), 'You should be using the following expression /\\S/gi to find non-space characters in the testString.');" + "assert(editor.getValue().match(/\\/\\\\S\\/gi/gi), 'You should be using the following expression /\\\\S/gi to find non-space characters in the testString.');" ], "challengeSeed":[ "var test = (function(){", @@ -1106,8 +1127,8 @@ "", " // Only change code above this line.", " // We use this function to show you the value of your variable in your output box.", - " return(testString.match(expression).length);", - "})();(function(){return(test);})();" + " return testString.match(expression).length;", + "})();(function(){return test;})();" ], "type": "waypoint", "challengeType":1 @@ -1120,14 +1141,14 @@ "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":[ "assert(typeof(runSlots($(\".slot\"))[0]) === \"number\", 'slotOne should be a random number.')", "assert(typeof(runSlots($(\".slot\"))[1]) === \"number\", 'slotTwo should be a random number.')", "assert(typeof(runSlots($(\".slot\"))[2]) === \"number\", 'slotThree should be a random number.')", - "assert((function(){if(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi) !== null){return(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi).length >= 3);}else{return(false);}})(), 'You should have used Math.floor(Math.random() * (3 - 1 + 1)) + 1; three times to generate your random numbers.')" + "assert((function(){if(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi) !== null){return editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi).length >= 3;}else{return false;}})(), 'You should have used Math.floor(Math.random() * (3 - 1 + 1)) + 1; three times to generate your random numbers.')" ], "challengeSeed":[ "fccss", @@ -1150,7 +1171,7 @@ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);", " }", - " return([slotOne, slotTwo, slotThree]);", + " return [slotOne, slotTwo, slotThree];", " }", "", " $(document).ready(function(){", @@ -1274,14 +1295,14 @@ "Now that our slots will each generate random numbers, we need to check whether they've all returned the same number.", "If they have, we should notify our user that they've won.", "Otherwise, we should return null, which is a JavaScript data structure that means nothing.", - "If all three numbers match, we should change the value of win to the number that we have three of or leave it as null.", + "If all three numbers match, we should return the number that we have in three of slots or leave it as null.", "Let's create an if statement with multiple conditions in order to check whether all numbers are equal.", "if(slotOne !== slotTwo || slotTwo !== slotThree){", - "  return(null);", + "  return null;", "}" ], "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", @@ -1310,7 +1331,7 @@ " $(\".logger\").append(\" \" + slotTwo);", " $(\".logger\").append(\" \" + slotThree);", " }", - " return([slotOne, slotTwo, slotThree]);", + " return [slotOne, slotTwo, slotThree];", " }", "", " $(document).ready(function(){", @@ -1439,8 +1460,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", @@ -1465,7 +1486,7 @@ " // Only change code above this line.", " ", " if(slotOne !== slotTwo || slotTwo !== slotThree){", - " return(null);", + " return null;", " }", " ", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", @@ -1474,7 +1495,7 @@ " $(\".logger\").append(\" \" + slotThree);", " }", " ", - " return([slotOne, slotTwo, slotThree]);", + " return [slotOne, slotTwo, slotThree];", " }", "", " $(document).ready(function(){", @@ -1604,10 +1625,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, 'Use the provided code three times. One for each slot')", - "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", @@ -1632,7 +1656,7 @@ " // Only change code above this line.", " ", " if(slotOne !== slotTwo || slotTwo !== slotThree){", - " return(null);", + " return null;", " }", " ", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", @@ -1641,7 +1665,7 @@ " $('.logger').append(' ' + slotThree);", " }", " ", - " return([slotOne, slotTwo, slotThree]);", + " return [slotOne, slotTwo, slotThree];", " }", "", " $(document).ready(function(){", diff --git a/seed/challenges/basic-ziplines.json b/seed/challenges/basic-ziplines.json index 37e547c4e3..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": "", @@ -45,6 +60,7 @@ "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: You may use whichever libraries or APIs you need.", "Rule #3: Reverse engineer the example project's functionality, and also feel free to personalize it.", + "Hint: If you don't want to start from scratch, you can fork this simple Bootstrap portfolio template on CodePen: http://codepen.io/FreeCodeCamp/pen/mJNqQj.", "Here are the user stories you must enable, and optional bonus user stories:", "User Story: As a user, I can access all of the portfolio webpage's content just by scrolling.", "User Story: As a user, I can click different buttons that will take me to the portfolio creator's different social media pages.", @@ -55,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, @@ -64,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": "", @@ -87,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, @@ -96,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": "", @@ -115,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, @@ -129,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": "", @@ -152,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, @@ -161,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": "", @@ -189,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, @@ -198,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 da7a510236..fb4f864474 100644 --- a/seed/challenges/bootstrap.json +++ b/seed/challenges/bootstrap.json @@ -91,7 +91,7 @@ "title": "Make Images Mobile Responsive", "difficulty": 2.02, "description": [ - "First, Add a new image below the existing one. Set it's src attribute to http://bit.ly/fcc-running-cats.", + "First, add a new image below the existing one. Set it's src attribute to http://bit.ly/fcc-running-cats.", "It would be great if this image could be exactly the width of our phone's screen.", "Fortunately, with Bootstrap, all we need to do is add the img-responsive class to your image. Do this, and the image should perfectly fit the width of your page." ], @@ -176,8 +176,8 @@ "title": "Center Text with Bootstrap", "difficulty": 2.03, "description": [ - "Now that we're using Bootstrap, we can center our heading elements to make them look better. All we need to do is add the class text-center to our h1 and h2 elements.", - "Remember that you can add several classes to the same element by separating each of them with a space, like this: <h2 class=\"text-red text-center\">your text</h2>." + "Now that we're using Bootstrap, we can center our heading element to make it look better. All we need to do is add the class text-center to our h2 element.", + "Remember that you can add several classes to the same element by separating each of them with a space, like this: <h2 class=\"red-text text-center\">your text</h2>." ], "tests": [ "assert($(\"h2\").hasClass(\"text-center\"), 'Your h2 element should be centered by applying the class text-center')" @@ -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." ], @@ -614,7 +614,7 @@ "Note that these buttons still need the btn and btn-block classes." ], "tests": [ - "assert(new RegExp(\"delete\",\"gi\").test($(\"button\").text()), 'Create a new button element with the text \"delete\".')", + "assert(new RegExp(\"Delete\",\"gi\").test($(\"button\").text()), 'Create a new button element with the text \"Delete\".')", "assert($(\"button.btn-block.btn\").length > 2, 'All of your Bootstrap buttons should have the btn and btn-block classes.')", "assert($(\"button\").hasClass(\"btn-danger\"), 'Your new button should have the class btn-danger.')", "assert(editor.match(/<\\/button>/g) && editor.match(/