diff --git a/README.md b/README.md index 0307641300..092c5b76e9 100644 --- a/README.md +++ b/README.md @@ -60,24 +60,32 @@ touch .env ``` -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: +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' -SESSION_SECRET='ANY ENGLISH PHRASE' -MANDRILL_USER='THE EMAIL ADDRESS FROM YOUR MANDRILL ACCOUNT' -MANDRILL_PASSWORD='YOUR MANDRILL PASSWORD' -FACEBOOK_ID='FACEBOOK APP API KEY' -FACEBOOK_SECRET='FACEBOOK SECRET' -GITHUB_ID='GITHUB APP API KEY' -GITHUB_SECRET='GITHUB APP SECRET' -TWITTER_KEY='TWITTER APP API KEY' -TWITTER_SECRET='TWITTER APP SECRET' -GOOGLE_ID='GOOGLE APP API KEY' -GOOGLE_SECRET='GOOGLE APP SECRET' -LINKEDIN_ID='LINKEDIN APP API KEY' -LINKEDIN_SECRET='LINKEDIN APP SECRET' +BLOGGER_KEY=stuff +FACEBOOK_ID=stuff +FACEBOOK_SECRET=stuff +GITHUB_ID=stuff +GITHUB_SECRET=stuff +GOOGLE_ID=stuff +GOOGLE_SECRET=stuff +LINKEDIN_ID=stuff +LINKEDIN_SECRET=stuff +MANDRILL_PASSWORD=stuff +MANDRILL_USER=stuff +SESSION_SECRET=secretstuff +TRELLO_KEY=stuff +TRELLO_SECRET=stuff +TWITTER_KEY=stuff +TWITTER_SECRET=stuff +TWITTER_TOKEN=stuff +TWITTER_TOKEN_SECRET=stuff +SLACK_WEBHOOK=stuff +PEER=stuff +DEBUG=true ``` diff --git a/public/css/main.less b/public/css/main.less index 2b9fa9d826..2a5cf1f433 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -1087,6 +1087,19 @@ hr { color: @gray-light; } +@media only screen and (min-width: 993px) { + .iframe-scroll { + position: fixed !important; + margin-top: 75px; + } +} +@media only screen and (max-width: 992px) { + .iframe-scroll { + height: auto; + overflow: auto; + } +} + //uncomment this to see the dimensions of all elements outlined in red //* { // border-color: red; diff --git a/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js deleted file mode 100644 index c57817eca5..0000000000 --- a/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js +++ /dev/null @@ -1,154 +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 -}); - - -// 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 allTests = ''; -(function() { - tests.forEach(function(elem) { - allTests += elem + ' '; - }); -})(); - -var otherTestsForNow = ""; - -var delay; -// Initialize CodeMirror editor with a nice html5 canvas demo. -editor.on("change", function () { - clearTimeout(delay); - delay = setTimeout(updatePreview, 300); -}); -var nodeEnv = prodOrDev === 'production' ? 'http://www.freecodecamp.com' : 'http://localhost:3001'; -function updatePreview() { - goodTests = 0; - var previewFrame = document.getElementById('preview'); - var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; - preview.open(); - $('#testSuite').empty(); - preview.write(libraryIncludes + editor.getValue() + otherTestsForNow); - preview.close(); - -} -setTimeout(updatePreview, 300); - -/** - * "post" methods - */ - -var postSuccess = function(data) { - var testDoc = document.createElement("div"); - $(testDoc) - .html("
" + JSON.parse(data) + "
") - .appendTo($('#testSuite')); - testSuccess(); -}; - -var postError = function(data) { - var testDoc = document.createElement("div"); - $(testDoc) - .html("
" + JSON.parse(data) + "
") - .prependTo($('#testSuite')) -}; -var goodTests = 0; -var testSuccess = function() { - goodTests++; - if (goodTests === tests.length) { - showCompletion(); - } -}; -var challengeSeed = challengeSeed || null; -var tests = tests || []; -var allSeeds = ''; -(function() { - challengeSeed.forEach(function(elem) { - allSeeds += elem.replace(/fccss/g, '') + '\n'; - }); - editor.setValue(allSeeds); -})(); - - -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'); - } - }); -} diff --git a/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.5.js b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.5.js new file mode 100644 index 0000000000..f38739c15a --- /dev/null +++ b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.5.js @@ -0,0 +1,156 @@ +/** + * 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 +}); + + +// 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 allTests = ''; +(function() { + tests.forEach(function(elem) { + allTests += elem + ' '; + }); +})(); + +var otherTestsForNow = ""; + +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() { + goodTests = 0; + var previewFrame = document.getElementById('preview'); + var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; + preview.open(); + $('#testSuite').empty(); + preview.write(libraryIncludes + editor.getValue() + otherTestsForNow); + preview.close(); + +} +setTimeout(updatePreview, 300); + +/** + * "post" methods + */ + +var postSuccess = function(data) { + var testDoc = document.createElement("div"); + $(testDoc) + .html("
" + JSON.parse(data) + "
") + .appendTo($('#testSuite')); + testSuccess(); +}; + +var postError = function(data) { + var testDoc = document.createElement("div"); + $(testDoc) + .html("
" + JSON.parse(data) + "
") + .prependTo($('#testSuite')) +}; +var goodTests = 0; +var testSuccess = function() { + goodTests++; + if (goodTests === tests.length) { + showCompletion(); + } +}; +var challengeSeed = challengeSeed || null; +var tests = tests || []; +var allSeeds = ''; +(function() { + challengeSeed.forEach(function(elem) { + allSeeds += elem.replace(/fccss/g, '') + '\n'; + }); + editor.setValue(allSeeds); + editor.setCursor(15); +})(); + + +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'); + } + }); +} diff --git a/seed_data/challenges/basic-bonfires.json b/seed_data/challenges/basic-bonfires.json index 240e64fe15..9053cde115 100644 --- a/seed_data/challenges/basic-bonfires.json +++ b/seed_data/challenges/basic-bonfires.json @@ -19,8 +19,7 @@ "Add them as a new contact in Screen Hero, then click the monitor-looking button to attempt to share your screen with them.", "Once the Screen Hero session starts, your screen's margins will glow orange. You are now sharing your screen.", "Your pair will have their own cursor, and will be able to type text on his or her and keyboard.", - "Now it's time to tackle our Bonfires.", - "Go to http://freecodecamp.com/bonfires and start working through our Bonfire challenges.", + "Now it's time to tackle our Bonfires. You can begin them by advancing to the next challenge.", "Once you you finish pair programming, end the session in Screen Hero session.", "Congratulations! You have completed your first pair programming session.", "Pair program as much as possible with different campers until you've completed all the Bonfire challenges. This is a big time investment, but the JavaScript practice you get will be well worth it!", @@ -447,6 +446,7 @@ "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');" ], "MDNlinks": [ diff --git a/seed_data/challenges/basic-html5-and-css.json b/seed_data/challenges/basic-html5-and-css.json index 5407d93507..38cbb15e25 100644 --- a/seed_data/challenges/basic-html5-and-css.json +++ b/seed_data/challenges/basic-html5-and-css.json @@ -133,9 +133,9 @@ "You can start a comment with <!-- and end a comment with -->." ], "tests": [ - "assert(($('h1').length > 0), 'The h1 element should not commented. It should be visible in the browser.')", - "assert(($('h2').length > 0), 'The h2 element should not commented. It should be visible in the browser.')", - "assert(($('p').length > 0), 'The paragraph element should not commented. It should be visible in the browser.')" + "assert($('h1').length > 0, 'The h1 element should not be commented. It should be visible in the browser.')", + "assert($('h2').length > 0, 'The h2 element should not be commented. It should be visible in the browser.')", + "assert($('p').length > 0, 'The paragraph element should not be commented. It should be visible in the browser.')" ], "challengeSeed": [ "