30
README.md
30
README.md
@ -15,7 +15,7 @@ Our campers (students) start by working through our free, self-paced, browser-ba
|
||||
|
||||
80% of our campers are over 25, and nearly a fifth of our campers are women.
|
||||
|
||||
This code is running live at [FreeCodeCamp.com](http://www.FreeCodeCamp.com). We also have [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp), a [blog](http://blog.freecodecamp.com), and even a [Twitch.tv channel](http://twitch.tv/freecodecamp).
|
||||
This code is running live at [FreeCodeCamp.com](http://www.FreeCodeCamp.com). We also have [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp), a [blog](http://medium.freecodecamp.com), and even a [Twitch.tv channel](http://twitch.tv/freecodecamp).
|
||||
|
||||
[Join our community here](http://www.freecodecamp.com/signin).
|
||||
|
||||
@ -54,22 +54,26 @@ The easiest way to get started is to clone the repository:
|
||||
# Get the latest snapshot
|
||||
git clone --depth=1 https://github.com/freecodecamp/freecodecamp.git freecodecamp
|
||||
|
||||
# Change directory
|
||||
cd freecodecamp
|
||||
|
||||
# Install NPM dependencies
|
||||
npm install
|
||||
|
||||
# Install Gulp globally
|
||||
npm install -g gulp
|
||||
|
||||
# Install Bower globally
|
||||
npm install -g bower
|
||||
|
||||
# Install Bower dependencies
|
||||
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. If you only use a subset or no OAuth2 authentication methods, you may want to remove them from ```server/passport-providers.js``` - otherwise the server will complain about missing clientIDs at launch.
|
||||
|
||||
```
|
||||
MONGOHQ_URL='mongodb://localhost:27017/freecodecamp'
|
||||
@ -107,20 +111,20 @@ DEBUG=true
|
||||
```
|
||||
|
||||
```bash
|
||||
# Start the mongo server
|
||||
# Start the mongo server in a seperate terminal
|
||||
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/
|
||||
# Initialize Free Code Camp
|
||||
# This will seed the database for the first time.
|
||||
# This command should only be run once.
|
||||
npm run first-time
|
||||
|
||||
# start the application
|
||||
gulp
|
||||
```
|
||||
Now navigate to your browser and open http://localhost:3001
|
||||
If the app loads, congratulations - you're all set. Otherwise, let us know by opening a GitHub issue and with your error.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
File diff suppressed because one or more lines are too long
24
client/less/chat.less
Normal file
24
client/less/chat.less
Normal file
@ -0,0 +1,24 @@
|
||||
.chat-embed-main-title {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
padding-left: 31px;
|
||||
padding-top: 7px;
|
||||
}
|
||||
|
||||
.gitter-chat-embed {
|
||||
z-index: 100;
|
||||
position: fixed;
|
||||
|
||||
top: 0;
|
||||
left: 60%;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
transition: transform 0.3s cubic-bezier(0.16, 0.22, 0.22, 1.7);
|
||||
}
|
||||
|
||||
.gitter-chat-embed.is-collapsed:not(.is-loading) {
|
||||
transform: translateX(110%);
|
||||
}
|
@ -96,6 +96,10 @@ h1, h2, h3, h4, h5, h6, p, li {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.fa:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.img-center {
|
||||
margin: 0 auto;
|
||||
}
|
||||
@ -951,6 +955,11 @@ code {
|
||||
margin: 0!important;
|
||||
}
|
||||
|
||||
// gitter chat
|
||||
.gitter-chat-embed {
|
||||
z-index: 20000 !important;
|
||||
}
|
||||
|
||||
//uncomment this to see the dimensions of all elements outlined in red
|
||||
//* {
|
||||
// border-color: red;
|
||||
@ -1058,3 +1067,5 @@ code {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
}
|
||||
|
||||
@import "chat.less";
|
||||
|
104
client/main.js
104
client/main.js
@ -4,6 +4,105 @@ main.mapShareKey = 'map-shares';
|
||||
|
||||
main.ga = window.ga || function() {};
|
||||
|
||||
main = (function(main) {
|
||||
|
||||
// should be set before gitter script loads
|
||||
((window.gitter = {}).chat = {}).options = {
|
||||
disableDefaultChat: true
|
||||
};
|
||||
// wait for sidecar to load
|
||||
|
||||
main.chat = {};
|
||||
main.chat.isOpen = false;
|
||||
main.chat.createHelpChat = function createHelpChat() {
|
||||
throw new Error('Sidecar chat has not initialized');
|
||||
};
|
||||
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
main.chat.GitterChat = e.detail.Chat;
|
||||
|
||||
main.chat.createHelpChat = function(room, helpChatBtnClass, roomTitle) {
|
||||
roomTitle = roomTitle || 'Waypoint Help';
|
||||
|
||||
$('body').append(
|
||||
'<aside id="chat-embed-help" class="gitter-chat-embed is-collapsed" />'
|
||||
);
|
||||
|
||||
main.chat.helpChat = new main.chat.GitterChat({
|
||||
room: room,
|
||||
activationElement: false,
|
||||
targetElement: $('#chat-embed-help')
|
||||
});
|
||||
|
||||
$(helpChatBtnClass).on('click', function() {
|
||||
// is button already pressed?
|
||||
// no? open chat
|
||||
// yes? close chat
|
||||
var shouldChatBeOpen = !$(this).hasClass('active');
|
||||
main.chat.helpChat.toggleChat(shouldChatBeOpen);
|
||||
if (shouldChatBeOpen) {
|
||||
$(helpChatBtnClass).addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
var helpTitleAdd = false;
|
||||
$('#chat-embed-help').on('gitter-chat-toggle', function(e) {
|
||||
var shouldButtonBePressed = !!e.originalEvent.detail.state;
|
||||
|
||||
if (!helpTitleAdd) {
|
||||
helpTitleAdd = true;
|
||||
$('#chat-embed-help > .gitter-chat-embed-action-bar').prepend(
|
||||
'<div class="chat-embed-main-title">' +
|
||||
'<span>' +
|
||||
roomTitle +
|
||||
'</span>' +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
|
||||
if (shouldButtonBePressed) {
|
||||
return $(helpChatBtnClass).addClass('active');
|
||||
}
|
||||
return $(helpChatBtnClass).removeClass('active');
|
||||
});
|
||||
};
|
||||
|
||||
$('body').append(
|
||||
'<aside id="chat-embed-main" class="gitter-chat-embed is-collapsed" />'
|
||||
);
|
||||
|
||||
main.chat.mainChat = new main.chat.GitterChat({
|
||||
room: 'freecodecamp/freecodecamp',
|
||||
activationElement: false,
|
||||
targetElement: $('#chat-embed-main')
|
||||
});
|
||||
|
||||
var mainChatTitleAdded = false;
|
||||
$('#chat-embed-main').on('gitter-chat-toggle', function() {
|
||||
if (mainChatTitleAdded) {
|
||||
return null;
|
||||
}
|
||||
mainChatTitleAdded = true;
|
||||
|
||||
$('#chat-embed-main > .gitter-chat-embed-action-bar').prepend(
|
||||
'<div class="chat-embed-main-title">' +
|
||||
'<span>Free Code Camp\'s Main Chat</span>' +
|
||||
'</div>'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
$('#nav-chat-btn').on('click', function() {
|
||||
if (!main.chat.isOpen) {
|
||||
|
||||
main.chat.mainChat.toggleChat(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return main;
|
||||
}(main));
|
||||
|
||||
var lastCompleted = typeof lastCompleted !== 'undefined' ?
|
||||
lastCompleted :
|
||||
'';
|
||||
@ -38,9 +137,10 @@ function setMapShare(id) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
var challengeName = typeof challengeName !== 'undefined' ?
|
||||
challengeName :
|
||||
'Untitled';
|
||||
'';
|
||||
|
||||
if (challengeName) {
|
||||
ga('send', 'event', 'Challenge', 'load', challengeName);
|
||||
@ -135,7 +235,7 @@ $(document).ready(function() {
|
||||
'links to screenshots if possible.\n\n'
|
||||
].join('');
|
||||
|
||||
if (editor.getValue().trim()) {
|
||||
if (typeof editor !== 'undefined' && editor.getValue().trim()) {
|
||||
var type;
|
||||
switch (challengeType) {
|
||||
case challengeTypes.HTML_CSS_JQ:
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"className": "ion-speakerphone",
|
||||
"content": " Blog ",
|
||||
"href": "http://blog.freecodecamp.com",
|
||||
"href": "http://medium.freecodecamp.com",
|
||||
"target": "_blank"
|
||||
},
|
||||
{
|
||||
|
@ -82,6 +82,10 @@
|
||||
},
|
||||
"descriptionPt": {
|
||||
"type": "array"
|
||||
},
|
||||
"solutions": {
|
||||
"type": "array",
|
||||
"default": []
|
||||
}
|
||||
},
|
||||
"validations": [],
|
||||
|
@ -79,6 +79,7 @@ var paths = {
|
||||
],
|
||||
|
||||
less: './client/less/main.less',
|
||||
lessFiles: './client/less/*.less',
|
||||
|
||||
manifest: 'server/manifests/',
|
||||
|
||||
@ -392,7 +393,7 @@ var watchDependents = [
|
||||
];
|
||||
|
||||
gulp.task('watch', watchDependents, function() {
|
||||
gulp.watch(paths.less, ['less']);
|
||||
gulp.watch(paths.lessFiles, ['less']);
|
||||
gulp.watch(paths.js, ['js']);
|
||||
gulp.watch(paths.challenges, ['test-challenges']);
|
||||
gulp.watch(paths.js, ['js', 'dependents']);
|
||||
|
16
package.json
16
package.json
@ -6,6 +6,8 @@
|
||||
"url": "https://github.com/freecodecamp/freecodecamp.git"
|
||||
},
|
||||
"scripts": {
|
||||
"first-time": "npm run create-rev && echo '\n\nseeding database\n\n' && node seed && node seed/nonprofits",
|
||||
"create-rev": "test ! -e server/rev-manifest.json && echo '\n\ncreating manifest\n\n' && touch server/rev-manifest.json && echo '{}' >> server/rev-manifest.json",
|
||||
"build": "gulp build",
|
||||
"start": "babel-node server/server.js",
|
||||
"prestart-production": "bower cache clean && bower install && gulp build",
|
||||
@ -49,6 +51,13 @@
|
||||
"forever": "~0.14.1",
|
||||
"frameguard": "^0.2.2",
|
||||
"github-api": "~0.7.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",
|
||||
"gulp-less": "^3.0.3",
|
||||
"gulp-minify-css": "~0.5.1",
|
||||
"gulp-reduce-file": "0.0.1",
|
||||
@ -114,13 +123,6 @@
|
||||
"browserify": "^10.2.4",
|
||||
"chai": "~1.10.0",
|
||||
"envify": "^3.4.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",
|
||||
"istanbul": "^0.3.15",
|
||||
"loopback-explorer": "^1.7.2",
|
||||
"loopback-testing": "^1.1.0",
|
||||
|
@ -57,6 +57,9 @@
|
||||
"MDNlinks": [
|
||||
"RegExp"
|
||||
],
|
||||
"solutions": [
|
||||
"var re = /^(?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:\\(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*\\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$/;\n\nfunction telephoneCheck(str) {\n return !!str.match(re);\n}\n\ntelephoneCheck(\"555-555-5555\");"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -88,13 +91,15 @@
|
||||
"tests": [
|
||||
"assert.sameMembers(sym([1, 2, 3], [5, 2, 1, 4]), [3, 5, 4], 'message: <code>sym([1, 2, 3], [5, 2, 1, 4])</code> should return <code>[3, 5, 4]</code>.');",
|
||||
"assert.sameMembers(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'message: <code>sym([1, 2, 5], [2, 3, 5], [3, 4, 5])</code> should return <code>[1, 4, 5]</code>');",
|
||||
"assert.sameMembers(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'message: <code>sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5])</code> should return <code>[1, 4, 5]</code>.');",
|
||||
"assert.sameMembers(sym([1, 1]), [1], 'message: <code>sym([1, 1])</code> should return <code>[1]</code>.');"
|
||||
],
|
||||
"assert.sameMembers(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'message: <code>sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5])</code> should return <code>[1, 4, 5]</code>.');"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Array.reduce()",
|
||||
"Symmetric Difference"
|
||||
],
|
||||
"solutions": [
|
||||
"function sym(args) {\n var index = -1;\n var length = arguments.length;\n var result;\n while (++index < length) {\n var array = arguments[index];\n result = result ? diff(result, array).concat(diff(array, result)) : array;\n }\n return result ? uniq(result) : [];\n}\n\nfunction uniq(arr) {\n var h = Object.create(null);\n var u = [];\n arr.forEach(function(v) {\n if (v in h) return;\n h[v] = true;\n u.push(v);\n });\n return u;\n}\n\nfunction diff(a, b) {\n var h = Object.create(null);\n b.forEach(function(v) {\n h[v] = true; \n });\n return a.filter(function(v) { return !(v in h);});\n}\nsym([1, 2, 3], [5, 2, 1, 4]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -151,6 +156,9 @@
|
||||
"MDNlinks": [
|
||||
"Global Object"
|
||||
],
|
||||
"solutions": [
|
||||
"var VALUES = [1, 5, 10, 25, 100, 500, 1000, 2000, 10000];\n\nfunction drawer(price, cash, cid) {\n cash = ~~(cash * 100);\n price = ~~(price * 100);\n var diff = cash-price;\n cid.forEach(function(c) {\n c[1] = ~~(c[1] * 100);\n });\n var totalCid = cid.reduce(function(a, c) {\n return a + c[1];\n }, 0);\n if (diff > totalCid) {\n return \"Insufficient Funds\";\n }\n if (diff === totalCid) {\n return \"Closed\";\n }\n \n var change = []; \n var index = cid.length;\n while (diff > 0 && --index > -1) {\n var t = 0;\n var value = VALUES[index];\n while (diff >= value && cid[index][1] > 0) {\n t += value;\n cid[index][1] -= value;\n diff -= value;\n }\n if (t) {\n change.push([cid[index][0], t/100]);\n }\n console.log(JSON.stringify(change));\n }\n // Here is your change, ma'am.\n return change;\n}\n\n// Example cash-in-drawer array:\n// [['PENNY', 1.01],\n// ['NICKEL', 2.05],\n// ['DIME', 3.10],\n// ['QUARTER', 4.25],\n// ['ONE', 90.00],\n// ['FIVE', 55.00],\n// ['TEN', 20.00],\n// ['TWENTY', 60.00],\n// ['ONE HUNDRED', 100.00]]\n\ndrawer(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]]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -205,6 +213,9 @@
|
||||
"MDNlinks": [
|
||||
"Global Array Object"
|
||||
],
|
||||
"solutions": [
|
||||
"function inventory(arr1, arr2) {\n arr2.forEach(function(item) {\n createOrUpdate(arr1, item);\n });\n // All inventory must be accounted for or you're fired!\n return arr1;\n}\n\nfunction createOrUpdate(arr1, item) {\n var index = -1;\n while (++index < arr1.length) {\n if (arr1[index][1] === item[1]) {\n arr1[index][0] += item[0];\n return;\n }\n if (arr1[index][1] > item[1]) {\n break;\n }\n }\n arr1.splice(index, 0, item);\n}\n\n// Example inventory lists\nvar curInv = [\n [21, 'Bowling Ball'],\n [2, 'Dirty Sock'],\n [1, 'Hair Pin'],\n [5, 'Microphone']\n];\n\nvar newInv = [\n [2, 'Hair Pin'],\n [3, 'Half-Eaten Apple'],\n [67, 'Bowling Ball'],\n [7, 'Toothpaste']\n];\n\ninventory(curInv, newInv);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -246,6 +257,9 @@
|
||||
"Permutations",
|
||||
"RegExp"
|
||||
],
|
||||
"solutions": [
|
||||
"function permAlone(str) {\n return permutor(str).filter(function(perm) {\n return !perm.match(/(.)\\1/g);\n }).length;\n}\n\nfunction permutor(str) {\n // http://staff.roguecc.edu/JMiller/JavaScript/permute.html\n //permArr: Global array which holds the list of permutations\n //usedChars: Global utility array which holds a list of \"currently-in-use\" characters\n var permArr = [], usedChars = [];\n function permute(input) {\n //convert input into a char array (one element for each character)\n var i, ch, chars = input.split(\"\");\n for (i = 0; i < chars.length; i++) {\n //get and remove character at index \"i\" from char array\n ch = chars.splice(i, 1);\n //add removed character to the end of used characters\n usedChars.push(ch);\n //when there are no more characters left in char array to add, add used chars to list of permutations\n if (chars.length === 0) permArr[permArr.length] = usedChars.join(\"\");\n //send characters (minus the removed one from above) from char array to be permuted\n permute(chars.join(\"\"));\n //add removed character back into char array in original position\n chars.splice(i, 0, ch);\n //remove the last character used off the end of used characters array\n usedChars.pop();\n }\n }\n permute(str);\n return permArr;\n}\n\npermAlone('aab');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -291,6 +305,9 @@
|
||||
"String.substr()",
|
||||
"parseInt()"
|
||||
],
|
||||
"solutions": [
|
||||
"function friendly(str) {\n var dates = str.map(function(s) {return s.split('-').map(Number);});\n var start = dates[0];\n var end = dates[1];\n if (str[0] === str[1]) {\n return [readable(start)];\n }\n if (start[0] !== end[0]) {\n if (start[0] + 1 === end[0] && start[1] > end[1]) {\n start[0] = undefined;\n end[0] = undefined;\n }\n return dates.map(readable);\n }\n start[0] = undefined;\n end[0] = undefined;\n if (start[1] !== end[1]) {\n return dates.map(readable);\n }\n end[1] = undefined;\n return dates.map(readable);\n}\n\nfunction readable(arr) {\n var ordD = arr[2] + nth(arr[2]);\n if (!arr[1]) {\n return ordD;\n }\n return MONTH[arr[1]] + \" \" + ordD + (!arr[0] ? \"\" : \", \" + arr[0]);\n}\n\nvar MONTH = {1: \"January\",\n 2: \"February\",\n 3: \"March\",\n 4: \"April\",\n 5: \"May\",\n 6: \"June\",\n 7: \"July\",\n 8: \"August\",\n 9: \"September\",\n 10: \"October\",\n 11: \"November\",\n 12: \"December\"};\n\nfunction nth(d) {\n if(d>3 && d<21) return 'th';\n switch (d % 10) {\n case 1: return \"st\";\n case 2: return \"nd\";\n case 3: return \"rd\";\n default: return \"th\";\n }\n} \n\nfriendly(['2015-07-01', '2015-07-04']);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
|
@ -6,62 +6,100 @@
|
||||
{
|
||||
"id": "bd7158d8c443eddfaeb5bcef",
|
||||
"title": "Get Set for Basejumps",
|
||||
"challengeSeed": ["128451852"],
|
||||
"challengeSeed": [],
|
||||
"description": [
|
||||
"<span class='text-info'>Objective:</span> Get the MEAN stack running on Cloud 9, push your code to GitHub, and deploy it to Heroku.",
|
||||
"We'll build our Basejumps on Cloud 9, a powerful online code editor with a full Ubuntu Linux workspace, all running in the cloud.",
|
||||
"If you don't already have Cloud 9 account, create one now at <a href='http://c9.io' target='_blank'>http://c9.io</a>.",
|
||||
"Now let's get your development environment ready for a new Angular-Fullstack application provided by Yeoman.",
|
||||
"Open up <a href='http://c9.io' target='_blank'>http://c9.io</a> and sign in to your account.",
|
||||
"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 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: <code>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</code>",
|
||||
"Yeoman will prompt you to answer some questions. Answer them like this:",
|
||||
"What would you like to write scripts with? <span class='text-success'>JavaScript</span>",
|
||||
"What would you like to write markup with? <span class='text-success'>HTML</span>",
|
||||
"What would you like to write stylesheets with? <span class='text-success'>CSS</span>",
|
||||
"What Angular router would you like to use? <span class='text-success'>ngRoute</span>",
|
||||
"Would you like to include Bootstrap? <span class='text-success'>Yes</span>",
|
||||
"Would you like to include UI Bootstrap? <span class='text-success'>Yes</span>",
|
||||
"Would you like to use MongoDB with Mongoose for data modeling? <span class='text-success'>Yes</span>",
|
||||
"Would you scaffold out an authentication boilerplate? <span class='text-success'>Yes</span>",
|
||||
"Would you like to include additional oAuth strategies? <span class='text-success'>Twitter</span>",
|
||||
"Would you like to use socket.io? <span class='text-success'>No</span>",
|
||||
"May bower anonymously report usage statistics to improve the tool over time? (Y/n) <span class='text-success'>Y</span>",
|
||||
"You may get an error similar to <code> ERR! EEXIST, open ‘/home/ubuntu/.npm</code>. This is caused when Cloud9 runs out of memory and kills an install. If you get this, simply re-run this process with the command <code>yo angular-fullstack</code>. You will then be asked a few questions regarding the re-install. Answer them as follows:",
|
||||
"Existing .yo-rc configuration found, would you like to use it? (Y/n) <span class='text-success'>Y</span>",
|
||||
"Overwrite client/favicon.ico? (Ynaxdh) <span class='text-success'>Y</span>",
|
||||
"To finish the installation run the commands: <code>bower install && npm install</code>",
|
||||
"To start MongoDB, run the following commands in your terminal: <code>mkdir data && echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest \"$@\"' > mongod && chmod a+x mongod && ./mongod</code>",
|
||||
"You will want to open up a new terminal to work from by clicking on the + icon and select New Terminal",
|
||||
"Start the application by running the following command in your new terminal window: <code>grunt serve</code>",
|
||||
"Wait for the following message to appear: <code>xdg-open: no method available for opening 'http://localhost:8080' </code>. Now you can open the internal Cloud9 browser. To launch the browser select Preview in the toolbar then select the dropdown option Preview Running Application.",
|
||||
"Turn the folder in which your application is running into a Git repository by running the following commands: <code>git init && git add . && git commit -am 'initial commit'</code>.",
|
||||
"Now we need to add your GitHub SSH key to c9.io. Click the \"Add-on Services\" button in the lower left of your C9 dashboard. Click \"activate\" next to the GitHub icon.",
|
||||
"A pop up will appear. Allow access to your account.",
|
||||
"While still on the dashboard, under “Account Settings”, click the link for \"Show your SSH key\". Copy the key to you clipboard.",
|
||||
"Sign in to <a href='http://github.com' target='_blank'>http://github.com</a> and navigate to the GitHub SSH settings page. Click the \"Add SSH Key\". Give your key the title \"cloud 9\". Paste your SSH Key into the \"Key\" box, then click \"Add Key\".",
|
||||
"Create a new GitHub repository by and clicking on the + button next to your username in the upper-right hand side of your screen, then selecting \"New Repository\".",
|
||||
"Enter a project name, then click the \"Create Repository\" button.",
|
||||
"Find the \"...or push an existing repository from the command line\" section and click the Copy to Clipboard button beside it.",
|
||||
"Paste the commands from your clipboard into the Cloud9 terminal prompt. This will push your changes to your repository on Cloud 9 up to GitHub.",
|
||||
"Check back on your GitHub profile to verify the changes were successfully pushed up to GitHub.",
|
||||
"Now let's push your code to Heroku. If you don't already have a Heroku account, create one at <a href='http://heroku.com' target='_blank'>http://heroku.com</a>. You shouldn't be charged for anything, but you will need to add your credit card information to your Heroku before you will be able to use Heroku's free MongoLab add on.",
|
||||
"Before you publish to Heroku, you should free up as much memory as possible on Cloud9. In each of the Cloud9 terminal prompt tabs where MongoDB and Grunt are running, press the <code>control + c</code> hotkey to shut down these processes.",
|
||||
"Run the following command in a Cloud9 terminal prompt tab: <code>npm install grunt-contrib-imagemin --save-dev && npm install --save-dev && heroku login</code>. At this point, the terminal will prompt you to log in to Heroku from the command line.",
|
||||
"Now run <code>yo angular-fullstack:heroku</code>. 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: <code>cd ~/workspace/dist && heroku config:set NODE_ENV=production && heroku addons:add mongolab</code>.",
|
||||
"As you build your app, you should frequently commit changes to your codebase. Make sure you're in the <code>~/workspace</code> directory by running <code>cd ~/workspace</code>. Then you can use this code to stage the changes to your changes and commit them: <code>git commit -am \"your commit message\"</code>. 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 <code>git push origin master</code>, and to Heroku by running <code>grunt --force && grunt buildcontrol:heroku</code>.",
|
||||
"If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: <a href='https://github.com/clnhll/guidetobasejumps' target='_blank'>https://github.com/clnhll/guidetobasejumps</a>.",
|
||||
"Now you're ready to move on to your first Basejump. Click the \"I've completed this challenge\" and move on."
|
||||
[
|
||||
"http://i.imgur.com/4IZjWZ3.gif",
|
||||
"A gif showing how to create a c9.io account.",
|
||||
"We recommend building our full stack Basejump challenges on c9.io, a powerful browser-based development environment. This save you hours of time that you would spend configuring your local computer to run Node.js and MongoDB - time you could instead spend coding. <br>Create a c9.io account by clicking the GitHub symbol in the upper right hand corner of the c9.io page. Click the big plus symbol to create a new workspace. Enter your email address when prompted.",
|
||||
"http://c9.io"
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/F7i5Hhi.gif",
|
||||
"A gif showing how to fill out the new workspace form",
|
||||
"Instead of starting from scratch, we recommend using Clementine.js, a full stack JavaScript \"boilerplate\" that already has some basic code written for you. Clementine.js has a detailed tutorial you can go through to build it yourself, but for now let's just clone its code. On c9.io, give your workspace a name, then leave \"Template\" as custom and create your workspace from this GitHub url: <code>https://github.com/johnstonbl01/clementinejs-fcc.git</code>",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/42m1vyr.gif",
|
||||
"A gif showing you how to show hidden files.",
|
||||
"Click the gear in the upper right corner of c9.io's file structure. Select \"show hidden files\".",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/qrE8xaK.gif",
|
||||
"A gif showing you how to create a new file.",
|
||||
"Right click and create a new file called <code>.env</code>.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/jkQX9SQ.gif",
|
||||
"A gif showing you how to prep your environmental variables in your .env file.",
|
||||
"Open your .env file and paste this into it, then save it: <br><code>GITHUB_KEY=<br>GITHUB_SECRET=<br>MONGO_URI=mongodb://localhost:27017/clementinejs<br>PORT=8080<br>APP_URL=http://localhost:8080/</code>",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/f3DE7zB.gif",
|
||||
"A gif showing you how to open c9.io's preview window.",
|
||||
"Open up your application in a preview tab by clicking window > share > application > open.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/Ip0qUdQ.gif",
|
||||
"A gif showing you how to create a GitHub app using c9.io's preview URL.",
|
||||
"Create a GitHub app for authentication and choose an \"Application name\". For the homepage URL, paste the URL from your preview tab. You'll also paste the URL from your preview tab into \"Authorization callback URL\", then add to it: <code>auth/github/callback</code>",
|
||||
"https://github.com/settings/applications/new"
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/qCUVRFb.gif",
|
||||
"A gif showing you how to transfer GitHub's key and secret over to your .env file, as well as your c9.io URL.",
|
||||
"GitHub will create an app and present you with a Client ID and a Client Secret. Set your .env file's GITHUB_KEY equal to the Client ID, and set your .env file's GITHUB_SECRET equal to the Client Secret. Copy the URL from the your preview tab and paste it into your .env file as your APP_URL.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/2a20Vah.gif",
|
||||
"A gif showing you how to start mongoDB in c9.io's terminal.",
|
||||
"In your terminal, start MongoDB by entering <code>mongod --smallfiles</code>",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/dC55pWk.gif",
|
||||
"A gif showing you how to open a new tab in c9.io's terminal.",
|
||||
"Open a new terminal tab with the + button above your terminal, then run <code>npm install</code>",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/54OC2Ro.gif",
|
||||
"A gif showing you how to navigate to your preview tab and sign in to your new Clementine.js app.",
|
||||
"Run <code>node server.js</code> to start the server. Refresh your preview tab. You should see the Clementine.js logo. Click \"sign in\" and accept GitHub's prompt to authorize the application.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/2IJfyvN.gif",
|
||||
"A gif showing you how to click the button to trigger an AJAX action with Clementine.js and how to look at your user profile from the GitHub authentication data.",
|
||||
"Click the \"click me\" button and you'll see that it increments the number clicks. Click the profile button and you'll see that it has your GitHub information.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/bjO5pnq.gif",
|
||||
"A gif showing you how to create a new GitHub repository and push your code up to it.",
|
||||
"Create a new GitHub repository. Then copy its .git URL. <br>Return to c9.io's terminal and set your GitHub remote URL: <code>git remote set-url origin</code> followed by the URL you copied from GitHub. <br>Run <code>git push origin master</code>. <br>Now tab back to GitHub and refresh, and you'll see that your code is now on GitHub.",
|
||||
"https://github.com/new"
|
||||
]
|
||||
],
|
||||
"type": "waypoint",
|
||||
"challengeType": 2,
|
||||
"tests": []
|
||||
"type": "Waypoint",
|
||||
"challengeType": 7,
|
||||
"tests": [],
|
||||
"nameCn": "",
|
||||
"descriptionCn": [],
|
||||
"nameFr": "",
|
||||
"descriptionFr": [],
|
||||
"nameRu": "",
|
||||
"descriptionRu": [],
|
||||
"nameEs": "",
|
||||
"descriptionEs": [],
|
||||
"namePt": "",
|
||||
"descriptionPt": []
|
||||
},
|
||||
{
|
||||
"id": "bd7158d8c443eddfaeb5bdef",
|
||||
|
@ -28,6 +28,9 @@
|
||||
"",
|
||||
"meetBonfire(\"You can do this!\");"
|
||||
],
|
||||
"solutions": [
|
||||
"function meetBonfire(argument) {\n // Good luck!\n console.log(\"you can read this function's argument in the developer tools\", argument);\n\n return true;\n}\n\n\n\nmeetBonfire(\"You can do this!\");\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -69,6 +72,9 @@
|
||||
"Array.reverse()",
|
||||
"Array.join()"
|
||||
],
|
||||
"solutions": [
|
||||
"function reverseString(str) {\n return str.split('').reverse().join(\"\");\n}\n\nreverseString('hello');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -109,6 +115,9 @@
|
||||
"MDNlinks": [
|
||||
"Arithmetic Operators"
|
||||
],
|
||||
"solutions": [
|
||||
"function factorialize(num) {\n return num === 1 ? 1 : num * factorialize(num-1);\n}\n\nfactorialize(5);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -143,7 +152,7 @@
|
||||
"assert(palindrome(\"almostomla\") === false, 'message: <code>palindrome(\"almostomla\")</code> should return false.');",
|
||||
"assert(palindrome(\"My age is 0, 0 si ega ym.\") === true, 'message: <code>palindrome(\"My age is 0, 0 si ega ym.\")</code> should return true.');",
|
||||
"assert(palindrome(\"1 eye for of 1 eye.\") === false, 'message: <code>palindrome(\"1 eye for of 1 eye.\")</code> should return false.');",
|
||||
"assert(palindrome(\"0_0 (: /-\\ :) 0-0\") === true, 'message: <code>palindrome(\"0_0 (: /-\\\\ :) 0-0\")</code> should return true.');"
|
||||
"assert(palindrome(\"0_0 (: /-\\ :) 0-0\") === true, 'message: <code>palindrome(\"0_0 (: /-\\ :) 0-0\")</code> should return true.');"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function palindrome(str) {",
|
||||
@ -159,6 +168,9 @@
|
||||
"String.replace()",
|
||||
"String.toLowerCase()"
|
||||
],
|
||||
"solutions": [
|
||||
"function palindrome(str) {\n var a = str.toLowerCase().replace(/[^a-z]/g, '');\n console.log(a.split('').reverse().join(''));\n return a == a.split('').reverse().join('');\n}\n\n\n\npalindrome(\"eye\");\npalindrome(\"A man, a plan, a canal. Panama\");\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -199,6 +211,9 @@
|
||||
"String.split()",
|
||||
"String.length"
|
||||
],
|
||||
"solutions": [
|
||||
"function findLongestWord(str) {\n return str.split(' ').sort(function(a, b) { return b.length - a.length;})[0].length;\n}\n\nfindLongestWord('The quick brown fox jumped over the lazy dog');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -236,6 +251,9 @@
|
||||
"MDNlinks": [
|
||||
"String.charAt()"
|
||||
],
|
||||
"solutions": [
|
||||
"function titleCase(str) {\n return str.split(' ').map(function(word) {\n return word.charAt(0).toUpperCase() + word.substring(1).toLowerCase();\n }).join(' ');\n}\n\ntitleCase(\"I'm a little tea pot\");\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -274,6 +292,9 @@
|
||||
"MDNlinks": [
|
||||
"Comparison Operators"
|
||||
],
|
||||
"solutions": [
|
||||
"function largestOfFour(arr) {\n return arr.map(function(subArr) {\n return Math.max.apply(null, subArr);\n });\n}\n\nlargestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -306,7 +327,7 @@
|
||||
"tests": [
|
||||
"assert(end(\"Bastian\", \"n\") === true, 'message: <code>end(\"Bastian\", \"n\")</code> should return true.');",
|
||||
"assert(end(\"Connor\", \"n\") === false, 'message: <code>end(\"Connor\", \"n\")</code> should return false.');",
|
||||
"assert(end(\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") === false, 'message: <code>end(\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\")</code> should return false.');",
|
||||
"assert(end(\"Walking on water and developing software from a specification are easy if both are frozen\", \"specification\") === false, '<code>\"Walking on water and developing software from a specification are easy if both are frozen\", \"specification\")</code> should return false.');",
|
||||
"assert(end(\"He has to give me a new name\", \"name\") === true, 'message: <code>end(\"He has to give me a new name\", \"name\")</code> should return true.');",
|
||||
"assert(end(\"He has to give me a new name\", \"me\") === true, 'message: <code>end(\"He has to give me a new name\", \"me\")</code> 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, 'message: <code>end(\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\")</code> should return false.');"
|
||||
@ -314,6 +335,9 @@
|
||||
"MDNlinks": [
|
||||
"String.substr()"
|
||||
],
|
||||
"solutions": [
|
||||
"function end(str, target) {\n // \"Never give up and good luck will find you.\"\n // -- Falcor\n return str.substring(str.length-target.length) === target;\n}\n\nend('Bastian', 'n');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -350,6 +374,9 @@
|
||||
"MDNlinks": [
|
||||
"Global String Object"
|
||||
],
|
||||
"solutions": [
|
||||
"function repeat(str, num) {\n if (num < 0) return '';\n return num === 1 ? str : str + repeat(str, num-1);\n}\n\nrepeat('abc', 3);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -390,6 +417,9 @@
|
||||
"MDNlinks": [
|
||||
"String.slice()"
|
||||
],
|
||||
"solutions": [
|
||||
"function truncate(str, num) {\n if (str.length > num) {\n return str.substring(0, num-3) + '...';\n }\n return str;\n}\n\ntruncate('A-tisket a-tasket A green and yellow basket', 11);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -427,6 +457,9 @@
|
||||
"MDNlinks": [
|
||||
"Array.push()"
|
||||
],
|
||||
"solutions": [
|
||||
"function chunk(arr, size) {\n var out = [];\n for (var i = 0; i < arr.length; i+=size) {\n out.push(arr.slice(i,i+size));\n }\n return out;\n}\n\nchunk(['a', 'b', 'c', 'd'], 2);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -466,6 +499,9 @@
|
||||
"Array.slice()",
|
||||
"Array.splice()"
|
||||
],
|
||||
"solutions": [
|
||||
"function slasher(arr, howMany) {\n // it doesn't always pay to be first\n return arr.slice(howMany);\n}\n\nslasher([1, 2, 3], 2);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -509,6 +545,9 @@
|
||||
"MDNlinks": [
|
||||
"Array.indexOf()"
|
||||
],
|
||||
"solutions": [
|
||||
"function mutation(arr) {\n var hash = Object.create(null);\n arr[0].toLowerCase().split('').forEach(function(c) {\n hash[c] = true;\n });\n return !arr[1].toLowerCase().split('').filter(function(c) {\n return !hash[c];\n }).length;\n}\n\nmutation(['hello', 'hey']);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -547,6 +586,9 @@
|
||||
"Boolean Objects",
|
||||
"Array.filter()"
|
||||
],
|
||||
"solutions": [
|
||||
"function bouncer(arr) {\n // Don't show a false ID to this bouncer.\n return arr.filter(function(e) {return e;});\n}\n\nbouncer([7, 'ate', '', false, 9]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -586,6 +628,9 @@
|
||||
"Arguments object",
|
||||
"Array.filter()"
|
||||
],
|
||||
"solutions": [
|
||||
"function destroyer(arr) {\n var hash = Object.create(null);\n [].slice.call(arguments, 1).forEach(function(e) {\n hash[e] = true;\n });\n // Remove all the values\n return arr.filter(function(e) { return !(e in hash);});\n}\n\ndestroyer([1, 2, 3, 1, 2, 3], 2, 3);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -603,8 +648,9 @@
|
||||
"id": "a24c1a4622e3c05097f71d67",
|
||||
"title": "Where do I belong",
|
||||
"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).",
|
||||
"Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted.",
|
||||
"For example, where([1,2,3,4], 1.5) should return 1 because it is greater than 1 (index 0), but less than 2 (index 1).",
|
||||
"Likewise, where([20,3,5], 19) should return 2 because it is less than 20 (index 2) and greater than 5 (index 1).",
|
||||
"Remember to use <a href=\"//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
@ -618,12 +664,15 @@
|
||||
"MDNlinks": [
|
||||
"Array.sort()"
|
||||
],
|
||||
"solutions": [
|
||||
"function where(arr, num) {\n // Find my place in this sorted array.\n return num;\n}\n\nwhere([40, 60], 50);\n"
|
||||
],
|
||||
"tests": [
|
||||
"assert(where([10, 20, 30, 40, 50], 35) === 3, 'message: <code>where([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.');",
|
||||
"assert(where([10, 20, 30, 40, 50], 30) === 2, 'message: <code>where([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.');",
|
||||
"assert(where([40, 60], 50) === 1, 'message: <code>where([40, 60,], 50)</code> should return <code>1</code>.');",
|
||||
"assert(where([5, 3, 20, 3], 3) === 0, 'message: <code>where([5, 3, 20, 3], 3)</code> should return <code>0</code>.');",
|
||||
"assert(where([2, 20, 10], 1) === 0, 'message: <code>where([2, 20, 10], 1)</code> should return <code>0</code>.');",
|
||||
"assert(where([5, 3, 20, 3], 5) === 2, 'message: <code>where([5, 3, 20, 3], 5)</code> should return <code>2</code>.');",
|
||||
"assert(where([2, 20, 10], 19) === 2, 'message: <code>where([2, 20, 10], 19)</code> should return <code>2</code>.');",
|
||||
"assert(where([2, 5, 10], 15) === 3, 'message: <code>where([2, 5, 10], 15)</code> should return <code>3</code>.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@
|
||||
[
|
||||
"http://i.imgur.com/Wzt6Y9Y.gif",
|
||||
"A gif showing the process of saving and forking a pen.",
|
||||
"Save your pen with the \"Save\" button. Then click the \"Fork\" button. This will create a fork (copy) of your pen that you can experimient with.",
|
||||
"Save your pen with the \"Save\" button. Then click the \"Fork\" button. This will create a fork (copy) of your pen that you can experiment with.",
|
||||
""
|
||||
]
|
||||
],
|
||||
@ -68,7 +68,7 @@
|
||||
"<span class='text-info'>User Story:</span> As a user, I can click different buttons that will take me to the portfolio creator's different social media pages.",
|
||||
"<span class='text-info'>User Story:</span> As a user, I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)",
|
||||
"<span class='text-info'>Bonus User Story:</span> As a user, I navigate to different sections of the webpage by clicking buttons in the navigation.",
|
||||
"Don't worry if you don't have anything to showcase on your portfolio yet - you will build several several apps on the next few CodePen challenges, and can come back and update your portfolio later.",
|
||||
"Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.",
|
||||
"There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.",
|
||||
"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: <code><a target='_blank'></a></code>.",
|
||||
"Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck.",
|
||||
|
@ -10,12 +10,15 @@
|
||||
"Now let's go back to our Cat Photo App. This time, we'll style it using the popular Bootstrap responsive CSS framework.",
|
||||
"Bootstrap will figure out how wide your screen is and respond by resizing your HTML elements - hence the name <code>Responsive Design</code>.",
|
||||
"With responsive design, there is no need to design a mobile version of your website. It will look good on devices with screens of any width.",
|
||||
"You can add Bootstrap to any app just by including it with <code><link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css\"/></code> at the top of your HTML. But we've added it for you to this page behind the scenes.",
|
||||
"You can add Bootstrap to any app just by including it by adding the following code to the top of your HTML:",
|
||||
"<code><link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css\"/></code>",
|
||||
"In this case, we've already added it for you to this page behind the scenes.",
|
||||
"To get started, we should nest all of our HTML in a <code>div</code> element with the class <code>container-fluid</code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\"div\").hasClass(\"container-fluid\"), 'Your <code>div</code> element should have the class <code>container-fluid</code>')",
|
||||
"assert(editor.match(/<\\/div>/g) && editor.match(/<div/g) && editor.match(/<\\/div>/g).length === editor.match(/<div/g).length, 'Make sure each of your <code>div</code> elements has a closing tag.')"
|
||||
"assert($(\"div\").hasClass(\"container-fluid\"), 'Your <code>div</code> element should have the class <code>container-fluid</code>.')",
|
||||
"assert(editor.match(/<\\/div>/g) && editor.match(/<div/g) && editor.match(/<\\/div>/g).length === editor.match(/<div/g).length, 'Make sure each of your <code>div</code> elements has a closing tag.')",
|
||||
"assert($(\".container-fluid\").children().length >= 8, 'Make sure you have nested all HTML elements in <code>.container-fluid</code>.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"<link href=\"http://fonts.googleapis.com/css?family=Lobster\" rel=\"stylesheet\" type=\"text/css\">",
|
||||
@ -90,14 +93,15 @@
|
||||
"id": "bad87fee1348bd9acde08812",
|
||||
"title": "Make Images Mobile Responsive",
|
||||
"description": [
|
||||
"First, add a new image below the existing one. Set it's <code>src</code> attribute to <code>http://bit.ly/fcc-running-cats</code>.",
|
||||
"First, add a new image below the existing one. Set its <code>src</code> attribute to <code>http://bit.ly/fcc-running-cats</code>.",
|
||||
"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 <code>img-responsive</code> class to your image. Do this, and the image should perfectly fit the width of your page."
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\"img\").length > 1, 'You should have a total of two images.')",
|
||||
"assert($(\"img\").hasClass(\"img-responsive\"), 'Your new image should have the class <code>img-responsive</code>.')",
|
||||
"assert(new RegExp(\"http://bit.ly/fcc-running-cats\", \"gi\").test($(\"img.img-responsive\").attr(\"src\")), 'Add a second image with the <code>src</code> of <code>http://bit.ly/fcc-running-cats</code>.')"
|
||||
"assert($(\"img\").length === 2, 'You should have a total of two images.')",
|
||||
"assert($(\"img:eq(1)\").hasClass(\"img-responsive\"), 'Your new image should be below your old one and have the class <code>img-responsive</code>.')",
|
||||
"assert($(\"img:eq(1)\").attr(\"src\") === \"http://bit.ly/fcc-running-cats\", 'Your new image should have a <code>src</code> of <code>http://bit.ly/fcc-running-cats</code>.')",
|
||||
"assert(editor.match(/<img/g) && editor.match(/<img.*>/g).length === 2 && editor.match(/<img/g).length === 2, 'Make sure your new <code>img</code> element has a closing angle bracket.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"<link href=\"http://fonts.googleapis.com/css?family=Lobster\" rel=\"stylesheet\" type=\"text/css\">",
|
||||
@ -175,7 +179,8 @@
|
||||
"title": "Center Text with Bootstrap",
|
||||
"description": [
|
||||
"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 <code>text-center</code> to our <code>h2</code> element.",
|
||||
"Remember that you can add several classes to the same element by separating each of them with a space, like this: <code><h2 class=\"red-text text-center\">your text</h2></code>."
|
||||
"Remember that you can add several classes to the same element by separating each of them with a space, like this:",
|
||||
"<code><h2 class=\"red-text text-center\">your text</h2></code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\"h2\").hasClass(\"text-center\"), 'Your <code>h2</code> element should be centered by applying the class <code>text-center</code>')"
|
||||
@ -341,7 +346,7 @@
|
||||
"id": "bad87fee1348cd8acef08812",
|
||||
"title": "Create a Block Element Bootstrap Button",
|
||||
"description": [
|
||||
"Normally, your <code>button</code> 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.",
|
||||
"Normally, your <code>button</code> 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 and any elements following it will flow onto a \"new line\" below the block.",
|
||||
"This image illustrates the difference between <code>inline</code> elements and <code>block-level</code> elements:",
|
||||
"<a href=\"http://i.imgur.com/O32cDWE.png\" data-lightbox=\"img-enlarge\"><img class=\"img-responsive\" src=\"http://i.imgur.com/O32cDWE.png\" title=\"Click to enlarge\" alt=\"An \"inline\" button is as small as the text it contains. In this image, it's centered. Below it is a \"block-level\" button, which stretches to fill the entire horizontal space.'></a>",
|
||||
"Note that these buttons still need the <code>btn</code> class.",
|
||||
@ -888,7 +893,8 @@
|
||||
"<a href=\"http://i.imgur.com/O32cDWE.png\" data-lightbox=\"img-enlarge\"><img class=\"img-responsive\" src=\"http://i.imgur.com/O32cDWE.png\" title=\"Click to enlarge\" alt=\"An \"inline\" button is as small as the text it contains. In this image, it's centered. Below it is a \"block-level\" button, which stretches to fill the entire horizontal space.'></a>",
|
||||
"By using the <code>span</code> element, you can put several elements together, and even style different parts of the same element differently.",
|
||||
"Nest the word \"love\" in your \"Things cats love\" element below within a <code>span</code> element. Then give that <code>span</code> the class <code>text-danger</code> to make the text red.",
|
||||
"Here's how you would do this with the \"Top 3 things cats hate\" element: <code><p>Top 3 things cats <span class = \"text-danger\">hate</span></p></code>"
|
||||
"Here's how you would do this with the \"Top 3 things cats hate\" element:",
|
||||
"<code><p>Top 3 things cats <span class = \"text-danger\">hate</span></p></code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\"p span\") && $(\"p span\").length > 0, 'Your <code>span</code> element should be inside your <code>p</code> element.')",
|
||||
@ -1904,9 +1910,10 @@
|
||||
"title": "Add ID Attributes to Bootstrap Elements",
|
||||
"description": [
|
||||
"Recall that in addition to class attributes, you can give each of your elements an <code>id</code> attribute.",
|
||||
"Each id should be unique to a specific element.",
|
||||
"Each id must be unique to a specific element and used only once per page.",
|
||||
"Let's give a unique id to each of our <code>div</code> elements of class <code>well</code>.",
|
||||
"Remember that you can give an element an id like this: <code><div class=\"well\" id=\"center-well\"></code>",
|
||||
"Remember that you can give an element an id like this:",
|
||||
"<code><div class=\"well\" id=\"center-well\"></code>",
|
||||
"Give the well on the left the id of <code>left-well</code>. Give the well on the right the <code>id</code> of <code>right-well</code>."
|
||||
],
|
||||
"tests": [
|
||||
@ -2106,11 +2113,11 @@
|
||||
"When we start using jQuery, we will modify HTML elements without needing to actually change them in HTML.",
|
||||
"Let's make sure that everyone knows they shouldn't actually modify any of this code directly.",
|
||||
"Remember that you can start a comment with <code><!--</code> and end a comment with <code>--></code>",
|
||||
"Add a comment at the top of your HTML that says <code>You shouldn't need to modify code below this line</code>."
|
||||
"Add a comment at the top of your HTML that says <code>Only change code above this line.</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/<!--/g) && editor.match(/<!--/g).length > 0, 'Start a comment with <code><!--</code>.')",
|
||||
"assert(editor.match(/this line/g) && editor.match(/this line/g).length > 0, 'Your comment should have the text <code>You shouldn't need to modify code below this line</code>.')",
|
||||
"assert(editor.match(/this line/g) && editor.match(/this line/g).length > 0, 'Your comment should have the text <code>Only change code above this line</code>.')",
|
||||
"assert(editor.match(/-->.*\\n+.+/g), 'Be sure to close your comment with <code>--></code>.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
@ -11,7 +11,7 @@
|
||||
[
|
||||
"http://i.imgur.com/YNwsMXM.gif",
|
||||
"A gif showing how you can access our Camper News page and click the \"upvote\" button to upvote a story.",
|
||||
"Click the \"News\" button in your upper right hand corner. You can browse links on Camper News and upvote ones that you enjoy.",
|
||||
"Click the \"News\" button in your upper right hand corner. <br>You can browse links on Camper News and upvote the ones that you enjoy.",
|
||||
""
|
||||
]
|
||||
],
|
||||
@ -37,7 +37,7 @@
|
||||
[
|
||||
"http://i.imgur.com/4GO4zcI.gif",
|
||||
"A gif showing how you can click the \"Wiki\" button in your upper-right corner to access the wiki.",
|
||||
"Click the \"Wiki\" button in your upper right hand corner. Our community has contributed lots of useful information to this searchable wiki.",
|
||||
"Click the \"Wiki\" button in your upper right hand corner. <br>Our community has contributed lots of useful information to this searchable wiki.",
|
||||
""
|
||||
]
|
||||
],
|
||||
@ -63,7 +63,7 @@
|
||||
[
|
||||
"http://i.imgur.com/vJyiXzU.gif",
|
||||
"A gif showing how you can click the link below and fill in the necessary fields to add your Free Code Camp studies to your LinkedIn profile.",
|
||||
"You can add Free Code Camp to your LinkedIn education background. Set your graduation date as next year. For \"Degree\", type \"Full Stack Web Development Certification\". For \"Field of study\", type \"Computer Software Engineering\". Then click \"Save Changes\".",
|
||||
"LinkedIn recognizes Free Code Camp as a university. You can gain access to our large alumni network by adding Free Code Camp to your LinkedIn profile's education section. <br>Set your graduation date as next year. <br>For \"Degree\", type \"Full Stack Web Development Certification\". <br>For \"Field of study\", type \"Computer Software Engineering\". <br>Then click \"Save Changes\".",
|
||||
"https://www.linkedin.com/profile/edit-education?school=Free+Code+Camp"
|
||||
]
|
||||
],
|
||||
@ -89,7 +89,7 @@
|
||||
[
|
||||
"http://i.imgur.com/Og1ifsn.gif",
|
||||
"A gif showing how you can commit to a goal for your Free Code Camp studies and pledge a monthly donation to a nonprofit to give you external motivation to reach that goal.",
|
||||
"You can set a goal and pledge to donate to a nonprofit each month until you achieve that goal. give you external motivation in your quest to learn to code, as well as the opportunity to help nonprofits right away. Choose your goal, choose a monthly donation. When you click \"commit\", the nonprofit's donate page will open in a new tab. You can change your commitment or stop it at any time.",
|
||||
"You can set a goal and pledge to donate to a nonprofit each month until you achieve that goal. <br>This will give you external motivation in your quest to learn to code, as well as an opportunity to help nonprofits right away. <br>Choose your goal, then choose a monthly donation. When you click \"commit\", the nonprofit's donation page will open in a new tab. <br>This is completely optional, and you can change your commitment or stop it at any time.",
|
||||
"/commit"
|
||||
]
|
||||
],
|
||||
|
@ -15,27 +15,39 @@
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/pYsTbjI.jpg",
|
||||
"A screenshot of our curriculum alongside a screenshot of our chat room.",
|
||||
"Learning to code is hard. To succeed, you'll need lots of practice and support. That's why we've created a rigorous curriculum and supportive community.",
|
||||
"http://i.imgur.com/Elb3dfj.jpg",
|
||||
"A screenshot of some of our campers coding together in Toronto.",
|
||||
"<bold>Learning to code is hard.</bold> To succeed, you'll need lots of practice and support. That's why we've created a rigorous curriculum and supportive community.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/D7Y5luw.jpg",
|
||||
"A graph of the rate of job growth against growth in computer science degree graduates. There are 1.4 million jobs and only 400 million people to fill them.",
|
||||
"There are thousands of coding jobs currently going unfilled, and the demand for coders grows every year. If you want a coding job, we can help prepare you to get one.",
|
||||
"There are thousands of coding jobs currently going unfilled, and the demand for coders grows every year.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/WD3STY6.jpg",
|
||||
"Photos of three campers who've gotten jobs after learning to code at Free Code Camp.",
|
||||
"Free Code Camp is a proven path to your first coding job. In fact, no one has actually completed our entire program, because campers get jobs before they're able to.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/dLx8nrg.jpg",
|
||||
"An illustration showing that you will learn HTML5, CSS3, JavaScript, Databases, Git, Node.js, Angular.js and Agile.",
|
||||
"First you'll work through our rigorous 800-hour curriculum learn technologies like HTML5, Node.js and databases. It's self-paced and 100% free.",
|
||||
"During the first half of Free Code Camp, you'll learn technologies like HTML5, Node.js and databases.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/syJxavV.jpg",
|
||||
"A screenshot of our Front End Development Certificate",
|
||||
"About 400 hours into Free Code Camp, you'll earn your verified Front End Development Certification.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/sKYQhdG.jpg",
|
||||
"A screenshot of our Front End Development Certificate",
|
||||
"About half way through our curriculum, you'll earn a verified Front End Development Certificate. If you can finish our entire curriculum, you'll earn a verified Full Stack Development Certificate.",
|
||||
"A screenshot of our Full Stack Development Certificate",
|
||||
"About 800 hours into Free Code Camp, you'll earn your verified Full Stack Development Certification.",
|
||||
""
|
||||
],
|
||||
[
|
||||
@ -79,7 +91,7 @@
|
||||
[
|
||||
"http://i.imgur.com/ALN6zPK.gif",
|
||||
"A gif showing you how to click the profile image in the upper right hand corner of GitHub. Upload a photo of yourself or you will continue to use the automatically generated pixel art. Then fill in the remaining form fields and click submit.",
|
||||
"Click the pixel art in the upper right hand corner of GitHub, then choose settings. Upload a picture of yourself. A picture of your face works best. This is how your fellow campers will see you in our chat rooms, so put your best foot forward. You can add your city and your name if you want.",
|
||||
"Click the pixel art in the upper right hand corner of GitHub, then choose settings. <br>Upload a picture of yourself. A picture of your face works best. This is how your fellow campers will see you in our chat rooms, so put your best foot forward. <br>You can add your city and your name if you want.",
|
||||
"https://github.com/settings/profile"
|
||||
],
|
||||
[
|
||||
@ -91,7 +103,7 @@
|
||||
[
|
||||
"http://i.imgur.com/zwYPeQT.gif",
|
||||
"A gif showing you how to click the link below to go to our chat room and click the \"sign in with GitHub\" button. Then you can click into the text input field and type a message to your fellow campers.",
|
||||
"Now that you have a GitHub account, you can join our main chat room by logging in with GitHub. Introduce yourself by saying \"Hello world!\". Tell your fellow campers how you found Free Code Camp. Also tell us why you want to learn to code.",
|
||||
"Now that you have a GitHub account, you can join our main chat room by logging in with GitHub. Introduce yourself by saying \"Hello world!\". <br>Tell your fellow campers how you found Free Code Camp. Also tell us why you want to learn to code.",
|
||||
"https://gitter.im/FreeCodeCamp/FreeCodeCamp"
|
||||
],
|
||||
[
|
||||
@ -141,7 +153,7 @@
|
||||
[
|
||||
"http://i.imgur.com/tP2ccTE.gif",
|
||||
"A gif showing how you can click your profile image in your upper right hand corner to your code portfolio and connect GitHub.",
|
||||
"Check out your code portfolio. Click your picture in your upper right hand corner. To activate your code portfolio, you'll need to link your GitHub account with Free Code Camp. Your code portfolio shows your progress and how many Brownie Points you have. You can get Brownie Points by completing challenges and by helping other campers in our chat rooms. If you get Brownie Points on several days in a row, you'll get a streak.",
|
||||
"Check out your code portfolio. Click your picture in your upper right hand corner. To activate your code portfolio, you'll need to link your GitHub account with Free Code Camp. <br>Your code portfolio shows your progress and how many Brownie Points you have. You can get Brownie Points by completing challenges and by helping other campers in our chat rooms. If you get Brownie Points on several days in a row, you'll get a streak.",
|
||||
""
|
||||
]
|
||||
],
|
||||
@ -165,7 +177,7 @@
|
||||
"challengeSeed": [],
|
||||
"description": [
|
||||
[
|
||||
"http://i.imgur.com/Elb3dfj.jpg",
|
||||
"http://i.imgur.com/NAOFJWN.jpg",
|
||||
"A picture of some of our campers meeting in a local cafe. 3 men and 3 women are sitting around a table with laptops out, and are smiling and coding.",
|
||||
"Our Campsites help you code with campers in your city. You can coordinate study groups or attend local coding events together.",
|
||||
""
|
||||
@ -173,7 +185,7 @@
|
||||
[
|
||||
"http://i.imgur.com/fTFMjwf.gif",
|
||||
"A gif showing how you can click the link below, find your city on the list of Campsites, then click on the Facebook link for your city and join your city's Facebook group.",
|
||||
"Find your city on this list and click it. This will take you to your city's Campsite's Facebook group. Click the \"Join group\" button to apply to join your city's Facebook group. Someone from the campsite should approve you shortly. If your city isn't on this list, scroll to the bottom of the wiki article for instructions for how you can create your city's Campsite.",
|
||||
"Find your city on this list and click it. This will take you to your city's Campsite's Facebook group. <br>Click the \"Join group\" button to apply to join your city's Facebook group. Someone from the campsite should approve you shortly. <br>If your city isn't on this list, scroll to the bottom of the wiki article for instructions for how you can create your city's Campsite.",
|
||||
"https://github.com/FreeCodeCamp/freecodecamp/wiki/List-of-Free-Code-Camp-city-based-Campsites"
|
||||
]
|
||||
],
|
||||
@ -196,10 +208,28 @@
|
||||
"title": "Learn What to Do If You Get Stuck",
|
||||
"challengeSeed": [],
|
||||
"description": [
|
||||
[
|
||||
"http://i.imgur.com/lzKvwU2.jpg",
|
||||
"The text \"Coding is hard.\"",
|
||||
"Coding is hard. You will get stuck. Even experienced coders get stuck. The key is knowing how to get unstuck.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/sfsidp6.jpg",
|
||||
"The text \"It takes time to get good at coding.\"",
|
||||
"It takes time to get good at coding. You wouldn't expect to beat a chess master after playing for 3 months. Don't expect to build the next Facebook after coding for 3 months.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/EoTfOyC.jpg",
|
||||
"An image of some of our campers coding together in Montreal.",
|
||||
"Keep practicing coding every day and hanging out with other people who code, and you will becoming a job-ready coder.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"http://i.imgur.com/EWWZBag.jpg",
|
||||
"An image with the text \"1. Read the error 2. Search Google 3. Ask for help.",
|
||||
"Let's cover one last thing before you start working through our challenges: how to get help. Any time you get stuck or don't know what to do next: Read-Search-Ask.",
|
||||
"Any time you get stuck or don't know what to do next: Read-Search-Ask.",
|
||||
""
|
||||
],
|
||||
[
|
||||
@ -223,7 +253,7 @@
|
||||
[
|
||||
"http://i.imgur.com/ZRgXraT.gif",
|
||||
"A gif showing us scrolling through our challenge map.",
|
||||
"Now you're ready to start coding! The \"Map\" button in your upper right hand corner will show you our challenge map. This map shows all our coding challenges. We recommend that you complete these from top to bottom, at a sustainable pace. You can also return to your next challenge by clicking the \"Learn\" button.",
|
||||
"Now you're ready to start coding. <br>The \"Map\" button in your upper right hand corner will show you our challenge map. <br>We recommend that you complete these from top to bottom, at a sustainable pace. <br>Our open source community is constantly improving our challenges, so don't be surprised if they change or move around. Don't worry about going back - just keep moving forward. <br>You can always go to your most recent challenge by clicking the \"Learn\" button.",
|
||||
""
|
||||
]
|
||||
],
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,9 @@
|
||||
"Math.min()",
|
||||
"Array.reduce()"
|
||||
],
|
||||
"solutions": [
|
||||
"function sumAll(arr) {\n var sum = 0;\n arr.sort(function(a,b) {return a-b;});\n for (var i = arr[0]; i <= arr[1]; i++) {\n sum += i; \n }\n return sum;\n}\n\nsumAll([1, 4]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -67,8 +70,7 @@
|
||||
"assert.deepEqual(diff([1, 2, 3, 5], [1, 2, 3, 4, 5]), [4], 'message: <code>[1, 2, 3, 5], [1, 2, 3, 4, 5]</code> should return <code>[4]</code>.');",
|
||||
"assert.includeMembers(diff([1, \"calf\", 3, \"piglet\"], [1, \"calf\", 3, 4]), [\"piglet\", 4], 'message: <code>[1, \"calf\", 3, \"piglet\"], [1, \"calf\", 3, 4]</code> should return <code>[\"piglet\", 4]</code>.');",
|
||||
"assert.deepEqual(diff([], [\"snuffleupagus\", \"cookie monster\", \"elmo\"]), [\"snuffleupagus\", \"cookie monster\", \"elmo\"], 'message: <code>[], [\"snuffleupagus\", \"cookie monster\", \"elmo\"]</code> should return <code>[\"snuffleupagus\", \"cookie monster\", \"elmo\"]</code>.');",
|
||||
"assert.includeMembers(diff([1, \"calf\", 3, \"piglet\"], [7, \"filly\"]), [1, \"calf\", 3, \"piglet\", 7, \"filly\"], 'message: <code>[1, \"calf\", 3, \"piglet\"], [7, \"filly\"]</code> should return <code>[1, \"calf\", 3, \"piglet\", 7, \"filly\"]</code>.');",
|
||||
"assert.deepEqual(diff([1, 2, 3, 3], [1]), [2, 3], 'message: <code>[1, 2, 3, 3], [1]</code> should return <code>[2, 3]</code>.');"
|
||||
"assert.includeMembers(diff([1, \"calf\", 3, \"piglet\"], [7, \"filly\"]), [1, \"calf\", 3, \"piglet\", 7, \"filly\"], 'message: <code>[1, \"calf\", 3, \"piglet\"], [7, \"filly\"]</code> should return <code>[1, \"calf\", 3, \"piglet\", 7, \"filly\"]</code>.');"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Comparison Operators",
|
||||
@ -77,6 +79,9 @@
|
||||
"Array.indexOf()",
|
||||
"Array.concat()"
|
||||
],
|
||||
"solutions": [
|
||||
"function diff(arr1, arr2) {\n var newArr = [];\n var h1 = Object.create(null);\n arr1.forEach(function(e) {\n h1[e] = e;\n });\n \n var h2 = Object.create(null);\n arr2.forEach(function(e) {\n h2[e] = e;\n });\n \n Object.keys(h1).forEach(function(e) {\n if (!(e in h2)) newArr.push(h1[e]);\n });\n Object.keys(h2).forEach(function(e) {\n if (!(e in h1)) newArr.push(h2[e]);\n });\n // Same, same; but different.\n return newArr;\n}\n\ndiff([1, 2, 3, 5], [1, 2, 3, 4, 5]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -94,11 +99,25 @@
|
||||
"id": "a7f4d8f2483413a6ce226cac",
|
||||
"title": "Roman Numeral Converter",
|
||||
"tests": [
|
||||
"assert.deepEqual(convert(12), \"XII\", 'message: <code>convert(12)</code> should return \"XII\".');",
|
||||
"assert.deepEqual(convert(5), \"V\", 'message: <code>convert(5)</code> should return \"V\".');",
|
||||
"assert.deepEqual(convert(9), \"IX\", 'message: <code>convert(9)</code> should return \"IX\".');",
|
||||
"assert.deepEqual(convert(12), \"XII\", 'message: <code>convert(12)</code> should return \"XII\".');",
|
||||
"assert.deepEqual(convert(16), \"XVI\", 'message: <code>convert(16)</code> should return \"XVI\".');",
|
||||
"assert.deepEqual(convert(29), \"XXIX\", 'message: <code>convert(29)</code> should return \"XXIX\".');",
|
||||
"assert.deepEqual(convert(16), \"XVI\", 'message: <code>convert(16)</code> should return \"XVI\".');"
|
||||
"assert.deepEqual(convert(44), \"XLIV\", 'message: <code>convert(44)</code> should return \"XLIV\".');",
|
||||
"assert.deepEqual(convert(45), \"XLV\", '<code>convert(45)</code> should return \"XLV\"');",
|
||||
"assert.deepEqual(convert(68), \"LXVIII\", '<code>convert(68)</code> should return \"LXVIII\"');",
|
||||
"assert.deepEqual(convert(83), \"LXXXIII\", '<code>convert(83)</code> should return \"LXXXIII\"');",
|
||||
"assert.deepEqual(convert(97), \"XCVII\", '<code>convert(97)</code> should return \"XCVII\"');",
|
||||
"assert.deepEqual(convert(99), \"XCIX\", '<code>convert(99)</code> should return \"XCIX\"');",
|
||||
"assert.deepEqual(convert(500), \"D\", '<code>convert(500)</code> should return \"D\"');",
|
||||
"assert.deepEqual(convert(501), \"DI\", '<code>convert(501)</code> should return \"DI\"');",
|
||||
"assert.deepEqual(convert(649), \"DCXLIX\", '<code>convert(649)</code> should return \"DCXLIX\"');",
|
||||
"assert.deepEqual(convert(798), \"DCCXCVIII\", '<code>convert(798)</code> should return \"DCCXCVIII\"');",
|
||||
"assert.deepEqual(convert(891), \"DCCCXCI\", '<code>convert(891)</code> should return \"DCCCXCI\"');",
|
||||
"assert.deepEqual(convert(1000), \"M\", '<code>convert(1000)</code> should return \"M\"');",
|
||||
"assert.deepEqual(convert(1004), \"MIV\", '<code>convert(1004)</code> should return \"MIV\"');",
|
||||
"assert.deepEqual(convert(1006), \"MVI\", '<code>convert(1006)</code> should return \"MVI\"');"
|
||||
],
|
||||
"description": [
|
||||
"Convert the given number into a roman numeral.",
|
||||
@ -118,6 +137,9 @@
|
||||
"Array.indexOf()",
|
||||
"Array.join()"
|
||||
],
|
||||
"solutions": [
|
||||
"function convert(num) {\n var ref = [['M', 1000], ['CM', 900], ['D', 500], ['CD', 400], ['C', 100], ['XC', 90], ['L', 50], ['XL', 40], ['X', 10], ['IX', 9], ['V', 5], ['IV', 4], ['I', 1]];\n var res = [];\n ref.forEach(function(p) {\n while (num >= p[1]) {\n res.push(p[0]);\n num -= p[1];\n }\n });\n return res.join('');\n}\n\nconvert(36);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -149,7 +171,7 @@
|
||||
"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\" }], 'message: <code>where()</code> should return an array of objects.');",
|
||||
"assert.deepEqual(where([{ first: \"Romeo\", last: \"Montague\" }, { first: \"Mercutio\", last: null }, { first: \"Tybalt\", last: \"Capulet\" }], { last: \"Capulet\" }), [{ first: \"Tybalt\", last: \"Capulet\" }], 'message: <code>where([{ first: \"Romeo\", last: \"Montague\" }, { first: \"Mercutio\", last: null }, { first: \"Tybalt\", last: \"Capulet\" }], { last: \"Capulet\" })</code> should return <code>[{ first: \"Tybalt\", last: \"Capulet\" }]</code>.');",
|
||||
"assert.deepEqual(where([{ \"a\": 1 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2 }], { \"a\": 1 }), [{ \"a\": 1 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2 }], 'message: <code>where([{ \"a\": 1 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2 }], { \"a\": 1 })</code> should return <code>[{ \"a\": 1 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2 }]</code>.');",
|
||||
"assert.deepEqual(where([{ \"a\": 1, \"b\": 2 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2, \"c\": 2 }], { \"a\": 1, \"b\": 2 }), [{ \"a\": 1, \"b\": 2 }, { \"a\": 1, \"b\": 2, \"c\": 2 }], 'message: <code>where([{ \"a\": 1, \"b\": 2 }, { \"a\": 1 }, { \"a\": 1, \"b\": 2, \"c\": 2 }], { \"a\": 1, \"b\": 2 })</code> should return <code>[{ \"a\": 1, \"b\": 2 }, { \"a\": 1, \"b\": 2, \"c\": 2 }]</code>.');"
|
||||
],
|
||||
@ -158,6 +180,9 @@
|
||||
"Object.hasOwnProperty()",
|
||||
"Object.keys()"
|
||||
],
|
||||
"solutions": [
|
||||
"function where(collection, source) {\n var arr = [];\n var keys = Object.keys(source);\n collection.forEach(function(e) {\n if(keys.every(function(key) {return e[key] === source[key];})) {\n arr.push(e); \n }\n });\n return arr;\n}\n\nwhere([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -177,7 +202,7 @@
|
||||
"tests": [
|
||||
"assert.deepEqual(myReplace(\"Let us go to the store\", \"store\", \"mall\"), \"Let us go to the mall\", 'message: <code>myReplace(\"Let us go to the store\", \"store\", \"mall\")</code> should return \"Let us go to the mall\".');",
|
||||
"assert.deepEqual(myReplace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\"), \"He is Sitting on the couch\", 'message: <code>myReplace(\"He is Sleeping on the couch\", \"Sleeping\", \"sitting\")</code> should return \"He is Sitting on the couch\".');",
|
||||
"assert.deepEqual(myReplace(\"This has a spellngi error\", \"spellngi\", \"spelling\"), \"This has a spelling error\", 'message: <code>myReplace(\"This has a spellngi error\", \"spellingi\", \"spelling\")</code> should return \"This has a spelling error\".');",
|
||||
"assert.deepEqual(myReplace(\"This has a spellngi error\", \"spellngi\", \"spelling\"), \"This has a spelling error\", 'message: <code>myReplace(\"This has a spellngi error\", \"spellngi\", \"spelling\")</code> should return \"This has a spelling error\".');",
|
||||
"assert.deepEqual(myReplace(\"His name is Tom\", \"Tom\", \"john\"), \"His name is John\", 'message: <code>myReplace(\"His name is Tom\", \"Tom\", \"john\")</code> should return \"His name is John\".');",
|
||||
"assert.deepEqual(myReplace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\"), \"Let us get back to more Bonfires\", 'message: <code>myReplace(\"Let us get back to more Coding\", \"Coding\", \"bonfires\")</code> should return \"Let us get back to more Bonfires\".');"
|
||||
],
|
||||
@ -201,6 +226,9 @@
|
||||
"String.replace()",
|
||||
"Array.join()"
|
||||
],
|
||||
"solutions": [
|
||||
"function replace(str, before, after) {\n if (before.charAt(0) === before.charAt(0).toUpperCase()) {\n after = after.charAt(0).toUpperCase() + after.substring(1);\n } else {\n after = after.charAt(0).toLowerCase() + after.substring(1);\n }\n return str.replace(before, after);\n}\n\nreplace(\"A quick brown fox jumped over the lazy dog\", \"jumped\", \"leaped\");\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -244,6 +272,9 @@
|
||||
"String.substr()",
|
||||
"String.split()"
|
||||
],
|
||||
"solutions": [
|
||||
"function translate(str) {\n if (isVowel(str.charAt(0))) return str + \"way\";\n var front = [];\n str = str.split('');\n while (str.length && !isVowel(str[0])) {\n front.push(str.shift());\n }\n return [].concat(str, front).join('') + 'ay';\n}\n\nfunction isVowel(c) {\n return ['a', 'e', 'i', 'o', 'u'].indexOf(c.toLowerCase()) !== -1;\n}\n\ntranslate(\"consonant\");\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -284,6 +315,9 @@
|
||||
"Array.push()",
|
||||
"String.split()"
|
||||
],
|
||||
"solutions": [
|
||||
"var lookup = Object.create(null);\nlookup.A = 'T';\nlookup.T = 'A';\nlookup.C = 'G';\nlookup.G = 'C';\n\nfunction pair(str) {\n return str.split('').map(function(p) {return [p, lookup[p]];});\n}\n\npair(\"GCG\");\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -322,6 +356,9 @@
|
||||
"String.charCodeAt()",
|
||||
"String.fromCharCode()"
|
||||
],
|
||||
"solutions": [
|
||||
"function fearNotLetter(str) {\n var s = str.split('').map(function(c) {return c.charCodeAt(0);});\n for (var i = 1; i < s.length; i++) {\n if (s[i]-1 != s[i-1]) {\n return String.fromCharCode(s[i]-1);\n }\n }\n}\n\nfearNotLetter('abce');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -364,6 +401,9 @@
|
||||
"MDNlinks": [
|
||||
"Boolean Objects"
|
||||
],
|
||||
"solutions": [
|
||||
"function boo(bool) {\n // What is the new fad diet for ghost developers? The Boolean.\n return typeof(bool) === \"boolean\";\n}\n\nboo(null);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -404,6 +444,9 @@
|
||||
"Arguments object",
|
||||
"Array.reduce()"
|
||||
],
|
||||
"solutions": [
|
||||
"function unite(arr1, arr2, arr3) {\n return [].slice.call(arguments).reduce(function(a, b) {\n return [].concat(a, b.filter(function(e) {return a.indexOf(e) === -1;}));\n }, []);\n}\n\nunite([1, 2, 3], [5, 2, 1, 4], [2, 1]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -445,6 +488,9 @@
|
||||
"RegExp",
|
||||
"HTML Entities"
|
||||
],
|
||||
"solutions": [
|
||||
"var MAP = { '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''};\n\nfunction convert(str) {\n return str.replace(/[&<>\"']/g, function(c) {\n return MAP[c];\n });\n}\n\nconvert('Dolce & Gabbana');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -484,6 +530,9 @@
|
||||
"RegExp",
|
||||
"String.replace()"
|
||||
],
|
||||
"solutions": [
|
||||
"function spinalCase(str) {\n // \"It's such a fine line between stupid, and clever.\"\n // --David St. Hubbins\n str = str.replace(/([a-z](?=[A-Z]))/g, '$1 ');\n return str.toLowerCase().replace(/\\ |\\_/g, '-');\n}\n\nspinalCase('This Is Spinal Tap');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -524,6 +573,9 @@
|
||||
"MDNlinks": [
|
||||
"Remainder"
|
||||
],
|
||||
"solutions": [
|
||||
"function sumFibs(num) {\n var a = 1; \n var b = 1;\n var s = 0;\n while (a <= num) {\n if (a % 2 !== 0) { \n s += a; \n }\n a = [b, b=b+a][0];\n }\n return s;\n}\n\nsumFibs(4);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -562,6 +614,9 @@
|
||||
"For Loops",
|
||||
"Array.push()"
|
||||
],
|
||||
"solutions": [
|
||||
"function eratosthenesArray(n) {\n var primes = [];\n if (n > 2) {\n var half = n>>1;\n var sieve = Array(half);\n for (var i = 1, limit = Math.sqrt(n)>>1; i <= limit; i++) {\n if (!sieve[i]) {\n for (var step = 2*i+1, j = (step*step)>>1; j < half; j+=step) {\n sieve[j] = true;\n }\n }\n }\n primes.push(2);\n for (var p = 1; p < half; p++) {\n if (!sieve[p]) primes.push(2*p+1);\n }\n }\n return primes;\n}\n\nfunction sumPrimes(num) {\n return eratosthenesArray(num+1).reduce(function(a,b) {return a+b;}, 0);\n}\n\nsumPrimes(10);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -601,6 +656,9 @@
|
||||
"MDNlinks": [
|
||||
"Smallest Common Multiple"
|
||||
],
|
||||
"solutions": [
|
||||
"function gcd(a, b) {\n while (b !== 0) {\n a = [b, b = a % b][0];\n }\n return a;\n}\n\nfunction lcm(a, b) {\n return (a * b) / gcd(a, b);\n}\n\nfunction smallestCommons(arr) {\n arr.sort(function(a,b) {return a-b;});\n var rng = [];\n for (var i = arr[0]; i <= arr[1]; i++) {\n rng.push(i);\n }\n return rng.reduce(lcm);\n}\n\n\nsmallestCommons([1,5]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -634,7 +692,10 @@
|
||||
"assert.strictEqual(find([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, 'message: <code>find([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.');"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Array.some()"
|
||||
"Array.filter()"
|
||||
],
|
||||
"solutions": [
|
||||
"function find(arr, func) {\n var num;\n arr.some(function(e) {\n if (func(e)) {\n num = e;\n return true;\n }\n });\n return num;\n}\n\nfind([1, 2, 3, 4], function(num){ return num % 2 === 0; });\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
@ -665,15 +726,18 @@
|
||||
"drop([1, 2, 3], function(n) {return n < 3; });"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(drop([1, 2, 3, 4], function(n) {return n>= 3;}), [3, 4], 'message: <code>drop([1, 2, 3, 4], function(n) {return n>= 3;})</code> should return <code>[3, 4]</code>.');",
|
||||
"assert.deepEqual(drop([1, 2, 3, 4], function(n) {return n>= 3;}), [3, 4], 'message: <code>drop([1, 2, 3, 4], function(n) {return n >= 3;})</code> should return <code>[3, 4]</code>.');",
|
||||
"assert.deepEqual(drop([1, 2, 3], function(n) {return n > 0; }), [1, 2, 3], 'message: <code>drop([1, 2, 3], function(n) {return n > 0; })</code> should return <code>[1, 2, 3]</code>.');",
|
||||
"assert.deepEqual(drop([1, 2, 3, 4], function(n) {return n > 5;}), [], 'message: <code>drop([1, 2, 3, 4], function(n) {return n > 5;})</code> should return <code>[]</code>.');",
|
||||
"assert.deepEqual(drop([1, 2, 3, 7, 4], function(n) {return n > 3}), [7, 4], 'message: <code>drop([1, 2, 3, 7, 4], function(n) {return n>= 3})</code> should return <code>[7, 4]</code>.');"
|
||||
"assert.deepEqual(drop([1, 2, 3, 7, 4], function(n) {return n > 3}), [7, 4], 'message: <code>drop([1, 2, 3, 7, 4], function(n) {return n > 3})</code> should return <code>[7, 4]</code>.');"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Arguments object",
|
||||
"Array.shift()"
|
||||
],
|
||||
"solutions": [
|
||||
"(function drop(arr, func) {\n // Drop them elements.\n while (arr.length && !func(arr[0])) {\n arr.shift();\n }\n return arr;\n}\n\ndrop([1, 2, 3], function(n) {return n < 3; });\n)"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -711,6 +775,9 @@
|
||||
"MDNlinks": [
|
||||
"Array.isArray()"
|
||||
],
|
||||
"solutions": [
|
||||
"function steamroller(arr) {\n if (!Array.isArray(arr)) {\n return [arr];\n }\n var out = [];\n arr.forEach(function(e) {\n steamroller(e).forEach(function(v) {\n out.push(v);\n });\n });\n return out;\n}\n\nsteamroller([1, [2], [3, [[4]]]]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -747,6 +814,9 @@
|
||||
"String.charCodeAt()",
|
||||
"String.fromCharCode()"
|
||||
],
|
||||
"solutions": [
|
||||
"function binaryAgent(str) {\n return str.split(' ').map(function(s) { return parseInt(s, 2); }).map(function(b) { return String.fromCharCode(b);}).join('');\n}\n\nbinaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -764,14 +834,13 @@
|
||||
"id": "a10d2431ad0c6a099a4b8b52",
|
||||
"title": "Everything Be True",
|
||||
"description": [
|
||||
"Check if the predicate (second argument) returns truthy (defined) for all elements of a collection (first argument).",
|
||||
"For this, check to see if the property defined in the second argument is present on every element of the collection.",
|
||||
"Check if the predicate (second argument) is truthy on all elements of a collection (first argument).",
|
||||
"Remember, you can access object properties through either dot notation or [] notation.",
|
||||
"Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function every(collection, pre) {",
|
||||
" // Does everyone have one of these?",
|
||||
" // Is everyone being true?",
|
||||
" return pre;",
|
||||
"}",
|
||||
"",
|
||||
@ -779,12 +848,17 @@
|
||||
],
|
||||
"tests": [
|
||||
"assert.strictEqual(every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\"}, {\"user\": \"Dipsy\", \"sex\": \"male\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], \"sex\"), true, 'message: <code>every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\"}, {\"user\": \"Dipsy\", \"sex\": \"male\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], \"sex\")</code> should return true.');",
|
||||
"assert.strictEqual(every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\"}, {\"user\": \"Dipsy\", \"sex\": \"male\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], {\"sex\": \"female\"}), false, 'message: <code>every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\"}, {\"user\": \"Dipsy\", \"sex\": \"male\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], {\"sex\": \"female\"})</code> should return false.');",
|
||||
"assert.strictEqual(every([{\"user\": \"Tinky-Winky\", \"sex\": \"female\"}, {\"user\": \"Dipsy\", \"sex\": \"male\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], {\"sex\": \"female\"}), false, 'message: <code>every([{\"user\": \"Tinky-Winky\", \"sex\": \"female\"}, {\"user\": \"Dipsy\", \"sex\": \"male\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], {\"sex\": \"female\"})</code> should return false.');"
|
||||
"assert.strictEqual(every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\"}, {\"user\": \"Dipsy\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], \"sex\"), false, 'message: <code>every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\"}, {\"user\": \"Dipsy\"}, {\"user\": \"Laa-Laa\", \"sex\": \"female\"}, {\"user\": \"Po\", \"sex\": \"female\"}], \"sex\")</code> should return false.');",
|
||||
"assert.strictEqual(every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\", \"age\": 2}, {\"user\": \"Dipsy\", \"sex\": \"male\", \"age\": 0}, {\"user\": \"Laa-Laa\", \"sex\": \"female\", \"age\": 5}, {\"user\": \"Po\", \"sex\": \"female\", \"age\": 4}], \"age\"), false, 'message: <code>every([{\"user\": \"Tinky-Winky\", \"sex\": \"male\", \"age\": 0}, {\"user\": \"Dipsy\", \"sex\": \"male\", \"age\": 3}, {\"user\": \"Laa-Laa\", \"sex\": \"female\", \"age\": 5}, {\"user\": \"Po\", \"sex\": \"female\", \"age\": 4}], \"age\")</code> should return false.');",
|
||||
"assert.strictEqual(every([{\"name\": \"Pete\", \"onBoat\": true}, {\"name\": \"Repeat\", \"onBoat\": true}, {\"name\": \"FastFoward\", \"onBoat\": null}], \"onBoat\"), false, 'message: <code>every([{\"name\": \"Pete\", \"onBoat\": true}, {\"name\": \"Repeat\", \"onBoat\": true}, {\"name\": \"FastFoward\", \"onBoat\": null}], \"onBoat\")</code> should return false');",
|
||||
"assert.strictEqual(every([{\"name\": \"Pete\", \"onBoat\": true}, {\"name\": \"Repeat\", \"onBoat\": true, \"alias\": \"Repete\"}, {\"name\": \"FastFoward\", \"onBoat\": true}], \"onBoat\"), true, 'message: <code>every([{\"name\": \"Pete\", \"onBoat\": true}, {\"name\": \"Repeat\", \"onBoat\": true, \"alias\": \"Repete\"}, {\"name\": \"FastFoward\", \"onBoat\": true}], \"onBoat\")</code> should return true');",
|
||||
"assert.strictEqual(every([{\"single\": \"yes\"}], \"single\"), true, 'message: <code>every([{\"single\": \"yes\"}], \"single\")</code> should return true');",
|
||||
"assert.strictEqual(every([{\"single\": \"\"}, {\"single\": \"double\"}], \"single\"), false, 'message: <code>every([{\"single\": \"\"}, {\"single\": \"double\"}], \"single\")</code> should return false');",
|
||||
"assert.strictEqual(every([{\"single\": \"double\"}, {\"single\": undefined}], \"single\"), false, 'message: <code>every([{\"single\": \"double\"}, {\"single\": undefined}], \"single\")</code> should return false');",
|
||||
"assert.strictEqual(every([{\"single\": \"double\"}, {\"single\": NaN}], \"single\"), false, 'message: <code>every([{\"single\": \"double\"}, {\"single\": NaN}], \"single\")</code> should return false');"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Object.hasOwnProperty()",
|
||||
"Object.getOwnPropertyNames()"
|
||||
"solutions": [
|
||||
"function every(collection, pre) {\n // Does everyone have one of these?\n return collection.every(function(e) { return e[pre]; });\n}\n\nevery([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex');\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
@ -829,6 +903,10 @@
|
||||
"Closures",
|
||||
"Arguments object"
|
||||
],
|
||||
"solutions": [
|
||||
"function add() {\n if (arguments.length == 1) {\n var a = arguments[0];\n if (!isNumber(a)) return;\n return function(b) {\n if (!isNumber(b)) return;\n return a+b;\n };\n }\n if (![].slice.call(arguments).every(isNumber)) return;\n return arguments[0] + arguments[1];\n}\n \nfunction isNumber(obj) {\n return toString.call(obj) == '[object Number]';\n}\n\nadd(2,3);\n",
|
||||
"function add() {\n var a = arguments[0];\n if (toString.call(a) !== '[object Number]') return; \n if (arguments.length === 1) {\n return function(b) {\n if (toString.call(b) !== '[object Number]') return;\n return a + b;\n };\n }\n var b = arguments[1];\n if (toString.call(b) !== '[object Number]') return; \n return a + arguments[1];\n}\n\nadd(2,3);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
|
@ -8,7 +8,7 @@
|
||||
"title": "Show the Local Weather",
|
||||
"challengeSeed": ["126415127"],
|
||||
"description": [
|
||||
"<span class='text-info'>Objective:</span> Build a <a href='http://codepen.io' target='_blank'>CodePen.io</a> app that successfully reverse-engineers this: <a href='http://codepen.io/AdventureBear/full/yNBJRj' target='_blank'>http://codepen.io/AdventureBear/full/yNBJRj</a>.",
|
||||
"<span class='text-info'>Objective:</span> Build a <a href='http://codepen.io' target='_blank'>CodePen.io</a> app that successfully reverse-engineers this: <a href='http://codepen.io/FreeCodeCamp/pen/avqvgJ' target='_blank'>http://codepen.io/FreeCodeCamp/pen/avqvgJ</a>.",
|
||||
"<span class='text-info'>Rule #1:</span> Don't look at the example project's code on CodePen. Figure it out for yourself.",
|
||||
"<span class='text-info'>Rule #2:</span> You may use whichever libraries or APIs you need.",
|
||||
"<span class='text-info'>Rule #3:</span> Reverse engineer the example project's functionality, and also feel free to personalize it.",
|
||||
@ -17,6 +17,7 @@
|
||||
"<span class='text-info'>Bonus User Story:</span> As a user, I can see an icon depending on the weather.",
|
||||
"<span class='text-info'>Bonus User Story:</span> As a user, I see a different background image (e.g. snowy mountain, hot desert) depending on the weather.",
|
||||
"<span class='text-info'>Bonus User Story:</span> As a user, I can push a button to toggle between Fahrenheit and Celsius.",
|
||||
"We recommend using the <a href='http://openweathermap.org/current#geo' target='_blank'>Open Weather API</a>. This will require creating a free API key. Normally you want to avoid exposing API keys on CodePen, but we haven't been able to find a keyless API for weather.",
|
||||
"Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> 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 from fellow campers, click this button and paste in a link to your CodePen project. <br><br><a class='btn btn-primary btn-block' href='https://twitter.com/intent/tweet?text=Check%20out%20the%20project%20I%20just%20built%20with%20%40FreeCodeCamp:%20PASTE_YOUR_CODEPEN_URL_HERE%20%0A%20%23LearnToCode%20%23JavaScript' target='_blank'>Click here then add your link to your tweet's text</a>"
|
||||
|
@ -16,15 +16,14 @@
|
||||
"This is important because without your <code>document ready function</code>, your code may run before your HTML is rendered, which would cause bugs."
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/<script>/g), 'Create a <code>script</code> element.')",
|
||||
"assert(editor.match(/<\\/script>/g) && editor.match(/<script/g) && editor.match(/<\\/script>/g).length === editor.match(/<script/g).length, 'Make sure your <code>script</code> element has a closing tag.')",
|
||||
"assert(editor.match(/<\\/script\\s*>/g) && editor.match(/<script(\\sasync|\\sdefer)*(\\s(charset|src|type)\\s*=\\s*[\"\\']+[^\"\\']*[\"\\']+)*(\\sasync|\\sdefer)*\\s*>/g) && editor.match(/<\\/script\\s*>/g).length === editor.match(/<script(\\sasync|\\sdefer)*(\\s(charset|src|type)\\s*=\\s*[\"\\']+[^\"\\']*[\"\\']+)*(\\sasync|\\sdefer)*\\s*>/g).length, 'Create a <code>script</code> element making sure it is valid and has a closing tag.')",
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?document\\)\\.ready\\s*?\\(\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/g), 'You should add <code>$(document).ready(function() {</code> to the beginning of your <code>script</code> element.')",
|
||||
"assert(editor.match(/\\n*?\\s*?\\}\\s*?\\);/g), 'Close your <code>$(document).ready(function() {</code> function with <code>});</code>.')"
|
||||
"assert(editor.match(/\\n*?\\s*?\\}\\s*?\\);/g), 'Close your <code>$(document).ready(function() {</code> function with <code>});</code>')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -58,7 +57,8 @@
|
||||
"Now we have a <code>document ready function</code>.",
|
||||
"Now let's write our first jQuery statement. All jQuery functions start with a <code>$</code>, usually referred to as a <code>dollar sign operator</code>, or simply as <code>bling</code>.",
|
||||
"jQuery often selects an HTML element with a <code>selector</code>, then does something to that element.",
|
||||
"For example, let's make all of your <code>button</code> elements bounce. Just add this code inside your document ready function: <code>$(\"button\").addClass(\"animated bounce\")</code>.",
|
||||
"For example, let's make all of your <code>button</code> elements bounce. Just add this code inside your document ready function:",
|
||||
"<code>$(\"button\").addClass(\"animated bounce\")</code>",
|
||||
"Note that we've already included both the jQuery library and the Animate.css library in your code editor. So you are using jQuery to apply the Animate.css <code>bounce</code> class to your <code>button</code> elements."
|
||||
],
|
||||
"tests": [
|
||||
@ -72,7 +72,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -108,7 +108,8 @@
|
||||
"First, let's target your <code>div</code> elements with the class <code>well</code> by using the <code>$(\".well\")</code> selector.",
|
||||
"Note that, just like with CSS declarations, you type a <code>.</code> before the class's name.",
|
||||
"Then use jQuery's <code>.addClass()</code> function to add the classes <code>animated</code> and <code>shake</code>.",
|
||||
"For example, you could make all the elements with the class <code>text-primary</code> shake by adding the following to your <code>document ready function</code>: <code>$(\".text-primary\").addClass(\"animated shake\");</code>"
|
||||
"For example, you could make all the elements with the class <code>text-primary</code> shake by adding the following to your <code>document ready function</code>:",
|
||||
"<code>$(\".text-primary\").addClass(\"animated shake\");</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\".well\").hasClass(\"animated\") && $(\".well\").hasClass(\"shake\"), 'Use the jQuery <code>addClass()</code> function to give the classes <code>animated</code> and <code>shake</code> to all your elements with the class <code>well</code>.')",
|
||||
@ -121,7 +122,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -156,7 +157,8 @@
|
||||
"First target your <code>button</code> element with the id <code>target3</code> by using the <code>$(\"#target3\")</code> selector.",
|
||||
"Note that, just like with CSS declarations, you type a <code>#</code> before the id's name.",
|
||||
"Then use jQuery's <code>.addClass()</code> function to add the classes <code>animated</code> and <code>fadeOut</code>.",
|
||||
"Here's how you'd make the <code>button</code> element with the id <code>target6</code> fade out: <code>$(\"#target6\").addClass(\"animated fadeOut\")</code>."
|
||||
"Here's how you'd make the <code>button</code> element with the id <code>target6</code> fade out:",
|
||||
"<code>$(\"#target6\").addClass(\"animated fadeOut\")</code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\"#target3\").hasClass(\"animated\"), 'Select the <code>button</code>element with the <code>id</code> of <code>target3</code> and use the jQuery <code>addClass()</code> function to give it the class of <code>animated</code>.')",
|
||||
@ -172,7 +174,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -223,7 +225,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -255,8 +257,10 @@
|
||||
"title": "Target the same element with multiple jQuery Selectors",
|
||||
"description": [
|
||||
"Now you know three ways of targeting elements: by type: <code>$(\"button\")</code>, by class: <code>$(\".btn\")</code>, and by id <code>$(\"#target1\")</code>.",
|
||||
"Use each of these jQuery selectors to target your <code>button</code> element with the class <code>btn</code> and the id <code>target1</code>.",
|
||||
"Use the <code>addClass()</code> jQuery function to give the element one new class for each selector: <code>animated</code>, <code>shake</code>, and <code>btn-primary</code>."
|
||||
"Using each of the above jQuery selectors and the <code>addClass()</code> function:",
|
||||
"Add the <code>animated</code> class to all elements with type <code>button</code>.",
|
||||
"Add the <code>shake</code> class to all the buttons with class <code>.btn</code>.",
|
||||
"Add the <code>btn-primary</code> class to the button with id <code>#target1</code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?(?:'|\")\\s*?button\\s*?(?:'|\")/gi), 'Use the <code>$(\"button\")</code> selector.')",
|
||||
@ -273,7 +277,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -305,7 +309,8 @@
|
||||
"title": "Remove Classes from an element with jQuery",
|
||||
"description": [
|
||||
"In the same way you can add classes to an element with jQuery's <code>addClass()</code> function, you can remove them with jQuery's <code>removeClass()</code> function.",
|
||||
"Here's how you would do this for a specific button, add <code>$(\"#target2\").removeClass(\"btn-default\");</code>",
|
||||
"Here's how you would do this for a specific button:",
|
||||
"<code>$(\"#target2\").removeClass(\"btn-default\");</code>",
|
||||
"Let's remove the <code>btn-default</code> class from all of our <code>button</code> elements."
|
||||
],
|
||||
"tests": [
|
||||
@ -323,7 +328,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -356,7 +361,8 @@
|
||||
"description": [
|
||||
"We can also change the CSS of an HTML element directly with jQuery.",
|
||||
"jQuery has a function called <code>.css()</code> that allows you to change the CSS of an element.",
|
||||
"Here's how we would change its color to blue: <code>$(\"#target1\").css(\"color\", \"blue\");</code>",
|
||||
"Here's how we would change its color to blue:",
|
||||
"<code>$(\"#target1\").css(\"color\", \"blue\");</code>",
|
||||
"This is slightly different from a normal CSS declaration, because the CSS property and its value are in quotes, and separated with a comma instead of a colon.",
|
||||
"Delete your jQuery selectors, leaving an empty <code>document ready function</code>.",
|
||||
"Select <code>target1</code> and change its color to red."
|
||||
@ -376,7 +382,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -410,7 +416,8 @@
|
||||
"You can also change the non-CSS properties of HTML elements with jQuery. For example, you can disable buttons.",
|
||||
"When you disable a button, it will become grayed-out and can no longer be clicked.",
|
||||
"jQuery has a function called <code>.prop()</code> that allows you to adjust the properties of elements.",
|
||||
"Here's how you would disable all buttons: <code>$(\"button\").prop(\"disabled\", true);</code>",
|
||||
"Here's how you would disable all buttons:",
|
||||
"<code>$(\"button\").prop(\"disabled\", true);</code>",
|
||||
"Disable only the <code>target1</code> button."
|
||||
],
|
||||
"tests": [
|
||||
@ -426,7 +433,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -474,7 +481,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -507,7 +514,8 @@
|
||||
"description": [
|
||||
"Now let's try moving elements from one <code>div</code> to another.",
|
||||
"jQuery has a function called <code>appendTo()</code> that allows you to select HTML elements and append them to another element.",
|
||||
"For example, if we wanted to move <code>target4</code> from our right well to our left well, we would use <code>$(\"#target4\").appendTo(\"#left-well\");</code>",
|
||||
"For example, if we wanted to move <code>target4</code> from our right well to our left well, we would use:",
|
||||
"<code>$(\"#target4\").appendTo(\"#left-well\");</code>",
|
||||
"Move your <code>target2</code> element from your <code>left-well</code> to your <code>right-well</code>."
|
||||
],
|
||||
"tests": [
|
||||
@ -525,7 +533,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -558,7 +566,8 @@
|
||||
"description": [
|
||||
"In addition to moving elements, you can also copy them from one place to another.",
|
||||
"jQuery has a function called <code>clone()</code> that makes a copy of an element.",
|
||||
"For example, if we wanted to copy <code>target2</code> from our <code>left-well</code> to our <code>right-well</code>, we would use <code>$(\"#target2\").clone().appendTo(\"#right-well\");</code>",
|
||||
"For example, if we wanted to copy <code>target2</code> from our <code>left-well</code> to our <code>right-well</code>, we would use:",
|
||||
"<code>$(\"#target2\").clone().appendTo(\"#right-well\");</code>",
|
||||
"Did you notice this involves sticking two jQuery functions together? This is called <code>function chaining</code> and it's a convenient way to get things done with jQuery.",
|
||||
"Clone your <code>target5</code> element and append it to your <code>left-well</code>."
|
||||
],
|
||||
@ -578,7 +587,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -612,7 +621,8 @@
|
||||
"Every HTML element has a <code>parent</code> element from which it <code>inherits</code> properties.",
|
||||
"For example, your <code>jQuery Playground</code> <code>h3</code> element has the parent element of <code><div class=\"container-fluid\"></code>, which itself has the parent <code>body</code>.",
|
||||
"jQuery has a function called <code>parent()</code> that allows you to access the parent of whichever element you've selected.",
|
||||
"Here's an example of how you would use the <code>parent()</code> function if you wanted to give the parent element of the <code>left-well</code> element a background color of blue: <code>$(\"#left-well\").parent().css(\"background-color\", \"blue\")</code>",
|
||||
"Here's an example of how you would use the <code>parent()</code> function if you wanted to give the parent element of the <code>left-well</code> element a background color of blue:",
|
||||
"<code>$(\"#left-well\").parent().css(\"background-color\", \"blue\")</code>",
|
||||
"Give the parent of the <code>#target1</code> element a background-color of red."
|
||||
],
|
||||
"tests": [
|
||||
@ -633,7 +643,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -667,7 +677,8 @@
|
||||
"Many HTML elements have <code>children</code> which <code>inherit</code> their properties from their parent HTML elements.",
|
||||
"For example, every HTML element is a child of your <code>body</code> element, and your \"jQuery Playground\" <code>h3</code> element is a child of your <code><div class=\"container-fluid\"></code> element.",
|
||||
"jQuery has a function called <code>children()</code> that allows you to access the children of whichever element you've selected.",
|
||||
"Here's an example of how you would use the <code>children()</code> function to give the children of your <code>left-well</code> element the color of blue: <code>$(\"#left-well\").children().css(\"color\", \"blue\")</code>",
|
||||
"Here's an example of how you would use the <code>children()</code> function to give the children of your <code>left-well</code> element the color of blue:",
|
||||
"<code>$(\"#left-well\").children().css(\"color\", \"blue\")</code>",
|
||||
"Give all the children of your <code>#right-well</code> element a color of green."
|
||||
],
|
||||
"tests": [
|
||||
@ -688,7 +699,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -722,8 +733,9 @@
|
||||
"You've seen why id attributes are so convenient for targeting with jQuery selectors. But you won't always have such neat ids to work with.",
|
||||
"Fortunately, jQuery has some other tricks for targeting the right elements.",
|
||||
"jQuery uses CSS Selectors to target elements. <code>target:nth-child(n)</code> css selector allows you to select all the nth element with the target class or element type.",
|
||||
"Make the second child in each of your well elements bounce. You must target the children of element with the <code>target</code> class.",
|
||||
"Here's how you would give the third element in each well bounce: <code>$(\".target:nth-child(3)\").addClass(\"animated bounce\");</code>"
|
||||
"Here's how you would give the third element in each well bounce:",
|
||||
"<code>$(\".target:nth-child(3)\").addClass(\"animated bounce\");</code>",
|
||||
"Make the second child in each of your well elements bounce. You must target the children of element with the <code>target</code> class."
|
||||
],
|
||||
"tests": [
|
||||
"assert($(\".target:nth-child(2)\").hasClass(\"animated\") && $(\".target:nth-child(2)\").hasClass(\"bounce\"), 'The second element in your <code>target</code> elements should bounce.')",
|
||||
@ -744,7 +756,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -776,9 +788,9 @@
|
||||
"title": "Target Even Numbered Elements Using jQuery",
|
||||
"description": [
|
||||
"You can also target all the even-numbered elements.",
|
||||
"Here's how you would target all the odd-numbered elements with class <code>target</code> and give them classes: <code>$(\".target:odd\").addClass(\"animated shake\");</code>",
|
||||
"Note that jQuery is zero-indexed, meaning that, counter-intuitively, <code>:odd</code> selects the second element, fourth element, and so on.",
|
||||
"Try selecting all the even-numbered elements - that is, what your browser will consider even-numbered elements - and giving them the classes of <code>animated</code> and <code>shake</code>."
|
||||
"Here's how you would target all the odd-numbered elements with class <code>target</code> and give them classes:",
|
||||
"<code>$(\".target:odd\").addClass(\"animated shake\");</code>",
|
||||
"Try selecting all the even-numbered elements and giving them the classes of <code>animated</code> and <code>shake</code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert($('.target:even').hasClass('animated') && $('.target:even').hasClass('shake'), 'All the <code>target</code> elements that computer considers even should shake.')",
|
||||
@ -801,7 +813,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
@ -857,7 +869,7 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <h3 class=\"text-primary text-center\">jQuery Playground</h3>",
|
||||
|
404
seed/challenges/json-apis-and-ajax.json
Normal file
404
seed/challenges/json-apis-and-ajax.json
Normal file
@ -0,0 +1,404 @@
|
||||
{
|
||||
"name": "JSON APIs and Ajax",
|
||||
"order": 10.5,
|
||||
"time": "30m",
|
||||
"challenges": [
|
||||
{
|
||||
"id": "bb000000000000000000001",
|
||||
"title": "Trigger Click Events with jQuery",
|
||||
"description": [
|
||||
"In this section, we'll learn how to get data from APIs. APIs - or Application Interfaces - are tools that computers use to communicate with one another.",
|
||||
"We'll also learn how to update HTML with the data we get from these APIs using a technology called Ajax.",
|
||||
"First, let's review what the <code>$(document).ready()</code> function does. This function makes it so all code inside of it only runs once our page loads.",
|
||||
"Let's make our \"Get Message\" button change the text of the element with the class <code>message</code>.",
|
||||
"Before we can do this, we need to implement a <code>click event</code> inside of our <code>$(document).ready()</code> function by adding this code:",
|
||||
"<code>$(\"#getMessage\").on(\"click\", function(){</code>",
|
||||
"",
|
||||
"<code>});</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?(?:'|\")\\#getMessage(?:'|\")\\s*?\\)\\s*?\\.on\\s*?\\(\\s*?(?:'|\")click(?:'|\")\\s*?\\,\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/gi), 'Bind the click event to the button with the ID of <code>getMessage</code>')",
|
||||
"assert(editor.match(/\\n*?\\s*?\\}\\n*?\\s*?\\);/gi) && editor.match(/\\n*?\\s*?\\}\\);/gi).length >= 2, 'Be sure to close your functions with <code>});</code>')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" // Only change code below this line.",
|
||||
" ",
|
||||
" // Only change code above this line.",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well message\">",
|
||||
" The message will go here",
|
||||
" </div>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bc000000000000000000001",
|
||||
"title": "Change Text with Click Events",
|
||||
"description": [
|
||||
"When our click event happens, we can use Ajax to update an HTML element.",
|
||||
"Let's make it so that when a user clicks the \"Get Message\" button, we change the text of the element with the class <code>message</code> to say \"Here is the message\".",
|
||||
"We can do this by adding the following code within our click event:",
|
||||
"<code>  $(\".message\").html(\"Here is the message\");</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?(?:'|\")\\.message(?:'|\")\\s*?\\)\\s*?\\.html\\s*?\\(\\s*?(?:'|\")Here\\sis\\sthe\\smessage(?:'|\")\\s*?\\);/gi), 'Clicking the \"Get Message\" button should give the element with the class <code>message</code> the text \"Here is the message\".')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" $(\"#getMessage\").on(\"click\", function(){",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"",
|
||||
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well message\">",
|
||||
" The message will go here",
|
||||
" </div>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bb000000000000000000002",
|
||||
"title": "Get JSON with the jQuery getJSON Method",
|
||||
"description": [
|
||||
"You can also request data from an external source. This is where APIs come into play.",
|
||||
"Remember that APIs - or Application Interfaces - are tools that computers use to communicate with one another.",
|
||||
"Most web APIs transfer data in a format called JSON. JSON stands for JavaScript Object Notation.",
|
||||
"You've already been using JSON whenever you create a JavaScript object. JSON is nothing more than object properties and their current values, sandwiched between a <code>{</code> and a <code>}</code>.",
|
||||
"These properties and their values are often referred to as \"key-value pairs\".",
|
||||
"Let's get the JSON from Free Code Camp's Cat Photo API.",
|
||||
"Here's the code you can put in your click event to do this:",
|
||||
"<code>  $.getJSON(\"/json/cats.json?callback=\", function( json ) {</code>",
|
||||
"<code>    $(\".message\").html(JSON.stringify(json))</code>",
|
||||
"<code>  });</code>",
|
||||
"Once you've added this, click the \"Get Message\" button. Your Ajax function will replace the \"The message will go here\" text with the raw JSON output from the Free Code Camp Cat Photo API."
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?(\\\"|\\')\\#getMessage(\\\"|\\')\\s*?\\)\\s*?\\.\\s*?on\\s*?\\(\\s*?(\\\"|\\')click(\\\"|\\')\\s*?\\,\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/gi), 'You should have a click handler on the getMessage button to trigger the AJAX request.')",
|
||||
"assert(editor.match(/\\s*?\\}\\s*?\\)\\s*?\\;/gi), 'You should have at least on closing set of brackets and parenthesis.')",
|
||||
"assert(editor.match(/\\s*?\\}\\s*?\\)\\s*?\\;/gi) && editor.match(/\\,\\s*?function\\s*?\\(\\s*?\\w*?\\s*?\\)\\s*?\\{/gi) && editor.match(/\\s*?\\}\\s*?\\)\\s*?\\;/gi).length === editor.match(/\\s*?function\\s*?\\(\\s*?\\w*?\\s*?\\)\\s*?\\{/gi).length, 'Each callback function should have a closing set of brackets and parenthesis.')",
|
||||
"assert(editor.match(/\\$\\s*?\\.\\s*?getJSON\\s*?\\(\\s*?\"\\\/json\\\/cats\\.json\\?callback\\=\"\\s*?\\,\\s*?function\\s*?\\(\\s*?json\\s*?\\)\\s*?\\{/gi), 'You should be making use of the getJSON method given in the description to load data from the json file.')",
|
||||
"assert(editor.match(/\\$\\s*?\\(\\s*?\\\"\\.message\\\"\\s*?\\)\\s*?\\.\\s*?html\\s*?\\(\\s*?JSON\\s*?\\.\\s*?stringify\\s*?\\(\\s*?json\\s*?\\)\\s*?\\)/gi), 'Don\\'t forget to make the <code>.html</code> change the contents of the message box so that it contains the result of the getJSON.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" ",
|
||||
" $(\"#getMessage\").on(\"click\", function(){",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
" });",
|
||||
" ",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well message\">",
|
||||
" The message will go here",
|
||||
" </div>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bb000000000000000000003",
|
||||
"title": "Convert JSON Data to HTML",
|
||||
"description": [
|
||||
"Now that we're getting data from a JSON API, let's display it in our HTML.",
|
||||
"We can use the <code>.map()</code> method to loop through our data and modify our HTML elements.",
|
||||
"First, let's declare an html variable with <code>var html = \"\";</code>.",
|
||||
"Then, let's loop through our JSON, adding more HTML to that variable. When the loop is finished, we'll render it.",
|
||||
"Here's the code that does this:",
|
||||
"<code>json.map(function(val) {</code>",
|
||||
"<code>  html = html + \"<div class = 'cat'>\"</code>",
|
||||
"<code>  for(var key in val) {</code>",
|
||||
"<code>    html = html + '<div class = \"' + key + '\">' + val[key] + '</div>';</code>",
|
||||
"<code>  }</code>",
|
||||
"<code>  html = html + \"</div><br/>\"</code>",
|
||||
"<code>});</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/json\\.map/gi), 'The message box should have something in it.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#getMessage\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json?callback=\", function( json ) {",
|
||||
"",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"",
|
||||
" $(\".message\").html(html);",
|
||||
"",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well message\">",
|
||||
" The message will go here"," </div>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bb000000000000000000004",
|
||||
"title": "Render Images from Data Sources",
|
||||
"description": [
|
||||
"In the JSON that we receive from Free Code Camp's Cat Photo API, each object has an attribute called \"imageLink\".",
|
||||
"When we're looping through these objects, let's check whether an object attribute (key) is <code>imageLink</code>. If it is, instead of outputing the image link, let's render the image.",
|
||||
"Here's the code that does this:",
|
||||
"<code>if(key === \"imageLink\") {</code>",
|
||||
"<code>  html = html + '<img class = \"' + key + '\"src = \"' + val[key] + '\">';</code>",
|
||||
"<code>} else {</code>",
|
||||
"<code>  html = html + '<div class = \"' + key + '\">' + val[key] + '</div>';</code>",
|
||||
"<code>}</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/imageLink/gi), 'You should have accessed the imageLink of each cat object.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#getMessage\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json?callback=\", function( json ) {",
|
||||
"",
|
||||
" var html = \"\";",
|
||||
"",
|
||||
" json.map(function(val) {",
|
||||
"",
|
||||
" html = html + \"<div class = 'cat'>\"",
|
||||
"",
|
||||
" for (var key in val) {",
|
||||
"",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"",
|
||||
" }",
|
||||
"",
|
||||
" html = html + \"</div>\"",
|
||||
"",
|
||||
" });",
|
||||
"",
|
||||
" $(\".message\").html(html);",
|
||||
"",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well message\">",
|
||||
" The message will go here",
|
||||
" </div>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bb000000000000000000005",
|
||||
"title": "Prefilter JSON",
|
||||
"description": [
|
||||
"If we don't want to render every cat photo we get from our Free Code Camp's Cat Photo JSON API, we can pre-filter the json before we loop through it.",
|
||||
"Let's filter out the cat who's \"id\" key has a value of 1.",
|
||||
"Here's the code to do this:",
|
||||
"<code>json = json.filter(function(val) {</code>",
|
||||
"<code>  return(val.id !== 1);</code>",
|
||||
"<code>});</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/filter/gi), 'You should be making use of the .filter method.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#getMessage\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json?callback=\", function( json ) {",
|
||||
"",
|
||||
" var html = \"\";",
|
||||
"",
|
||||
" json.map(function(val){",
|
||||
"",
|
||||
" val = \"<img src = '\" + val.imageLink + \"'/>\" ",
|
||||
"",
|
||||
" html = html + \"<div class = 'cat'>\"",
|
||||
"",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"",
|
||||
" for(var key in val){",
|
||||
"",
|
||||
" html = html + '<div class = \"' + key + '\">' + val[key] + '</div>';",
|
||||
"",
|
||||
" }",
|
||||
"",
|
||||
" html = html + \"</div>\"",
|
||||
"",
|
||||
" });",
|
||||
"",
|
||||
" $(\".message\").html(html);",
|
||||
"",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well message\">",
|
||||
" The message will go here",
|
||||
" </div>",
|
||||
" </div>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>",
|
||||
""
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bb000000000000000000006",
|
||||
"title": "Get Geo-location Data",
|
||||
"description": [
|
||||
"Another cool thing we can do is access our user's current location. Every browser has a built in navigator that can give us this information.",
|
||||
"The navigator will get our user's current longitude and latitude.",
|
||||
"Here's some code that does this:",
|
||||
"<code>if (navigator.geolocation) {</code>",
|
||||
"<code>  navigator.geolocation.getCurrentPosition(function(position) {</code>",
|
||||
"<code>    $(\"#data\").html(\"latitiude\" + position.coords.latitude + \"longitude\" + position.coords.longitude);</code>",
|
||||
"<code>  });</code>",
|
||||
"<code>}</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/navigator\\.geolocation\\.getCurrentPosition/gi), 'You should make use of the <code>navigator.geolocation</code> to access the users current location.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"fcces",
|
||||
"<div id = \"data\">",
|
||||
" <h4>You are here:</h4>",
|
||||
" ",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
}
|
||||
]
|
||||
}
|
@ -25,7 +25,7 @@
|
||||
"Complete \"Mongod\"",
|
||||
"Complete \"Connect\"",
|
||||
"Complete \"Find\"",
|
||||
"Complete \"Find Limit\"",
|
||||
"Complete \"Find Project\"",
|
||||
"Complete \"Insert\"",
|
||||
"Complete \"Update\"",
|
||||
"Complete \"Remove\"",
|
||||
|
@ -98,7 +98,7 @@
|
||||
"description": [
|
||||
"Let's continue the LearnYouNode Node School challenge. For this Waypoint, we'll do challenges 8 through 10.",
|
||||
"Make sure that you are always in your project's \"workspace\" directory. You can always navigate back to this directory by running this command: <code>cd ~/workspace</code>.",
|
||||
"Return to the c9.io workspace you created Now start this tutorial by running <code>learnyounode</code>",
|
||||
"Return to the c9.io workspace you created. Now start this tutorial by running <code>learnyounode</code>",
|
||||
"You can view this Node School module's source code on GitHub at <a href='https://github.com/workshopper/learnyounode'>https://github.com/workshopper/learnyounode</a>.",
|
||||
"Complete \"HTTP Collect\"",
|
||||
"Complete \"Juggling Async\"",
|
||||
|
@ -15,7 +15,6 @@
|
||||
{
|
||||
"id":"cf1111c1c15feddfaeb1bdef",
|
||||
"title": "Declare JavaScript Objects as Variables",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"Before we dive into Object Oriented Programming, let's revisit JavaScript objects.",
|
||||
"Give your <code>motorBike</code> object a <code>wheels</code>, <code>engines</code> and <code>seats</code> attribute and set them to numbers."
|
||||
@ -26,21 +25,20 @@
|
||||
"assert(typeof(motorBike.seats) === 'number', 'message: <code>motorBike</code> should have a <code>seats</code> attribute set to a number.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"//Here is a sample Object",
|
||||
"var car = {",
|
||||
" \"wheels\":4,",
|
||||
" \"engines\":1,",
|
||||
" \"seats\":5",
|
||||
"};",
|
||||
"",
|
||||
"//Now Let's make a similar Object called motorBike",
|
||||
"//Give it two wheels, one engine and one seat",
|
||||
"var motorBike = {",
|
||||
"",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"",
|
||||
"};",
|
||||
"",
|
||||
"(function() {return JSON.stringify(motorBike);})();"
|
||||
@ -52,10 +50,16 @@
|
||||
{
|
||||
"id":"cf1111c1c15feddfaeb2bdef",
|
||||
"title": "Construct JavaScript Objects with Functions",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"We are also able to create objects using <code>constructor</code> functions.",
|
||||
"Give your <code>myMotorBike</code> object a <code>wheels</code>, <code>engines</code> and <code>seats</code> attribute and set them to numbers."
|
||||
"Here's an example of a constructor function:",
|
||||
"<code>var Car = function() {</code>",
|
||||
"<code>  this.wheels = 4;</code>",
|
||||
"<code>  this.engines = 1;</code>",
|
||||
"<code>  this.seats = 1;</code>",
|
||||
"<code>};</code>",
|
||||
"Give your <code>myMotorBike</code> object a <code>wheels</code>, <code>engines</code> and <code>seats</code> attribute and set them to numbers.",
|
||||
"You may be confused by the <code>this</code> keyword here. Don't worry, we will get to that very soon."
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof((new MotorBike()).engines) === 'number', 'message: <code>myMotorBike</code> should have a <code>engines</code> attribute set to a number.');",
|
||||
@ -63,7 +67,6 @@
|
||||
"assert(typeof((new MotorBike()).seats) === 'number', 'message: <code>myMotorBike</code> should have a <code>seats</code> attribute set to a number.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"// Let's add the properties engines and seats to the car in the same way that the property wheels has been added below. They should both be numbers.",
|
||||
"var Car = function() {",
|
||||
" this.wheels = 4;",
|
||||
" this.engines = 1;",
|
||||
@ -73,6 +76,7 @@
|
||||
"var myCar = new Car();",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"var MotorBike = function() {",
|
||||
"",
|
||||
"",
|
||||
@ -80,6 +84,7 @@
|
||||
"};",
|
||||
"",
|
||||
"var myMotorBike = new MotorBike();",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"(function() {return JSON.stringify(myMotorBike);})();"
|
||||
@ -90,49 +95,57 @@
|
||||
{
|
||||
"id":"cf1111c1c15feddfaeb3bdef",
|
||||
"title":"Make Object Properties Private",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"Objects have their own attributes, called <code>properties</code>, and their own functions, called <code>methods</code>.",
|
||||
"In the previous challenge, we used the <code>this</code> keyword to reference <code>public properties</code> and <code>public methods</code> of the current object.",
|
||||
"We can also create <code>private properties</code> and <code>private methods</code>, which aren't accessible from outside the object.",
|
||||
"To do this, we omit the word <code>this</code> from the <code>property</code> or <code>method</code> declaration.",
|
||||
"To do this, just declare properties or functions within the constructor.",
|
||||
"Let's create an object with two functions. One attached as a property and one not.",
|
||||
"See if you can keep <code>myBike.speed</code> and <code>myBike.addUnit</code> private, while making <code>myBike.getSpeed</code> publicly accessible."
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof(myBike.getSpeed)!=='undefined' && typeof(myBike.getSpeed) === 'function', 'message: The method getSpeed of myBike should be accessible outside the object.');",
|
||||
"assert(typeof(myBike.speed) === 'undefined', 'message: <code>myBike.speed</code> should remain undefined.');",
|
||||
"assert(typeof(myBike.speed) === 'undefined', 'message: <code>myBike.speed</code> should be undefined.');",
|
||||
"assert(typeof(myBike.addUnit) === 'undefined', 'message: <code>myBike.addUnit</code> should remain undefined.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"//Let's create an object with two functions. One attached as a property and one not.",
|
||||
"var Car = function() {",
|
||||
" this.gear = 1;",
|
||||
" // this is a private variable",
|
||||
" var gear = 1;",
|
||||
" // this is a private function (also known as a private method)",
|
||||
" function addStyle(styleMe){",
|
||||
" return 'The Current Gear Is: ' + styleMe;",
|
||||
" }",
|
||||
" // this is a public method",
|
||||
" this.getGear = function() {",
|
||||
" return addStyle(this.gear);",
|
||||
" };",
|
||||
"",
|
||||
"};",
|
||||
"",
|
||||
"var Bike = function() {",
|
||||
"",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
" this.speed = 100;",
|
||||
"",
|
||||
" function addUnit(value) {",
|
||||
" return value + \"KM/H\";",
|
||||
" }",
|
||||
" ",
|
||||
"",
|
||||
" getSpeed = function () {",
|
||||
" return addUnit(speed);",
|
||||
" };",
|
||||
" ",
|
||||
"",
|
||||
"};",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"var myCar = new Car();",
|
||||
"",
|
||||
"var myBike = new Bike();",
|
||||
"",
|
||||
"if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};"
|
||||
"if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();}"
|
||||
],
|
||||
"challengeType":1,
|
||||
"type": "waypoint"
|
||||
@ -140,17 +153,17 @@
|
||||
{
|
||||
"id":"cf1111c1c15feddfaeb4bdef",
|
||||
"title":"Make Instances of Objects with a Constructor Function",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"Sometimes you'll want to be able to easily create similar objects.",
|
||||
"Sometimes you'll want to be able to easily create many copies of an objects that all share the same methods.",
|
||||
"Objects have their own attributes, called <code>properties</code>, and their own functions, called <code>methods</code>.",
|
||||
"A function that creates objects is called a <code>constructor</code>.",
|
||||
"You can create <code>instances</code> of an object using a <code>constructor</code>.",
|
||||
"A constructor is a function that creates instances of an object that share the same methods and properties",
|
||||
"Each new <code>instance</code> of this object <code>inherits</code> all the <code>properties</code> and <code>methods</code> of your original object.",
|
||||
"Then you can give the instance new properties."
|
||||
"Once an <code>instance</code> has been created you can add <code>properties</code> to that <code>instance</code> individually.",
|
||||
"Add an <code>engines</code> property with a number value to the <code>myCar</code> instance."
|
||||
],
|
||||
"tests":[
|
||||
"assert((new Car()).wheels === 4, 'message: The property <code>wheels</code> should still be 4 like in the object constructor.');",
|
||||
"assert((new Car()).wheels === 4, 'message: The property <code>wheels</code> should still be 4 in the object constructor.');",
|
||||
"assert(typeof((new Car()).engines) === 'undefined', 'message: There should not be a property <code>engines</code> in the object constructor.');",
|
||||
"assert(myCar.wheels === 4, 'message: The property <code>wheels</code> of myCar should equal 4.');",
|
||||
"assert(typeof(myCar.engines) === 'number', 'message: The property <code>engines</code> of myCar should be a number.');"
|
||||
@ -163,7 +176,6 @@
|
||||
"// Only change code below this line.",
|
||||
"var myCar = new Car();",
|
||||
"",
|
||||
"//Add the property \"engines\" to myCar, and make it a number.",
|
||||
"",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
@ -175,29 +187,34 @@
|
||||
{
|
||||
"id":"cf1111c1c15feddfaeb7bdef",
|
||||
"title":"Iterate over Arrays with .map",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"<code>array = array.map(function(val){</code>",
|
||||
"<code>  return val+1;</code>",
|
||||
"The <code>map</code> method is a convenient way to iterate through arrays. Here's an example usage:",
|
||||
"<code>var timesFour = array.map(function(val){</code>",
|
||||
"<code>  return val*4;</code>",
|
||||
"<code>});</code>",
|
||||
"",
|
||||
"The map method is one of the easiest ways to iterate through an array or object there is. Let's use it now.",
|
||||
"Use the map function to add 3 to every value in the variable <code>array</code>"
|
||||
"The <code>map</code> method will iterate through every element of the array, creating a new array with values that have been modified by the callback function, and return it.",
|
||||
"In our example the callback only uses the value of the array element (the <code>val</code> argument) but your callback can also include arguments for the <code>index</code> and <code>array</code> being acted on.",
|
||||
"Use the map function to add 3 to every value in the variable <code>array</code>."
|
||||
],
|
||||
"tests":[
|
||||
"assert.deepEqual(array, [4,5,6,7,8], 'message: You should add three to each value in the array.');",
|
||||
"assert(editor.getValue().match(/\\.map\\s*\\(/gi), 'message: You should be making use of the map method.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\]/gi), 'message: You should only modify the array with <code>.map</code>.');"
|
||||
"assert.deepEqual(newArray, [4,5,6,7,8], 'message: You should add three to each value in the array.');",
|
||||
"assert(editor.getValue().match(/\\.map\\s*\\(/gi), 'message: You should be making use of the <code>map</code> method.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\]/gi), 'message: You should only modify the array with <code>map</code>.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"//Use map to add three to each value in the array",
|
||||
"var array = [1,2,3,4,5];",
|
||||
"var oldArray = [1,2,3,4,5];",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"var newArray = oldArray;",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"(function() {return array;})();"
|
||||
"",
|
||||
"(function() {return newArray;})();"
|
||||
],
|
||||
"challengeType":1,
|
||||
"type": "waypoint"
|
||||
@ -205,25 +222,32 @@
|
||||
{
|
||||
"id":"cf1111c1c15feddfaeb8bdef",
|
||||
"title":"Condense arrays with .reduce",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"Reduce can be useful for condensing an array of numbers into one value.",
|
||||
"<code>var singleVal = array.reduce(function(previousVal, currentVal){</code>",
|
||||
"<code>  return previousVal+currentVal;</code>",
|
||||
"<code>});</code>"
|
||||
"The array method <code>reduce</code> is used to iterate through an array and condense it into one value.",
|
||||
"To use <code>reduce</code> you pass in a callback whose arguments are an accumulator (in this case, <code>previousVal</code>) and the current value (<code>currentVal</code>).",
|
||||
"<code>reduce</code> has an optional second argument which can be used to set the initial value of the accumulator. If no initial value is specified it will be the first array element and currentVal will start with the second array element.",
|
||||
"Here is an example of <code>reduce</code> being used to subtract all the values of an array:",
|
||||
"<code>var singleVal = array.reduce(function(previousVal, currentVal) {</code>",
|
||||
"<code>  return previousVal - currentVal;</code>",
|
||||
"<code>}, 0);</code>",
|
||||
"Use the <code>reduce</code> method to sum all the values in <code>array</code> and assign it to <code>singleVal</code>."
|
||||
],
|
||||
"tests":[
|
||||
"assert(singleVal == 30, 'message: <code>singleVal</code> should have been set to the result of your reduce operation.');",
|
||||
"assert(editor.getValue().match(/\\.reduce\\s*\\(/gi), 'message: You should have made use of the reduce method.');"
|
||||
"assert(singleVal == 30, 'message: <code>singleVal</code> should be equal to the sum of all items in the <code>array</code> variable.');",
|
||||
"assert(editor.getValue().match(/\\.reduce\\s*\\(/gi), 'message: You should have made use of the <code>reduce</code> method.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var array = [4,5,6,7,8];",
|
||||
"var singleVal = 0;",
|
||||
"",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"var singleVal = array;",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"(function() {return singleVal;})();"
|
||||
],
|
||||
"challengeType":1,
|
||||
@ -232,27 +256,32 @@
|
||||
{
|
||||
"id":"cf1111c1c15feddfaeb9bdef",
|
||||
"title":"Filter Arrays with .filter",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"filter is a useful method that can filter out values that don't match a certain criteria",
|
||||
"Let's remove all the values greater than five",
|
||||
"The <code>filter</code> method is used to iterate through an array and filter out elements where a given condition is not true.",
|
||||
"<code>filter</code> is passed a callback function which takes the current value (we've called that <code>val</code>) as an argument.",
|
||||
"Any array element for which the callback returns true will be kept and elements that return false will be filtered out.",
|
||||
"The following code is an example of using filter to remove array elements that are not even numbers:",
|
||||
"Note: We omit the second and third arguments since we only need the value",
|
||||
"<code>array = array.filter(function(val) {</code>",
|
||||
"<code>  return val <= 5;</code>",
|
||||
"<code>});</code>"
|
||||
"<code>  return val % 2 === 0;</code>",
|
||||
"<code>});</code>",
|
||||
"Use <code>filter</code> to remove all elements from <code>array</code> that are greater than 5."
|
||||
],
|
||||
"tests":[
|
||||
"assert.deepEqual(array, [1,2,3,4,5], 'message: You should have removed all the values from the array that are greater than 5.');",
|
||||
"assert(editor.getValue().match(/array\\.filter\\s*\\(/gi), 'message: You should be using the filter method to remove the values from the array.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7\\,8\\,9\\,10\\]/gi), 'message: You should only be using <code>.filter</code> to modify the contents of the array.');"
|
||||
"assert.deepEqual(newArray, [1,2,3,4,5], 'message: You should have removed all the values from the array that are greater than 5.');",
|
||||
"assert(editor.getValue().match(/array\\.filter\\s*\\(/gi), 'message: You should be using the <code>filter</code> method to remove the values from the array.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7\\,8\\,9\\,10\\]/gi), 'message: You should only be using <code>filter</code> to modify the contents of the array.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var array = [1,2,3,4,5,6,7,8,9,10];",
|
||||
" // Only change code below this line.",
|
||||
"var oldArray = [1,2,3,4,5,6,7,8,9,10];",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"var newArray = oldArray;",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"(function() {return array;})();"
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"(function() { return newArray; })();"
|
||||
],
|
||||
"challengeType":1,
|
||||
"type": "waypoint"
|
||||
@ -260,26 +289,32 @@
|
||||
{
|
||||
"id":"cf1111c1c16feddfaeb1bdef",
|
||||
"title": "Sort Arrays with .sort",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"You can use the method sort to easily sort the values in the array alphabetically or numerically",
|
||||
"<code>var array = [1,3,2];</code>",
|
||||
"<code>array = array.sort();</code>",
|
||||
"This will return <code>[1, 2, 3]</code>"
|
||||
"You can use the method <code>sort</code> to easily sort the values in an array alphabetically or numerically.",
|
||||
"Unlike the previous array methods we have been looking at, <code>sort</code> actually alters the array in place. However, it also returns this sorted array.",
|
||||
"<code>sort</code> can be passed a compare function as a callback. If no compare function is passed in it will convert the values to strings and sort alphabetically.",
|
||||
"Here is an example of using sort with a compare function that will sort the elements from smallest to largest number:",
|
||||
"<code>var array = [1, 12, 21, 2];</code>",
|
||||
"<code>array.sort(function(a, b) {</code>",
|
||||
"<code>  return a - b;</code>",
|
||||
"<code>});</code>",
|
||||
"Use <code>sort</code> to sort <code>array</code> from largest to smallest."
|
||||
],
|
||||
"tests":[
|
||||
"assert.deepEqual(array, ['alpha', 'beta', 'charlie'], 'message: You should have sorted the array alphabetically.');",
|
||||
"assert(editor.getValue().match(/\\[\\'beta\\'\\,\\s\\'alpha\\'\\,\\s'charlie\\'\\];/gi), 'message: You should be sorting the array using sort.');",
|
||||
"assert(editor.getValue().match(/\\.sort\\s*\\(\\)/gi), 'message: You should have made use of the sort method.');"
|
||||
"assert.deepEqual(array, [21, 12, 2, 1], 'message: You should have sorted the array from largest to smallest.');",
|
||||
"assert(editor.getValue().match(/\\[1,\\s*12,\\s*21,\\s*2\\];/gi), 'message: You should only be using <code>sort</code> to modify the array.');",
|
||||
"assert(editor.getValue().match(/\\.sort\\s*\\(/g), 'message: You should have made use of the <code>sort</code> method.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var array = ['beta', 'alpha', 'charlie'];",
|
||||
"var array = [1, 12, 21, 2];",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"array.sort();",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"(function() {return array;})();"
|
||||
"(function() { return array; })();"
|
||||
],
|
||||
"challengeType":1,
|
||||
"type": "waypoint"
|
||||
@ -288,20 +323,24 @@
|
||||
"id": "cf1111c1c16feddfaeb2bdef",
|
||||
"title": "Reverse Arrays with .reverse",
|
||||
"description": [
|
||||
"You can use the <code>.reverse()</code> function to reverse the contents of an array."
|
||||
"You can use the <code>reverse</code> method to reverse the elements of an array.",
|
||||
"<code>reverse</code> is another array method that alters the array in place, but it also returns the reversed array.",
|
||||
"Add a line of code that uses <code>reverse</code> to reverse the <code>array</code> variable."
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(array, [7,6,5,4,3,2,1], 'message: You should reverse the array.');",
|
||||
"assert(editor.getValue().match(/\\.reverse\\s*\\(\\)/gi), 'message: You should use the reverse method.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7/gi), 'message: You should return <code>[7,6,5,4,3,2,1]</code>.');"
|
||||
"assert(editor.getValue().match(/\\.reverse\\s*\\(\\)/gi), 'message: You should use the <code>reverse</code> method.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\,4\\,5\\,6\\,7/gi), 'message: You should only be using <code>revserse</code> to modify <code>array</code>.');"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"var array = [1,2,3,4,5,6,7];",
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" // Only change code above this line.",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"(function() {return array;})();"
|
||||
],
|
||||
"challengeType": 1,
|
||||
@ -311,24 +350,29 @@
|
||||
"id": "cf1111c1c16feddfaeb3bdef",
|
||||
"title": "Concatenate Strings with .concat",
|
||||
"description": [
|
||||
"<code>.concat()</code> can be used to merge the contents of two arrays into one.",
|
||||
"<code>array = array.concat(otherArray);</code>"
|
||||
"<code>concat</code> can be used to merge the contents of two arrays into one.",
|
||||
"<code>concat</code> takes an array as an argument and returns a new array with the elements of this array concatenated onto the end.",
|
||||
"Here is an example of <code>concat</code> being used to concatenate <code>otherArray</code> onto the end of <code>oldArray</code>:",
|
||||
"<code>newArray = oldArray.concat(otherArray);</code>",
|
||||
"Use <code>.concat()</code> to concatenate <code>concatMe</code> onto the end of <code>oldArray</code> and assign it to <code>newArray</code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(array, [1,2,3,4,5,6], 'You should concat the two arrays together.');",
|
||||
"assert(editor.getValue().match(/\\.concat\\s*\\(/gi), 'message: You should be use the concat method to merge the two arrays.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\]/gi) && editor.getValue().match(/\\[4\\,5\\,6\\]/gi), 'message: You should only modify the two arrays without changing the origional ones.');"
|
||||
"assert.deepEqual(newArray, [1,2,3,4,5,6], 'message: You should concatenate the two arrays together.');",
|
||||
"assert(editor.getValue().match(/\\.concat\\s*\\(/gi), 'message: You should be using the <code>concat</code> method to merge the two arrays.');",
|
||||
"assert(editor.getValue().match(/\\[1\\,2\\,3\\]/gi) && editor.getValue().match(/\\[4\\,5\\,6\\]/gi), 'message: You should only be using <code>concat</code> to modify the arrays.');"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"var array = [1,2,3];",
|
||||
"var oldArray = [1,2,3];",
|
||||
"",
|
||||
"var concatMe = [4,5,6];",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"",
|
||||
"var newArray = oldArray;",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"(function() {return array;})();"
|
||||
"",
|
||||
"(function() { return newArray; })();"
|
||||
],
|
||||
"challengeType": 1,
|
||||
"type": "waypoint"
|
||||
@ -336,23 +380,26 @@
|
||||
{
|
||||
"id":"cf1111c1c16feddfaeb4bdef",
|
||||
"title":"Split Strings with .split",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"You can use the <code>.split()</code> method to split a string into an array.",
|
||||
"split uses the argument you give to to split the string.",
|
||||
"<code>array = string.split(' ');</code>"
|
||||
"You can use the <code>split</code> method to split a string into an array.",
|
||||
"<code>split</code> uses the argument you pass in as a delimiter to determine which points the string should be split at.",
|
||||
"Here is an example of <code>split</code> being used to split an array at every <code>s</code> character:",
|
||||
"<code>var array = string.split('s');</code>",
|
||||
"Use <code>split</code> to create an array of words from <code>string</code> and assign it to <code>array</code>."
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof(array) === 'object' && array.length === 5, 'message: You should split the string by its spaces.');",
|
||||
"assert(/\\.split\\(/gi, 'message: You should use the split method on the string.');"
|
||||
"assert(/\\.split\\(/gi, 'message: You should use the <code>split</code> method on the string.');",
|
||||
"assert(typeof(array) === 'object' && array.length === 5, 'message: You should split the string by its spaces.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var string = \"Split me into an array\";",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"var array = string;",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"(function() {return array;})();"
|
||||
],
|
||||
"challengeType":1,
|
||||
@ -361,23 +408,28 @@
|
||||
{
|
||||
"id":"cf1111c1c16feddfaeb5bdef",
|
||||
"title":"Join Strings with .join",
|
||||
"difficulty":0,
|
||||
"description":[
|
||||
"We can use the <code>.join()</code> method to join each element in an array into a string separated by whatever delimiter you provide as an argument to the join operation.",
|
||||
"<code>var joinMe = joinMe.join(\" \");</code>"
|
||||
"We can use the <code>join</code> method to join each element of an array into a string separated by whatever delimiter you provide as an argument.",
|
||||
"The following is an example of using <code>join</code> to join all of the elements of an array into a string with all the elements seperated by word `Na`:",
|
||||
"<code>var joinMe = [\"Na \", \"Na \", \"Na \", \"Na \", \"Batman!\"];</code>",
|
||||
"<code>var joinedString = joinMe.join(\"Na \");</code>",
|
||||
"<code>console.log(joinedString);</code>",
|
||||
"Use the <code>join</code> method to create a string from <code>joinMe</code> with spaces in between each element and assign it to <code>joinedString</code>."
|
||||
],
|
||||
"tests":[
|
||||
"assert(typeof(joinMe) === 'string' && joinMe === \"Split me into an array\", 'message: You should join the arrays by their spaces.');",
|
||||
"assert(/\\.join\\(/gi, 'message: You should use of the join method on the array.');"
|
||||
"assert(typeof(joinedString) === 'string' && joinedString === \"Split me into an array\", 'message: You should join the elements of the array with spaces.');",
|
||||
"assert(/\\.join\\(/gi, 'message: You should use of the <code>join</code> method on the array.');"
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var joinMe = [\"Split\",\"me\",\"into\",\"an\",\"array\"];",
|
||||
"",
|
||||
"// Only change code below this line.",
|
||||
"",
|
||||
"joinMe = joinMe;",
|
||||
"var joinedString = joinMe;",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"(function() {return joinMe;})();"
|
||||
"",
|
||||
"(function() {return joinedString;})();"
|
||||
],
|
||||
"challengeType":1,
|
||||
"type": "waypoint"
|
||||
|
@ -39,6 +39,9 @@
|
||||
"Closures",
|
||||
"Details of the Object Model"
|
||||
],
|
||||
"solutions": [
|
||||
"var Person = function(firstAndLast) {\n\n var firstName, lastName;\n\n function updateName(str) { \n firstName = str.split(\" \")[0];\n lastName = str.split(\" \")[1]; \n }\n\n updateName(firstAndLast);\n\n this.getFirstName = function(){\n return firstName;\n };\n \n this.getLastName = function(){\n return lastName;\n };\n \n this.getFullName = function(){\n return firstName + \" \" + lastName;\n };\n \n this.setFirstName = function(str){\n firstName = str;\n };\n \n\n this.setLastName = function(str){\n lastName = str;\n };\n \n this.setFullName = function(str){\n updateName(str);\n };\n};\n\nvar bob = new Person('Bob Ross');\nbob.getFullName();"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -80,6 +83,9 @@
|
||||
"MDNlinks": [
|
||||
"Math.pow()"
|
||||
],
|
||||
"solutions": [
|
||||
"function orbitalPeriod(arr) {\n var GM = 398600.4418;\n var earthRadius = 6367.4447;\n var TAU = 2 * Math.PI; \n return arr.map(function(obj) {\n return {\n name: obj.name,\n orbitalPeriod: Math.round(TAU * Math.sqrt(Math.pow(obj.avgAlt+earthRadius, 3)/GM))\n };\n });\n}\n\norbitalPeriod([{name : \"sputkin\", avgAlt : 35873.5553}]);\n"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
@ -120,6 +126,9 @@
|
||||
"Array.reduce()"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"solutions": [
|
||||
"function pairwise(arr, arg) {\n var sum = 0;\n arr.forEach(function(e, i, a) {\n if (e != null) { \n var diff = arg-e;\n a[i] = null;\n var dix = a.indexOf(diff);\n if (dix !== -1) {\n sum += dix;\n sum += i;\n a[dix] = null;\n } \n }\n });\n return sum;\n}\n\npairwise([1,4,2,3,0,5], 7);\n"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"nameCn": "",
|
||||
"descriptionCn": [],
|
||||
|
@ -1,55 +1,34 @@
|
||||
/* eslint-disable no-process-exit */
|
||||
require('babel/register');
|
||||
require('dotenv').load();
|
||||
|
||||
var fs = require('fs'),
|
||||
Rx = require('rx'),
|
||||
_ = require('lodash'),
|
||||
path = require('path'),
|
||||
app = require('../server/server'),
|
||||
nonprofits = require('./nonprofits.json'),
|
||||
jobs = require('./jobs.json');
|
||||
app = require('../server/server');
|
||||
|
||||
function getFilesFor(dir) {
|
||||
return fs.readdirSync(path.join(__dirname, '/' + dir));
|
||||
}
|
||||
|
||||
var Challenge = app.models.Challenge;
|
||||
var Nonprofit = app.models.Nonprofit;
|
||||
var Job = app.models.Job;
|
||||
var counter = 0;
|
||||
var challenges = getFilesFor('challenges');
|
||||
// plus two accounts for nonprofits and jobs seed.
|
||||
var numberToSave = challenges.length + 1;
|
||||
var destroy = Rx.Observable.fromNodeCallback(Challenge.destroyAll, Challenge);
|
||||
var create = Rx.Observable.fromNodeCallback(Challenge.create, Challenge);
|
||||
|
||||
function completionMonitor() {
|
||||
// Increment counter
|
||||
counter++;
|
||||
|
||||
// Exit if all challenges have been checked
|
||||
if (counter >= numberToSave) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Log where in the seed order we're currently at
|
||||
console.log('Call: ' + counter + '/' + numberToSave);
|
||||
}
|
||||
|
||||
Challenge.destroyAll(function(err, info) {
|
||||
if (err) {
|
||||
throw err;
|
||||
} else {
|
||||
console.log('Deleted ', info);
|
||||
}
|
||||
challenges.forEach(function(file) {
|
||||
destroy()
|
||||
.flatMap(function() { return Rx.Observable.from(challenges); })
|
||||
.flatMap(function(file) {
|
||||
var challengeSpec = require('./challenges/' + file);
|
||||
var order = challengeSpec.order;
|
||||
var block = challengeSpec.name;
|
||||
var isBeta = !!challengeSpec.isBeta;
|
||||
console.log('parsed %s successfully', file);
|
||||
|
||||
// challenge file has no challenges...
|
||||
if (challengeSpec.challenges.length === 0) {
|
||||
console.log('file %s has no challenges', file);
|
||||
completionMonitor();
|
||||
return;
|
||||
return Rx.Observable.just([{ block: 'empty ' + block }]);
|
||||
}
|
||||
|
||||
var challenges = challengeSpec.challenges
|
||||
@ -73,50 +52,15 @@ Challenge.destroyAll(function(err, info) {
|
||||
return challenge;
|
||||
});
|
||||
|
||||
Challenge.create(
|
||||
challenges,
|
||||
function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
} else {
|
||||
console.log('Successfully parsed %s', file);
|
||||
completionMonitor(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Nonprofit.destroyAll(function(err, info) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
} else {
|
||||
console.log('Deleted ', info);
|
||||
}
|
||||
Nonprofit.create(nonprofits, function(err, data) {
|
||||
if (err) {
|
||||
throw err;
|
||||
} else {
|
||||
console.log('Saved ', data);
|
||||
return create(challenges);
|
||||
})
|
||||
.subscribe(
|
||||
function(challenges) {
|
||||
console.log('%s successfully saved', challenges[0].block);
|
||||
},
|
||||
function(err) { throw err; },
|
||||
function() {
|
||||
console.log('challenge seed completed');
|
||||
process.exit(0);
|
||||
}
|
||||
completionMonitor(err);
|
||||
console.log('nonprofits');
|
||||
});
|
||||
});
|
||||
|
||||
Job.destroyAll(function(err, info) {
|
||||
if (err) {
|
||||
throw err;
|
||||
} else {
|
||||
console.log('Deleted ', info);
|
||||
}
|
||||
Job.create(jobs, function(err, data) {
|
||||
if (err) {
|
||||
console.log('error: ', err);
|
||||
} else {
|
||||
console.log('Saved ', data);
|
||||
}
|
||||
console.log('jobs');
|
||||
completionMonitor(err);
|
||||
});
|
||||
});
|
||||
);
|
||||
|
29
seed/nonprofits.js
Normal file
29
seed/nonprofits.js
Normal file
@ -0,0 +1,29 @@
|
||||
/* eslint-disable no-process-exit */
|
||||
require('babel/register');
|
||||
require('dotenv').load();
|
||||
|
||||
var Rx = require('rx');
|
||||
var app = require('../server/server');
|
||||
|
||||
var Nonprofits = app.models.Nonprofit;
|
||||
var nonprofits = require('./nonprofits.json');
|
||||
var destroy = Rx.Observable.fromNodeCallback(Nonprofits.destroyAll, Nonprofits);
|
||||
var create = Rx.Observable.fromNodeCallback(Nonprofits.create, Nonprofits);
|
||||
|
||||
destroy()
|
||||
.flatMap(function() {
|
||||
if (!nonprofits) {
|
||||
return Rx.Observable.throw(new Error('No nonprofits found'));
|
||||
}
|
||||
return create(nonprofits);
|
||||
})
|
||||
.subscribe(
|
||||
function(nonprofits) {
|
||||
console.log('successfully saved %d nonprofits', nonprofits.length);
|
||||
},
|
||||
function(err) { throw err; },
|
||||
function() {
|
||||
console.log('nonprofit seed completed');
|
||||
process.exit(0);
|
||||
}
|
||||
);
|
@ -1,6 +1,5 @@
|
||||
[
|
||||
{
|
||||
"id": "bd7157d8c441cbafaeb5bdef",
|
||||
"whatDoesNonprofitDo": "We help the many less-fortunate Jewish families in our community, by providing them with nutritious food and energy to grow, learn, work, and give them hope for a better and brighter future.",
|
||||
"websiteLink": "http://chasdeikaduri.org/",
|
||||
"name": "Chasdei Kaduri",
|
||||
@ -13,14 +12,13 @@
|
||||
"form"
|
||||
],
|
||||
"projectDescription": "Campers will create a system will integrate the food inventory, donor and delivery driver management systems as well as replace the current application system with a custom form solution. System will include a more streamlined operations management, with user printable lists of inventory, drivers, and deliveries.",
|
||||
"logoUrl": "https://trello-attachments.s3.amazonaws.com/54c7e02f2c173c37015b2f36/604x309/00580a0567a4b3afda29d52b09e7e829/rQQ6zwq31Uya8ie9QHC-MlvfXxqftm9UPPe524JUhmwSEaZjQ7oL7U1tVoHLUj-gVUwM-7uzBGFsAXD_A_cx_JyAZP4Td-GMBJ-AebJNRAQP0m0v253eKMkURp63aG4%3Ds0-d-e1-ft.png",
|
||||
"imageUrl": "https://pbs.twimg.com/media/B3d6B8PIYAAa6QL.jpg",
|
||||
"logoUrl": "http://i.imgur.com/zQiM0P8.png",
|
||||
"imageUrl": "http://i.imgur.com/xeRdA87.jpg",
|
||||
"estimatedHours": 300,
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 60000
|
||||
},
|
||||
{
|
||||
"id": "bd7158d8c464cbafaeb4bdef",
|
||||
"whatDoesNonprofitDo": "We connect simple technology with last mile communities to reduce poverty.",
|
||||
"websiteLink": "http://kopernik.info/",
|
||||
"name": "Kopernik",
|
||||
@ -29,14 +27,13 @@
|
||||
"other"
|
||||
],
|
||||
"projectDescription": "Campers will create a Chrome browser extension to preserve sales data from a form, and upload in batches as the internet connection allows.",
|
||||
"logoUrl": "https://trello-attachments.s3.amazonaws.com/54d29f1e4c726fd765fa87ef/54d29f6388812dd367a243ab/x/018d9d3be5439870c56cccba5b3aa8bf/kopernik-logo-global.png",
|
||||
"imageUrl": "http://kopernik.info/sites/default/files/updates/Presenting_the_low_carbon_t.jpg",
|
||||
"logoUrl": "http://i.imgur.com/xTqjIkC.png",
|
||||
"imageUrl": "http://i.imgur.com/xBAUJSa.jpg",
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 20000
|
||||
},
|
||||
{
|
||||
"id": "bd1326d9c245cbafaeb4bdef",
|
||||
"whatDoesNonprofitDo": "We distribute biodegradable toothbrushes globally to children in need.",
|
||||
"websiteLink": "http://www.operationbrush.org/",
|
||||
"name": "Operation Brush",
|
||||
@ -45,14 +42,13 @@
|
||||
"website"
|
||||
],
|
||||
"projectDescription": "Campers will create a mobile responsive website for the organization, with donation capabilities.",
|
||||
"logoUrl": "https://trello-attachments.s3.amazonaws.com/54d9810307b159a4d9027aa2/54d981bfe5eb145560fbb769/x/cf7f318bfe4aee631b0d0eeef272225c/logo.png",
|
||||
"imageUrl": "http://www.operationbrush.org/images/temp/hands1.png",
|
||||
"logoUrl": "http://i.imgur.com/DEDhImE.png",
|
||||
"imageUrl": "http://i.imgur.com/RuA9Rgy.jpg",
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 20000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb5bdef",
|
||||
"whatDoesNonprofitDo": "We are the largest roller derby league in the world with around 250 adults and 150 junior skater members plus 500+ volunteers.",
|
||||
"websiteLink": "http://www.rosecityrollers.com/about/our-charities/",
|
||||
"name": "Rose City Rollers",
|
||||
@ -61,14 +57,13 @@
|
||||
"community"
|
||||
],
|
||||
"projectDescription": "Campers will create a volunteer management system with multi-user access and reporting capabilities.",
|
||||
"logoUrl": "https://trello-attachments.s3.amazonaws.com/54c1daf2d72d8eb868910b60/54c1dd4ecffcb09fc52b68a1/x/a8148f08769b449217e433bab8f39ddd/RCR-color.jpg",
|
||||
"imageUrl": "http://www.rosecityrollers.com/wp-content/uploads/2015/01/BZ7_5923-X3-675x375.jpg",
|
||||
"logoUrl": "http://i.imgur.com/ZZAZSs4.jpg",
|
||||
"imageUrl": "http://i.imgur.com/WKS4cZ8.jpg",
|
||||
"estimatedHours": 200,
|
||||
"currentStatus": "started",
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 40000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb6bde1",
|
||||
"whatDoesNonprofitDo": "We provide urgently needed pediatric heart surgery and follow-up care for indigent children from developing countries",
|
||||
"websiteLink": "http://www.saveachildsheart.com/global/young-leadership-program/",
|
||||
"name": "Save a Child's Heart",
|
||||
@ -77,14 +72,13 @@
|
||||
"website"
|
||||
],
|
||||
"projectDescription": "Campers will create a single page fundraising website. In exchange for a donation, a user can customize a graphical 'heart' in someone's name or anonymously. The page will display all of the hearts on a 'wall of hearts.'",
|
||||
"logoUrl": "https://trello-attachments.s3.amazonaws.com/548b36629137780091a973cc/666x666/6c7a366ffb659649f6377d4a431687cd/country-logos-1-300dpi.jpg",
|
||||
"imageUrl": "http://www.saveachildsheart.com/wp-content/uploads/2013/10/7.2.5_Internation_Photograohy_Exhibition.jpg",
|
||||
"logoUrl": "http://i.imgur.com/t6tpiEW.jpg",
|
||||
"imageUrl": "http://i.imgur.com/xqhvdn2.jpg",
|
||||
"estimatedHours": 200,
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 40000
|
||||
},
|
||||
{
|
||||
"id": "bd1225d8c464cbafaeb4bdef",
|
||||
"whatDoesNonprofitDo": "We empower youth with technology by providing age appropriate resources and education.",
|
||||
"websiteLink": "http://savvycyberkids.org/",
|
||||
"name": "Savvy Cyber Kids",
|
||||
@ -93,14 +87,13 @@
|
||||
"website"
|
||||
],
|
||||
"projectDescription": "Campers will create a website where potential donors can view which schools already have the Savvy Cyber Kids books, and donate books to those schools that do not.",
|
||||
"logoUrl": "https://trello-attachments.s3.amazonaws.com/54ee3c7bf205562680177b59/218x190/1dc460de4edc9fdd4b481b24e93cfb23/logo.png",
|
||||
"imageUrl": "http://www.privatewifi.com/wp-content/uploads/2014/10/Halpert.jpg",
|
||||
"logoUrl": "http://i.imgur.com/JgxYVJ5.png",
|
||||
"imageUrl": "http://i.imgur.com/ZTg12ao.jpg",
|
||||
"estimatedHours": 200,
|
||||
"currentStatus": "started",
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 40000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb7bcef",
|
||||
"whatDoesNonprofitDo": "We bring a new edge to arts and medicine in the Bay Area through powerful live performances of new music to those who feel marginalized by their affliction.",
|
||||
"websiteLink": "http://transcendentpathways.org/",
|
||||
"name": "Transcendent Pathways",
|
||||
@ -109,15 +102,14 @@
|
||||
"other"
|
||||
],
|
||||
"projectDescription": "Campers will build a website where medical facilities can list music therapy time slots, and musicians can sign up to fill these slots.",
|
||||
"logoUrl": "http://static1.squarespace.com/static/521b8957e4b024f66a58b214/t/521b8e9de4b093a8696eb9b8/1398718364447/?format=750w",
|
||||
"imageUrl": "https://trello-attachments.s3.amazonaws.com/54fdb0328917ca64e9e8a79f/54fdc3b710f67caf6da14719/x/49fbe0012179bf254928f3f2a44810b4/Screen_2BShot_2B2013-08-26_2Bat_2B1.32.35_2BPM.png",
|
||||
"logoUrl": "http://i.imgur.com/JV4rcKX.png",
|
||||
"imageUrl": "http://i.imgur.com/gyhrPee.jpg",
|
||||
"estimatedHours": 200,
|
||||
"currentStatus": "started",
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 40000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb8bdef",
|
||||
"whatDoesNonprofitDo": "We have provide volunteer matching fairs and silent art auctions at events across Canada. Rather than bid money on artwork, participants bid volunteer hours.",
|
||||
"whatDoesNonprofitDo": "We have provide volunteer matching fairs and silent art auctions at events across Canada. Rather than bid money on artwork, participants bid volunteer hours.",
|
||||
"websiteLink": "http://www.timeraiser.ca/",
|
||||
"name": "Timeraiser",
|
||||
"endUser": "Working professionals who want to donate their time and expertise",
|
||||
@ -125,14 +117,13 @@
|
||||
"other"
|
||||
],
|
||||
"projectDescription": "Campers will build a mobile responsive web form to allow Timeraiser eventgoers to select which nonprofit organizations they're interested in volunteering with. System will have Salesforce integration and reporting capabilities.",
|
||||
"logoUrl": "http://www.timeraiser.ca/uploads/5/6/1/4/5614163/1277176.png?480",
|
||||
"imageUrl": "http://www.timeraiser.ca/uploads/5/6/1/4/5614163/______________4571248_orig.png",
|
||||
"logoUrl": "http://i.imgur.com/USK8ld7.png",
|
||||
"imageUrl": "http://i.imgur.com/7apWppe.jpg",
|
||||
"estimatedHours": 200,
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 40000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb7bdef",
|
||||
"whatDoesNonprofitDo": "We focus on raising funds to assist injured homeless animals.",
|
||||
"websiteLink": "http://www.peoplesavinganimals.org/",
|
||||
"name": "People Saving Animals",
|
||||
@ -143,14 +134,13 @@
|
||||
"form"
|
||||
],
|
||||
"projectDescription": "Campers will build an adoption database and all related web interfaces and forms to allow animal shelters to easily post animals, photos, and relevant medical information. They'll make it easy for locals to browse these animals and adopt them. Once completed, this project will be translated into Spanish.",
|
||||
"logoUrl": "https://scontent-sjc2-1.xx.fbcdn.net/hphotos-xfa1/v/t1.0-9/59709_501505959886494_1605714757_n.jpg?oh=e12c08c046d824765a02242b7c8c3bb5&oe=560CFA6A",
|
||||
"imageUrl": "https://scontent-sjc2-1.xx.fbcdn.net/hphotos-xta1/t31.0-8/11270516_844556088914811_757350153964826829_o.jpg",
|
||||
"logoUrl": "http://i.imgur.com/iKcKcpg.jpg",
|
||||
"imageUrl": "http://i.imgur.com/b9ZeU7R.jpg",
|
||||
"estimatedHours": 300,
|
||||
"currentStatus": "started",
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 60000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb6bde2",
|
||||
"whatDoesNonprofitDo": "We preserve Florida's health by regulating septic contractors and reviewing logs of sewage collection and disposal.",
|
||||
"websiteLink": "http://www.floridahealth.gov/",
|
||||
"name": "Florida Department of Health",
|
||||
@ -161,15 +151,14 @@
|
||||
"other"
|
||||
],
|
||||
"projectDescription": "Campers will build mobile responsive web forms to allow contractors to seamlessly log the chain of custody for potentially hazardous sewage. They'll also build a government-facing database that allows for easy monitoring and reporting of activity.",
|
||||
"logoUrl": "http://www.floridahealth.gov/_new/_files/images/DOH_logo.png",
|
||||
"imageUrl": "http://www.dep.state.fl.us/central/Home/Watershed/Home.jpg",
|
||||
"logoUrl": "http://i.imgur.com/J3Scbsp.png",
|
||||
"imageUrl": "http://i.imgur.com/8LEFrKy.jpg",
|
||||
"estimatedHours": 200,
|
||||
"currentStatus": "started",
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 40000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb6bde3",
|
||||
"whatDoesNonprofitDo": "We strengthen the value of songwriting and independent music in Columbus, Ohio.",
|
||||
"whatDoesNonprofitDo": "We strengthen the value of songwriting and independent music in Columbus, Ohio.",
|
||||
"websiteLink": "http://columbussongwritersassociation.com",
|
||||
"name": "Columbus Songwriters Association",
|
||||
"endUser": "Songwriters and their audiences in the Columbus, Ohio community.",
|
||||
@ -177,14 +166,13 @@
|
||||
"website"
|
||||
],
|
||||
"projectDescription": "Build mobile responsive website that allows users to see browse our partners, their photos and information, and connect with them.",
|
||||
"logoUrl": "https://columbussongwritersassociation.files.wordpress.com/2014/06/csa-logo.jpeg?w=705&h=435&crop=1",
|
||||
"imageUrl": "https://columbussongwritersassociation.files.wordpress.com/2015/03/10502364_918551148225410_5082247612691070613_n.jpg?w=705&h=344&crop=1",
|
||||
"logoUrl": "http://i.imgur.com/UN85TI4.jpg",
|
||||
"imageUrl": "http://i.imgur.com/NFxL1oS.jpg",
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "completed",
|
||||
"moneySaved": 20000
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb4bbb",
|
||||
"whatDoesNonprofitDo": "We leverage all the benefits of cycling to support and improve the lives of youth and teens in the Triangle region.",
|
||||
"websiteLink": "http://www.trianglebikeworks.org",
|
||||
"name": "Triangle Bike Works",
|
||||
@ -200,7 +188,6 @@
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb4bccc",
|
||||
"whatDoesNonprofitDo": "We work to eradicate female genital mutilation in the US and Gambia. We work with survivors and communities.",
|
||||
"websiteLink": "http://safehandsforgirls.org/",
|
||||
"name": "Safe Hands for Girls",
|
||||
@ -216,7 +203,6 @@
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb4beff",
|
||||
"whatDoesNonprofitDo": "We're a part of the Department of Psychiatry at Mass General Hospital. We teach an innovative way for helping people that have challenging behaviors.",
|
||||
"websiteLink": "http://www.thinkkids.org/",
|
||||
"name": "Think Kids at Massachusetts General Hospital",
|
||||
@ -225,14 +211,13 @@
|
||||
"volunteer"
|
||||
],
|
||||
"projectDescription": "We would like help developing a simple online based portal for both our trainees and trainers where we can store and share documents, track their progress, and incorporate a blackboard/chat forum.",
|
||||
"logoUrl": "http://www.thinkkids.org/wp-content/themes/think-kids/images/logo.png",
|
||||
"logoUrl": "http://i.imgur.com/fu6dTmH.png",
|
||||
"imageUrl": "http://i.imgur.com/hiGJms5.png",
|
||||
"estimatedHours": 300,
|
||||
"currentStatus": "open",
|
||||
"currentStatus": "started",
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbaeaeb4bdef",
|
||||
"whatDoesNonprofitDo": "We enable, educate, and empower students from rural backgrounds in Uttar Pradesh, India.",
|
||||
"websiteLink": "http://www.milaan.in/",
|
||||
"name": "Milaan",
|
||||
@ -242,13 +227,12 @@
|
||||
],
|
||||
"projectDescription": "Campers will build a basic website for the US operations of Milaan. ",
|
||||
"logoUrl": "http://i.imgur.com/GLq1qqD.png",
|
||||
"imageUrl": "http://www.milaan.in/wp-content/uploads/2014/07/IMG_2624-e1432218749722.jpg",
|
||||
"imageUrl": "http://i.imgur.com/PkMHQ8N.jpg",
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "open",
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb4beee",
|
||||
"whatDoesNonprofitDo": "We're committed to closing the opportunity gap for children in Baltimore City by providing high quality after school and in-school programs.",
|
||||
"websiteLink": "http://childfirstauthority.org/",
|
||||
"name": "Child First Authority",
|
||||
@ -258,58 +242,39 @@
|
||||
],
|
||||
"projectDescription": "Campers will build a dynamic database that will allow 7 community school coordinators to (1) input student-level absenteeism data, (2) code and track outreach efforts, (3) code root causes for absenteeism, and (4) track trends in each area. Currently, Child First uses an unwieldy excel spreadsheet to do this.",
|
||||
"logoUrl": "http://i.imgur.com/YlPsQmN.jpg",
|
||||
"imageUrl": "http://childfirstauthority.org/wp-content/uploads/2012/09/CFAHEADER7.gif",
|
||||
"imageUrl": "http://i.imgur.com/Z2RfQku.gifv",
|
||||
"estimatedHours": 200,
|
||||
"currentStatus": "open",
|
||||
"currentStatus": "started",
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c464cbafaeb4bdef",
|
||||
"whatDoesNonprofitDo": "SOLACE Foundation provides drug overdose prevention and awareness training as well as grief support for bereaved families.",
|
||||
"websiteLink": "https://www.facebook.com/www.solaceorangecounty.org",
|
||||
"name": "The Solace Foundation of Orange County",
|
||||
"endUser": "Donors",
|
||||
"approvedDeliverables": ["Website"],
|
||||
"projectDescription": "Campers will build a basic website that accepts donations.",
|
||||
"logoUrl": "http://i.imgur.com/79E3nP0.png",
|
||||
"imageUrl": "http://i.imgur.com/kCWN1iT.jpg",
|
||||
"interestedCampers": [],
|
||||
"confirmedCampers": [],
|
||||
"estimatedHours": 100
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c463cbafaeb4bdef",
|
||||
"whatDoesNonprofitDo": "We are an interdisciplinary team that works towards harmony among humans and nature through three distinct branches: sustainable agriculture, environmental education and applied and appropriate technology; focused in Líbano, Tolima, Colombia.",
|
||||
"websiteLink": "string",
|
||||
"websiteLink": "",
|
||||
"name": "QET America",
|
||||
"endUser": "Donors",
|
||||
"approvedDeliverables": ["Website"],
|
||||
"projectDescription": "Campers will build a multiple language website (English, Spanish) that accepts donations.",
|
||||
"logoUrl": "http://i.imgur.com/jPuiPOy.jpg",
|
||||
"imageUrl": "http://i.imgur.com/zaaL2pj.jpg",
|
||||
"interestedCampers": [],
|
||||
"confirmedCampers": [],
|
||||
"estimatedHours": 100
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "open",
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c462cbafaeb4bdef",
|
||||
"whatDoesNonprofitDo": "1to1 Movement provides free environmental education in schools",
|
||||
"websiteLink": "http://1to1movement.org/",
|
||||
"stakeholderName": "string",
|
||||
"stakeholderEmail": "string",
|
||||
"name": "1 to 1 Movement",
|
||||
"endUser": "Pledgers",
|
||||
"approvedDeliverables": ["Web App"],
|
||||
"projectDescription": "Campers will build a simple, social, data-driven application that allows people to see the impact of their actions. User can make a pledge and track the outcome. Will make use of the D3.js visualization library.",
|
||||
"logoUrl": "http://i.imgur.com/jaqxg0O.png",
|
||||
"imageUrl": "http://i.imgur.com/GXSWTZw.jpg",
|
||||
"interestedCampers": [],
|
||||
"confirmedCampers": [],
|
||||
"estimatedHours": 300
|
||||
"estimatedHours": 300,
|
||||
"currentStatus": "open",
|
||||
"moneySaved": 0
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bd1325d8c464cbcfaeb4bdef",
|
||||
"whatDoesNonprofitDo": "Our missions is to elevate the national dialogue and engage the American people around climate change policy and the promotion of real clean energy solutions in the United States.",
|
||||
"websiteLink": "http://www.usclimateplan.org/",
|
||||
"name": "US Climate Plan",
|
||||
@ -318,24 +283,47 @@
|
||||
"projectDescription": "Campers will build a basic website for sharing information, feeds from different campaign’s websites.",
|
||||
"logoUrl": "http://i.imgur.com/uAyUiMN.png",
|
||||
"imageUrl": "http://i.imgur.com/2Og5tqy.jpg",
|
||||
"interestedCampers": [],
|
||||
"confirmedCampers": [],
|
||||
"estimatedHours": 100
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "open",
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"id": "bd1325d8c461cbafaeb4bdef",
|
||||
"whatDoesNonprofitDo": "We empower the community through improved literacy.",
|
||||
"websiteLink": "http://www.tleliteracy.com/",
|
||||
"stakeholderName": "Darlene Brown",
|
||||
"stakeholderEmail": "string",
|
||||
"name": "The Learning Exchange",
|
||||
"endUser": "string",
|
||||
"endUser": "Community members",
|
||||
"approvedDeliverables": ["Website"],
|
||||
"projectDescription": "Campers will build a simple website to replace essentialskillsquebec.com. Site will host many documents related to the Nine Essential Skills.",
|
||||
"logoUrl": "http://i.imgur.com/jXQY01H.png",
|
||||
"imageUrl": "http://i.imgur.com/iUXBpeL.jpg",
|
||||
"interestedCampers": [],
|
||||
"confirmedCampers": [],
|
||||
"estimatedHours": 100
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "started",
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"whatDoesNonprofitDo": "Options Inc. is an organization that was founded in 1979 to assist adults with disabilities in living and working in the community. We provide transportation to approximately 230 individuals.",
|
||||
"websiteLink": "www.options-inc.org",
|
||||
"name": "Options Inc.",
|
||||
"endUser": "Administrators and Persons with Disabilities",
|
||||
"approvedDeliverables": ["Web App"],
|
||||
"projectDescription": "Campers will build a system to store all of Options Inc.'s clients addresses, optimize routes for our 23 vehicles, and schedule their staff for these routes.",
|
||||
"logoUrl": "http://i.imgur.com/jGWRMuF.jpg",
|
||||
"imageUrl": "http://i.imgur.com/VUuJJlM.jpg",
|
||||
"estimatedHours": 300,
|
||||
"currentStatus": "open",
|
||||
"moneySaved": 0
|
||||
},
|
||||
{
|
||||
"whatDoesNonprofitDo": "Our goal is to improve addiction treatment and recovery services through targeted outreach, policy development, and direct support services for addicts, their families and health professionals.",
|
||||
"websiteLink": "http://www.taadas.org/",
|
||||
"name": "Tennessee Association of Alcohol Drug and other Addiction Services",
|
||||
"endUser": "Administrators and Persons with Disabilities",
|
||||
"approvedDeliverables": ["Website"],
|
||||
"projectDescription": "Campers will build a modern, mobile-responsive website.",
|
||||
"logoUrl": "http://i.imgur.com/kYHgY0F.jpg",
|
||||
"imageUrl": "http://i.imgur.com/W6L1sGV.jpg",
|
||||
"estimatedHours": 100,
|
||||
"currentStatus": "open",
|
||||
"moneySaved": 0
|
||||
}
|
||||
]
|
||||
|
@ -1,522 +0,0 @@
|
||||
{
|
||||
"name": "JSON APIs and Ajax",
|
||||
"order": 0.0065,
|
||||
"challenges": [
|
||||
{
|
||||
"id": "bad87fed1348bd9aeca08826",
|
||||
"title": "Trigger on click Events with jQuery",
|
||||
"description": [
|
||||
"With jQuery we are able to get data from APIs via Ajax",
|
||||
"This data normally comes in the form of JSON",
|
||||
"Let's get the <code>Get Message</code> button to set the text of a div",
|
||||
"We will later use this to display the result of out API request",
|
||||
"<code>$(\"#getMessage\").on(\"click\", function(){</code>",
|
||||
"<code>  $(\".message\").html(\"Here is the message\");</code>",
|
||||
"<code>});</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(editor.match(/\\$\\(\\s?\\\"\\#getMessage\\\"\\s?\\)\\.on\\s?\\(\\s?\\\"click\\\"\\,\\s?function\\s?\\(\\)\\s?\\{/gi), 'You should have bound the click event to the getMessage button')",
|
||||
"assert(editor.match(/\\$\\(\\s?\\\"\\.message\\\"\\s?\\)\\.html\\(\\s?\\\"Here\\sis\\sthe\\smessage\\\"\\s?\\);/gi), 'You should set te value of the #message box to be the message given in the description')",
|
||||
"assert(editor.match(/\\}\\);/gi) && editor.match(/\\}\\);/gi).length >= 2, 'Make sure that you close off all of your functions')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" ",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <br/>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well Message\">",
|
||||
" The message will go here",
|
||||
" </div>",
|
||||
" </div>",
|
||||
" <br/>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bad87fee1348bd9aebc08726",
|
||||
"title": "Learn JSON Syntax",
|
||||
"description": [
|
||||
"JSON stands for \"JavaScript Object Notation\". It\"s how you create objects in JavaScript.",
|
||||
"JSON is a series of \"key-value pairs\". Everything on the left of the colon (<code>:</code>) is the \"key\" you use to unlock the \"value\" on the right of the colon."
|
||||
],
|
||||
"tests": [
|
||||
"assert(typeof data != \"undefined\", \"Whoops! It looks like you deleted the <code>data</code> variable!\");",
|
||||
"assert(typeof getAnId != \"undefined\", \"Whoops! It looks like you deleted the <code>getAnId</code> function!\");",
|
||||
"assert(data[0]['id'] === getAnId(), \"The duntion getFirstId should return the id of the first element in the array\");"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
"var data = [",
|
||||
" {",
|
||||
" \"id\": 0,",
|
||||
" \"imageLink\": \"http://rs611.pbsrc.com/albums/tt194/allypopper423/Funny-Cat-Green-Avacado.jpg~c200\",",
|
||||
" \"codeNames\": [",
|
||||
" \"Juggernaut\",",
|
||||
" \"Mrs. Wallace\",",
|
||||
" \"Buttercup\"",
|
||||
" ]",
|
||||
" },",
|
||||
" {",
|
||||
" \"id\": 1,",
|
||||
" \"imageLink\": \"http://cdn.grumpycats.com/wp-content/uploads/2012/09/GC-Gravatar-copy.png\",",
|
||||
" \"codeNames\": [",
|
||||
" \"Oscar\",",
|
||||
" \"Scrooge\",",
|
||||
" \"Tyrion\"",
|
||||
" ]",
|
||||
" },",
|
||||
" {",
|
||||
" \"id\": 2,",
|
||||
" \"imageLink\": \"http://www.kittenspet.com/wp-content/uploads/2012/08/cat_with_funny_face_3-200x200.jpg\",",
|
||||
" \"codeNames\": [",
|
||||
" \"The Doctor\",",
|
||||
" \"Loki\",",
|
||||
" \"Joker\"",
|
||||
" ]",
|
||||
" }",
|
||||
"]",
|
||||
"function getAnId(){",
|
||||
" return();",
|
||||
"}",
|
||||
"fcces"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
{
|
||||
"id": "bad87fee1348bd9aeca08826",
|
||||
"title": "Displaying JSON data in HTML",
|
||||
"description": [
|
||||
"JSON stands for \"JavaScript Object Notation\". It\"s how you create objects in JavaScript.",
|
||||
"JSON is a series of \"key-value pairs\". Everything on the left of the colon (<code>:</code>) is the \"key\" you use to unlock the \"value\" on the right of the colon."
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" $(\"#getMessage\").on(\"click\", function(){",
|
||||
" $(\".message\").html(\"Here is the message\");",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class = \"row text-center\">",
|
||||
" <h2>Cat Photo Finder</h2>",
|
||||
" </div>",
|
||||
" <br/>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12 well Message\">",
|
||||
" The message will go here",
|
||||
" </div>",
|
||||
" </div>",
|
||||
" <br/>",
|
||||
" <div class = \"row text-center\">",
|
||||
" <div class = \"col-xs-12\">",
|
||||
" <button id = \"getMessage\" class = \"btn btn-primary\">",
|
||||
" Get Message",
|
||||
" </button>",
|
||||
" </div>",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad84fee1348bd9aecc48826",
|
||||
"title": "Read Data from an Element Using jQuery",
|
||||
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
|
||||
"description": [
|
||||
"Let's make everything roll with <code>rollOut</code>."
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" $(\"button\").on(\"click\", function() {",
|
||||
" $(\"#click-me\").addClass(\"animated shake\");",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class=\"row\">",
|
||||
" <div class=\"col-xs-2\">",
|
||||
" <input type=\"checkbox\" id=\"check-me\">",
|
||||
" </div>",
|
||||
" <div class=\"col-xs-10\">",
|
||||
" <p>#check-me</p>",
|
||||
" </div>",
|
||||
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
|
||||
" <span>Is the checkbox checked?</span>",
|
||||
" <span id=\"checked-state\"></span>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad84fee1348bd9aecc38826",
|
||||
"title": "Read Data from an Element Using jQuery",
|
||||
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
|
||||
"description": [
|
||||
"Let's make everything roll with <code>rollOut</code>."
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" $(\"button\").on(\"click\", function() {",
|
||||
" $(\"#click-me\").addClass(\"animated shake\");",
|
||||
" $(\"#checked-state\").text(\"happy text\");",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class=\"row\">",
|
||||
" <div class=\"col-xs-2\">",
|
||||
" <input type=\"checkbox\" id=\"check-me\">",
|
||||
" </div>",
|
||||
" <div class=\"col-xs-10\">",
|
||||
" <p>#check-me</p>",
|
||||
" </div>",
|
||||
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
|
||||
" <span>Is the checkbox checked?</span>",
|
||||
" <span id=\"checked-state\"></span>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad84fee1348bd9aecc28826",
|
||||
"title": "Read Data from an Element Using jQuery",
|
||||
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
|
||||
"description": [
|
||||
"Let's make everything roll with <code>rollOut</code>."
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" $(\"button\").on(\"click\", function() {",
|
||||
" $(\"#click-me\").addClass(\"animated shake\");",
|
||||
" $(\"#checked-state\").text($(\"#check-me\").prop(\"checked\"));",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class=\"row\">",
|
||||
" <div class=\"col-xs-2\">",
|
||||
" <input type=\"checkbox\" id=\"check-me\">",
|
||||
" </div>",
|
||||
" <div class=\"col-xs-10\">",
|
||||
" <p>#check-me</p>",
|
||||
" </div>",
|
||||
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
|
||||
" <span>Is the checkbox checked?</span>",
|
||||
" <span id=\"checked-state\"></span>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad84fee1348bd9aecc18826",
|
||||
"title": "Read Data from an Element Using jQuery",
|
||||
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
|
||||
"description": [
|
||||
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" $(document).ready(function() {",
|
||||
" $(\"button\").on(\"click\", function() {",
|
||||
" $(\"#click-me\").addClass(\"animated shake\");",
|
||||
" $(\"#checked-state\").text($(\"#check-me\").prop(\"checked\"));",
|
||||
" });",
|
||||
" });",
|
||||
"fcces",
|
||||
"",
|
||||
"<!-- You shouldn't need to modify code below this line -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <div class=\"row\">",
|
||||
" <div class=\"col-xs-2\">",
|
||||
" <input type=\"checkbox\" id=\"check-me\">",
|
||||
" </div>",
|
||||
" <div class=\"col-xs-10\">",
|
||||
" <p>#check-me</p>",
|
||||
" </div>",
|
||||
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
|
||||
" <span>Is the checkbox checked?</span>",
|
||||
" <span id=\"checked-state\"></span>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad87fee1348bd9aecc08826",
|
||||
"title": "Trigger onHover Events with jQuery",
|
||||
"dashedName": "waypoint-trigger-onhover-events-with-jquery",
|
||||
"description": [
|
||||
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad87fee1348bd9aebc08826",
|
||||
"title": "Get Data from an URL Using jQuery",
|
||||
"dashedName": "waypoint-get-data-from-a-url-using-jquery",
|
||||
"description": [
|
||||
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
"",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#cat-button\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json\", function( json ) {",
|
||||
"",
|
||||
" });",
|
||||
" });",
|
||||
"",
|
||||
" });",
|
||||
"fcces",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
|
||||
" <div class=\"jumbotron\" id=\"output\">",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad87fee1348bd9ae9c08826",
|
||||
"title": "Loop through JSON Data Using jQuery",
|
||||
"dashedName": "waypoint-loop-through-json-data-using-jquery",
|
||||
"description": [
|
||||
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
"",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#cat-button\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json\", function( json ) {",
|
||||
"",
|
||||
" });",
|
||||
" });",
|
||||
"",
|
||||
" });",
|
||||
"fcces",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
|
||||
" <div class=\"jumbotron\" id=\"output\">",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad88fee1348bd9ae8c08726",
|
||||
"title": "Wire AJAX Call into a jQuery Click Event",
|
||||
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
|
||||
"description": [
|
||||
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" var random = function() { return Math.floor(Math.random() * 3) }",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#cat-button\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json\", function( json ) {",
|
||||
"",
|
||||
" });",
|
||||
" });",
|
||||
"",
|
||||
" });",
|
||||
"fcces",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
|
||||
" <div class=\"jumbotron\" id=\"output\">",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad88fee1348bd9ae8c08626",
|
||||
"title": "Wire AJAX Call into a jQuery Click Event",
|
||||
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
|
||||
"description": [
|
||||
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" var random = function() { return Math.floor(Math.random() * 3) }",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#cat-button\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json\", function( json ) {",
|
||||
" var kitten = json[random()];",
|
||||
" });",
|
||||
" });",
|
||||
"",
|
||||
" });",
|
||||
"fcces",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
|
||||
" <div class=\"jumbotron\" id=\"output\">",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad88fee1348bd9ae8c08526",
|
||||
"title": "Wire AJAX Call into a jQuery Click Event",
|
||||
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
|
||||
"description": [
|
||||
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" var random = function() { return Math.floor(Math.random() * 3) }",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#cat-button\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json\", function( json ) {",
|
||||
" var kitten = json[random()];",
|
||||
" $(\"<img src=\"\" + kitten.imageLink + \"\">\").appendTo(\"#output\");",
|
||||
" });",
|
||||
" });",
|
||||
"",
|
||||
" });",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
|
||||
" <div class=\"jumbotron\" id=\"output\">",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
},
|
||||
|
||||
{
|
||||
"id": "bad88fee1348bd9ae8c08426",
|
||||
"title": "Wire AJAX Call into a jQuery Click Event",
|
||||
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
|
||||
"description": [
|
||||
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
|
||||
],
|
||||
"tests": [
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
"fccss",
|
||||
" var random = function() { return Math.floor(Math.random() * 3) }",
|
||||
" $(document).ready(function() {",
|
||||
"",
|
||||
" $(\"#cat-button\").on(\"click\", function() {",
|
||||
" $.getJSON(\"/json/cats.json\", function( json ) {",
|
||||
" var kitten = json[random()];",
|
||||
" $(\"<img src=\"\" + kitten.imageLink + \"\">\").appendTo(\"#output\");",
|
||||
" $(\"<h3>Code name: \" + kitten.codeNames[random()] + \"</h3>\").appendTo(\"#output\");",
|
||||
" });",
|
||||
" });",
|
||||
"",
|
||||
" });",
|
||||
"fcces",
|
||||
"<div class=\"container-fluid\">",
|
||||
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
|
||||
" <div class=\"jumbotron\" id=\"output\">",
|
||||
" </div>",
|
||||
"</div>"
|
||||
],
|
||||
"challengeType": 0,
|
||||
"type": "waypoint"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
Everything to due with the server
|
||||
Everything to do with the server.
|
||||
|
||||
One file that is not tracked here is `rev-manifest.json`.
|
||||
It is generated at runtime and its contents changes as the contents
|
||||
|
@ -72,9 +72,9 @@ module.exports = function(app) {
|
||||
'Feel free to email us at this address if you have ',
|
||||
'any questions about Free Code Camp.\n',
|
||||
'And if you have a moment, check out our blog: ',
|
||||
'blog.freecodecamp.com.\n\n',
|
||||
'medium.freecodecamp.com.\n\n',
|
||||
'Good luck with the challenges!\n\n',
|
||||
'- the Free Code Camp Volunteer Team'
|
||||
'- the Free Code Camp Team'
|
||||
].join('')
|
||||
};
|
||||
|
||||
|
@ -64,23 +64,6 @@ module.exports = function(app) {
|
||||
return res.redirect('../nonprofit/' + dashedNameFull);
|
||||
}
|
||||
|
||||
// We need to create logic that verifies completion.
|
||||
// Defaulting to false for now.
|
||||
// var buttonActive = false;
|
||||
// if (
|
||||
// req.user &&
|
||||
// req.user.completedCoursewares.length > 63
|
||||
// ) {
|
||||
// var hasShownInterest =
|
||||
// nonprofit.interestedCampers.filter(function(user) {
|
||||
// return user.username === req.user.username;
|
||||
// });
|
||||
//
|
||||
// if (hasShownInterest.length === 0) {
|
||||
// buttonActive = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
res.render('nonprofits/show', {
|
||||
dashedName: dashedNameFull,
|
||||
title: nonprofit.name,
|
||||
|
@ -12,6 +12,10 @@ module.exports = function(app) {
|
||||
res.redirect(301, '/pmi-acp-agile-project-managers');
|
||||
});
|
||||
|
||||
router.get('/wiki', function(req, res) {
|
||||
res.redirect(301, '//github.com/freecodecamp/freecodecamp/wiki');
|
||||
});
|
||||
|
||||
router.get('/privacy', function(req, res) {
|
||||
res.redirect(
|
||||
301, "//github.com/FreeCodeCamp/freecodecamp/wiki/Free-Code-Camp's-Privacy-Policy"
|
||||
|
@ -12,13 +12,18 @@ var Rx = require('rx'),
|
||||
validator = require('validator'),
|
||||
secrets = require('../../config/secrets');
|
||||
|
||||
var foundationDate = 1413298800000;
|
||||
var time48Hours = 172800000;
|
||||
import {
|
||||
ifNoUser401,
|
||||
ifNoUserRedirectTo
|
||||
} from '../utils/middleware';
|
||||
|
||||
var unDasherize = utils.unDasherize;
|
||||
var dasherize = utils.dasherize;
|
||||
var getURLTitle = utils.getURLTitle;
|
||||
var ifNoUser401 = require('../utils/middleware').ifNoUser401;
|
||||
const foundationDate = 1413298800000;
|
||||
const time48Hours = 172800000;
|
||||
|
||||
const unDasherize = utils.unDasherize;
|
||||
const dasherize = utils.dasherize;
|
||||
const getURLTitle = utils.getURLTitle;
|
||||
const sendNonUserToNews = ifNoUserRedirectTo('/news');
|
||||
|
||||
function hotRank(timeValue, rank) {
|
||||
/*
|
||||
@ -62,8 +67,16 @@ module.exports = function(app) {
|
||||
|
||||
router.get('/news/hot', hotJSON);
|
||||
router.get('/stories/hotStories', hotJSON);
|
||||
router.get('/stories/submit', submitNew);
|
||||
router.get('/stories/submit/new-story', preSubmit);
|
||||
router.get(
|
||||
'/stories/submit',
|
||||
sendNonUserToNews,
|
||||
submitNew
|
||||
);
|
||||
router.get(
|
||||
'/stories/submit/new-story',
|
||||
sendNonUserToNews,
|
||||
preSubmit
|
||||
);
|
||||
router.post('/stories/preliminary', ifNoUser401, newStory);
|
||||
router.post('/stories/', ifNoUser401, storySubmission);
|
||||
router.get('/news/', hot);
|
||||
@ -102,17 +115,25 @@ module.exports = function(app) {
|
||||
}
|
||||
|
||||
function submitNew(req, res) {
|
||||
if (!req.user.isGithubCool) {
|
||||
req.flash('errors', {
|
||||
msg: 'You must link GitHub with your account before you can post' +
|
||||
' on Camper News.'
|
||||
});
|
||||
return res.redirect('/news');
|
||||
}
|
||||
|
||||
return res.render('stories/index', {
|
||||
title: 'Submit a new story to Camper News',
|
||||
page: 'submit'
|
||||
});
|
||||
}
|
||||
|
||||
function preSubmit(req, res, next) {
|
||||
function preSubmit(req, res) {
|
||||
var data = req.query;
|
||||
if (typeof data.url !== 'string') {
|
||||
req.flash('errors', { msg: 'No URL supplied with story' });
|
||||
return next(new TypeError('No URL supplied with story'));
|
||||
return res.redirect('/news');
|
||||
}
|
||||
var cleanedData = cleanData(data.url);
|
||||
|
||||
@ -264,8 +285,11 @@ module.exports = function(app) {
|
||||
}
|
||||
|
||||
function newStory(req, res, next) {
|
||||
if (!req.user) {
|
||||
return next(new Error('Must be logged in'));
|
||||
if (!req.user.isGithubCool) {
|
||||
req.flash('errors', {
|
||||
msg: 'You must authenticate with Github to post to Camper News'
|
||||
});
|
||||
return res.redirect('/news');
|
||||
}
|
||||
var url = req.body.data.url;
|
||||
|
||||
|
@ -55,6 +55,7 @@ export default function csp() {
|
||||
return helmet.csp({
|
||||
defaultSrc: trusted,
|
||||
scriptSrc: [
|
||||
'https://*.gitter.im',
|
||||
'*.optimizely.com',
|
||||
'*.aspnetcdn.com',
|
||||
'*.d3js.org',
|
||||
@ -72,7 +73,8 @@ export default function csp() {
|
||||
imgSrc: [
|
||||
// allow all input since we have user submitted images for
|
||||
// public profile
|
||||
'*'
|
||||
'*',
|
||||
'data:'
|
||||
].concat(trusted),
|
||||
fontSrc: [
|
||||
'*.googleapis.com',
|
||||
|
@ -6,13 +6,6 @@
|
||||
"description": "The elegant and lightweight boilerplate for full stack JavaScript.",
|
||||
"image": "http://i.imgur.com/ib1wOho.png"
|
||||
},
|
||||
{
|
||||
"camper": "akiralaine",
|
||||
"name": "Camper News Bot",
|
||||
"url": "https://twitter.com/campernewsbot",
|
||||
"description": "This twitter bot tweets out Camper News stories once they hit 5 upvotes.",
|
||||
"image": "https://pbs.twimg.com/media/CLXOFLPWIAEHYPJ.png"
|
||||
},
|
||||
{
|
||||
"camper": "adventurebear",
|
||||
"name": "Coding Bootcamp Cost Calculator",
|
||||
@ -26,5 +19,19 @@
|
||||
"url": "https://github.com/open-source-society/computer-science",
|
||||
"description": "A path to a free education in Computer Science.",
|
||||
"image": "https://camo.githubusercontent.com/c42438055d3fee26b29e6d046fd8d06ebff3db20/687474703a2f2f692e696d6775722e636f6d2f6838786a72726a2e706e67"
|
||||
},
|
||||
{
|
||||
"camper": "akiralaine",
|
||||
"name": "Camper News Bot",
|
||||
"url": "https://twitter.com/campernewsbot",
|
||||
"description": "This twitter bot tweets out Camper News stories once they hit 5 upvotes.",
|
||||
"image": "https://pbs.twimg.com/media/CLXOFLPWIAEHYPJ.png"
|
||||
},
|
||||
{
|
||||
"camper": "roelver",
|
||||
"name": "Free Code Camp Top 100 Campers",
|
||||
"url": "http://fcctop100.herokuapp.com/",
|
||||
"description": "This leaderboard tracks the campers who have been most active (completing challenges, helping other campers) in the past 30 days.",
|
||||
"image": "http://i.imgur.com/4CrQfFi.png"
|
||||
}
|
||||
]
|
||||
|
@ -70,7 +70,7 @@
|
||||
"Ride like the wind!",
|
||||
"Legen - wait for it - dary!",
|
||||
"Ludicrous Speed! Go!",
|
||||
"Yes you can!",
|
||||
"Yes we can!",
|
||||
"Most triumphant!",
|
||||
"One loop to rule them all!",
|
||||
"By the power of Grayskull!",
|
||||
|
@ -20,14 +20,17 @@ block content
|
||||
.spacer
|
||||
if (user && user.progressTimestamps.length > 5)
|
||||
#tshirt-notice.col-xs-12.col-md-8.col-md-offset-2.hidden
|
||||
h2.text-center Get our first-edition t-shirt
|
||||
h2.text-center Get our first-edition t-shirt.
|
||||
br
|
||||
span.text-success Only available until Oct 29!
|
||||
img.thumbnail.img-center.img-responsive(src="http://i.imgur.com/o07uuOL.png")
|
||||
p.text-justify Our community has voted. Get our winning design emblazoned on a durable, American-made American Apparel shirt (available in women's and men's sizes). 
|
||||
a(href="https://teespring.com/free-code-camp-shirt-eu" target="_blank") Also ships from Europe
|
||||
| .
|
||||
a.button.btn.btn-block.signup-btn(href="https://teespring.com/get-free-code-camp-t-shirt" target="_blank") Get yours
|
||||
.button-spacer
|
||||
#hideTshirtNoticeButton.button.btn.btn-block.btn-info Hide this forever
|
||||
.text-center
|
||||
a#hideTshirtNoticeButton(href='#') Hide this forever
|
||||
.spacer
|
||||
.row
|
||||
.col-xs-12.col-sm-8.col-sm-offset-2
|
||||
@ -87,7 +90,8 @@ block content
|
||||
.row
|
||||
.hidden-xs.col-sm-3.col-md-2
|
||||
h3.text-primary.text-right.nowrap
|
||||
i.fa.fa-clock-o  #{challengeBlock.time}
|
||||
i.fa.fa-clock-o
|
||||
= challengeBlock.time
|
||||
.col-xs-12.col-sm-9.col-md-10
|
||||
h3 #{challengeBlock.name}  
|
||||
|
||||
@ -121,7 +125,7 @@ block content
|
||||
.button-spacer
|
||||
.row
|
||||
.col-xs-12.col-sm-8.col-md-6.col-sm-offset-3.col-md-offset-2.hidden
|
||||
a.btn.btn-lg.btn-block.signup-btn.map-challenge-block-share Section complete. Share your Portfolio with your friends.
|
||||
a.btn.btn-lg.btn-block.signup-btn.map-challenge-block-share Section complete. Share your code portfolio with your friends.
|
||||
.hidden(id="#{challengeBlock.name}")
|
||||
script.
|
||||
var username = !{JSON.stringify(user && user.username || '')};
|
||||
|
@ -1,12 +1,12 @@
|
||||
extends ../layout-wide
|
||||
block content
|
||||
|
||||
script(type='text/javascript', src='/bower_components/jshint/dist/jshint.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/lib/codemirror.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/edit/closebrackets.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/edit/matchbrackets.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/lint/lint.js')
|
||||
script(type='text/javascript', src='/js/lib/codemirror/addon/lint/javascript-lint.js')
|
||||
script(type='text/javascript', src='/bower_components/jshint/dist/jshint.js')
|
||||
script(type='text/javascript', src='/js/lib/chai/chai.js')
|
||||
link(rel='stylesheet', href='/js/lib/codemirror/lib/codemirror.css')
|
||||
link(rel='stylesheet', href='/js/lib/codemirror/addon/lint/lint.css')
|
||||
@ -52,7 +52,7 @@ block content
|
||||
label.btn.btn-success#trigger-reset-modal
|
||||
i.fa.fa-refresh
|
||||
| Reset
|
||||
label.btn.btn-success#trigger-help-modal
|
||||
label.btn.btn-success#challenge-help-btn
|
||||
i.fa.fa-medkit
|
||||
| Help
|
||||
label.btn.btn-success#trigger-issue-modal
|
||||
@ -88,8 +88,6 @@ block content
|
||||
.form-group.codeMirrorView
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
script.
|
||||
editor.setOption("mode", "javascript");
|
||||
|
||||
#complete-courseware-dialog.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeIn.fast-animation
|
||||
@ -122,7 +120,14 @@ block content
|
||||
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
if (!MDNlinks.length) {
|
||||
$('#MDN-links').addClass('collapse');
|
||||
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat('freecodecamp/helpbonfires', '#challenge-help-btn', 'Bonfires Help');
|
||||
}
|
||||
});
|
||||
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
if (!MDNlinks.length) {
|
||||
$('#MDN-links').addClass('collapse');
|
||||
}
|
||||
|
@ -38,7 +38,11 @@ block content
|
||||
label.btn.btn-success#trigger-reset-modal
|
||||
i.fa.fa-refresh
|
||||
| Reset
|
||||
label.btn.btn-success#trigger-help-modal
|
||||
label.btn.btn-success.hidden-sm.hidden-md.hidden-lg
|
||||
a(href='//gitter.im/freecodecamp/help')
|
||||
i.fa.fa-medkit
|
||||
| Help
|
||||
label.btn.btn-success.hidden-xs#challenge-help-btn
|
||||
i.fa.fa-medkit
|
||||
| Help
|
||||
label.btn.btn-success#trigger-issue-modal
|
||||
@ -72,6 +76,7 @@ block content
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
script.
|
||||
editor.setOption('lint', false);
|
||||
editor.setOption("mode", "text/html");
|
||||
.col-md-4.col-lg-3
|
||||
.hidden-xs.hidden-sm
|
||||
@ -95,3 +100,9 @@ block content
|
||||
else
|
||||
a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
|
||||
}
|
||||
});
|
||||
|
@ -43,7 +43,7 @@ block content
|
||||
label.btn.btn-success#trigger-reset-modal
|
||||
i.fa.fa-refresh
|
||||
| Reset
|
||||
label.btn.btn-success#trigger-help-modal
|
||||
label.btn.btn-success#challenge-help-btn
|
||||
i.fa.fa-medkit
|
||||
| Help
|
||||
label.btn.btn-success#trigger-issue-modal
|
||||
@ -98,7 +98,12 @@ block content
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
if (!MDNlinks.length) {
|
||||
$('#MDN-links').addClass('collapse');
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
if (!MDNlinks.length) {
|
||||
$('#MDN-links').addClass('collapse');
|
||||
}
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,8 @@ block content
|
||||
.col-md-8.col-md-offset-2
|
||||
for step, index in description
|
||||
.thumbnail.challenge-step(class=index !== 0 ? 'hidden': '')
|
||||
img.gif-block.img-center.img-responsive.thumbnail(src='#{step[0]}' alt='#{step[1]}')
|
||||
a(href=step[0] data-lightbox='img-enlarge')
|
||||
img.gif-block.img-center.img-responsive.thumbnail(src='#{step[0]}' alt='#{step[1]}')
|
||||
.caption
|
||||
p.large-p!= step[2]
|
||||
if step[3]
|
||||
|
@ -24,7 +24,7 @@ block content
|
||||
var userLoggedIn = true;
|
||||
.button-spacer
|
||||
.btn-group.input-group.btn-group-justified
|
||||
.btn.btn-success.btn-big#trigger-help-modal
|
||||
.btn.btn-success.btn-big#challenge-help-btn
|
||||
i.fa.fa-medkit
|
||||
| Get help
|
||||
.btn.btn-success.btn-big#trigger-issue-modal
|
||||
@ -74,8 +74,14 @@ block content
|
||||
script.
|
||||
$('body').bind('keypress', controlEnterHandler);
|
||||
script.
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
|
||||
}
|
||||
});
|
||||
include ../partials/challenge-modals
|
||||
|
||||
|
@ -24,7 +24,7 @@ block content
|
||||
a.btn.btn-big.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge (ctrl + enter)
|
||||
.button-spacer
|
||||
.btn-group.input-group.btn-group-justified
|
||||
.btn.btn-success.btn-big#trigger-help-modal
|
||||
.btn.btn-success.btn-big#challenge-help-btn
|
||||
i.fa.fa-medkit
|
||||
| Help
|
||||
.btn.btn-success.btn-big#trigger-issue-modal
|
||||
@ -96,3 +96,23 @@ block content
|
||||
script.
|
||||
$('body').on('keypress', controlEnterHandler);
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var room = 'freecodecamp/help';
|
||||
var title;
|
||||
|
||||
if (challengeType === '4') {
|
||||
room = 'freecodecamp/helpBasejumps';
|
||||
title = 'Basejump Help';
|
||||
}
|
||||
|
||||
if (challengeType === '3') {
|
||||
room = 'freecodecamp/helpZiplines';
|
||||
title = 'Zipline Help';
|
||||
}
|
||||
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat(room, '#challenge-help-btn', title);
|
||||
}
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ block content
|
||||
.big-break
|
||||
.row
|
||||
.col-xs-12.col-sm-8.col-sm-offset-2
|
||||
a.btn.btn-cta.signup-btn.btn-block(href="/login") Start learning to code (it's free)
|
||||
a.btn.btn-cta.signup-btn.btn-block(href="/signin") Start learning to code (it's free)
|
||||
.button-spacer
|
||||
a.btn.btn-cta.btn-success.btn-block(href="/nonprofits") My nonprofit needs coding help
|
||||
h2 As featured in:
|
||||
@ -91,6 +91,6 @@ block content
|
||||
.big-break
|
||||
.row
|
||||
.col-xs-12.col-sm-8.col-sm-offset-2
|
||||
a.btn.btn-cta.signup-btn.btn-block(href="/login") Learn to code today (it's free)
|
||||
a.btn.btn-cta.signup-btn.btn-block(href="/signin") Learn to code today (it's free)
|
||||
script.
|
||||
challengeName = 'Home'
|
||||
|
@ -10,20 +10,6 @@
|
||||
a.btn.btn-lg.btn-primary.btn-block#report-issue(name='_csrf', value=_csrf) Create my GitHub issue
|
||||
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||
|
||||
#help-modal.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeIn.fast-animation
|
||||
.modal-content
|
||||
.modal-header.challenge-list-header Need some help?
|
||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||
.modal-body.text-center
|
||||
h3 Remember to use  
|
||||
a(href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck', target='_blank') Read-Search-Ask
|
||||
| .
|
||||
h3 If you've already read the errors and searched Google, you should ask for help.
|
||||
h3 This will take you to our help room.
|
||||
a.btn.btn-lg.btn-primary.btn-block.close-modal(href='https://gitter.im/FreeCodeCamp/help', target='_blank') Take me to the help room
|
||||
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||
|
||||
#reset-modal.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeInUp.fast-animation
|
||||
.modal-content
|
||||
|
@ -1,24 +1,27 @@
|
||||
.fcc-footer
|
||||
.col-xs-12.hidden-xs.hidden-sm
|
||||
a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank') Blog
|
||||
a.ion-social-github(href="http://github.com/freecodecamp", target='_blank') GitHub
|
||||
a.ion-social-twitch-outline(href="/twitch")  Twitch
|
||||
a.ion-social-linkedin(href="https://www.linkedin.com/edu/school?id=166029", target='_blank')  LinkedIn
|
||||
a.ion-speakerphone(href='//medium.freecodecamp.com', target='_blank') Blog
|
||||
a.ion-social-github(href="//github.com/freecodecamp", target='_blank') GitHub
|
||||
a.ion-social-linkedin(href="//www.linkedin.com/edu/school?id=166029", target='_blank')  LinkedIn
|
||||
a.ion-social-twitter(href="//twitter.com/freecodecamp", target='_blank') Twitter
|
||||
a.ion-social-facebook(href="//facebook.com/freecodecamp") Facebook
|
||||
a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank') Twitter
|
||||
a.ion-social-twitch-outline(href="//twitch.tv/freecodecamp", target='_blank')  Twitch
|
||||
a.ion-locked(href="//github.com/FreeCodeCamp/freecodecamp/wiki/Free-Code-Camp's-Privacy-Policy") Privacy
|
||||
.col-xs-12.visible-xs.visible-sm
|
||||
a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank')
|
||||
a.ion-speakerphone(href='//medium.freecodecamp.com', target='_blank')
|
||||
span.sr-only Free Code Camp's Blog
|
||||
a.ion-social-github(href="http://github.com/freecodecamp", target='_blank')
|
||||
a.ion-social-github(href="//github.com/freecodecamp", target='_blank')
|
||||
span.sr-only Free Code Camp on GitHub
|
||||
a.ion-social-twitch-outline(href="/twitch")
|
||||
span.sr-only Free Code Camp Live Pair Programming on Twitch.tv
|
||||
a.ion-social-linkedin(href="https://www.linkedin.com/edu/school?id=166029", target='_blank')
|
||||
a.ion-social-linkedin(href="//www.linkedin.com/edu/school?id=166029", target='_blank')
|
||||
span.sr-only Free Code Camp LinkedIn Alumni Network
|
||||
a.ion-social-facebook(href="//facebook.com/freecodecamp")
|
||||
span.sr-only Free Code Camp local groups on Facebook
|
||||
a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank')
|
||||
a.ion-social-twitter(href="//twitter.com/freecodecamp", target='_blank')
|
||||
span.sr-only Free Code Camp on Twitter
|
||||
a.ion-social-facebook(href="//facebook.com/freecodecamp", target='_blank')
|
||||
span.sr-only Free Code Camp local groups on Facebook
|
||||
a.ion-social-twitch-outline(href="/twitch", target='_blank')
|
||||
span.sr-only Free Code Camp Live Pair Programming on Twitch.tv
|
||||
a.ion-locked(href="//github.com/FreeCodeCamp/freecodecamp/wiki/Free-Code-Camp's-Privacy-Policy")
|
||||
span.sr-only Free Code Camp's Privacy Policy
|
||||
|
||||
// scripts should be moved here
|
||||
script(src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer)
|
||||
|
@ -9,7 +9,7 @@ meta(http-equiv='X-UA-Compatible', content='IE=edge')
|
||||
meta(name='viewport', content='width=device-width, initial-scale=1.0')
|
||||
meta(name='csrf-token', content=_csrf)
|
||||
meta(name='keywords', content='learn to code, learn to program, learn programming, learn javascript, learn coding, code, coding, programming, software engineer, software developer, mean stack, web development, development, engineering, learn node.js, learn angular.js, learn express.js, learn mongoDB, coding bootcamp, javascript, open source')
|
||||
meta(property="og:title", content="Learn to code and build projects for nonprofits")
|
||||
meta(property="og:title", content="Learn to code and help nonprofits")
|
||||
meta(property="og:site_name", content="Free Code Camp")
|
||||
meta(name='twitter:widgets:csp', content='on')
|
||||
meta(name='p:domain_verify', content='d0bc047a482c03c24f1168004c2a216a')
|
||||
@ -27,7 +27,7 @@ meta(name="twitter:url", content="http://www.freecodecamp.com")
|
||||
meta(name="twitter:site", content="@freecodecamp")
|
||||
meta(name="twitter:card", content="summary_large_image")
|
||||
meta(name="twitter:image:src", content="https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg")
|
||||
meta(name="twitter:title", content="Learn to code and build projects for nonprofits")
|
||||
meta(name="twitter:title", content="Learn to code and help nonprofits")
|
||||
meta(name="twitter:description", content="We're an open source community of busy people who learn to code and build projects for nonprofits. Build your full stack web development portfolio today.")
|
||||
meta(content="a40ee5d5dba3bb091ad783ebd2b1383f", name="p:domain_verify")
|
||||
meta(name="msapplication-TileColor", content="#FFFFFF")
|
||||
|
@ -11,8 +11,10 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
||||
a.learn-btn(href='#') Learn
|
||||
li
|
||||
a(href='/map') Map
|
||||
li
|
||||
a(href='//gitter.im/FreeCodeCamp/FreeCodeCamp', target='_blank') Chat
|
||||
li.hidden-xs
|
||||
a#nav-chat-btn(href='#' onclick="return false") Chat
|
||||
li.visible-xs
|
||||
a(href="//gitter.im/freecodecamp/freecodecamp" target="_blank") Chat
|
||||
li
|
||||
a(href='/news', target='_blank') News
|
||||
li
|
||||
|
@ -69,7 +69,7 @@
|
||||
(typeof username !== 'undefined' ?
|
||||
"<button id='" + data[i].id + "' class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost btn-upvote'>upvote</button>" :
|
||||
"<a href='/signin' class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost'>upvote</a>") +
|
||||
"<a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost hidden' href='/news/" + linkedName + "'>more info</a> · " +
|
||||
"<a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost hidden' href='/news/" + linkedName + "'>more info</a> " +
|
||||
rank + (rank > 1 ? " points" : " point") + " · posted " +
|
||||
moment(data[i].timePosted).fromNow() +
|
||||
" by <a href='/" + data[i].author.username + "'>@" + data[i].author.username + "</a> " +
|
||||
|
Reference in New Issue
Block a user