diff --git a/config/bootstrap.js b/config/bootstrap.js
deleted file mode 100644
index c38ffac08e..0000000000
--- a/config/bootstrap.js
+++ /dev/null
@@ -1,29 +0,0 @@
-var mongoose = require('mongoose'),
- debug = require('debug')('freecc:config:boot'),
- secrets = require('./secrets'),
- courses = require('../seed_data/courses.json'),
- Course = require('./../models/Course'),
- challenges = require('../seed_data/challenges.json'),
- Challenge = require('./../models/Challenge');
-
-mongoose.connect(secrets.db);
-mongoose.connection.on('error', function() {
- console.error('MongoDB Connection Error. Make sure MongoDB is running.');
-});
-
-
-Course.create(courses, function(err, data) {
- if (err) {
- debug(err);
- } else {
- debug('Saved ', data);
- }
-});
-
-Challenge.create(challenges, function(err, data) {
- if (err) {
- console.log(err);
- } else {
- console.log('Saved ', data);
- }
-});
diff --git a/controllers/resources.js b/controllers/resources.js
index ac7f838695..aa87e04d49 100644
--- a/controllers/resources.js
+++ b/controllers/resources.js
@@ -20,7 +20,8 @@ var async = require('async'),
cheerio = require('cheerio'),
request = require('request'),
R = require('ramda'),
- _ = require('lodash');
+ _ = require('lodash'),
+ fs = require('fs');
/**
* Cached values
@@ -46,7 +47,20 @@ Array.zip = function(left, right, combinerFunction) {
};
buildChallengeMap = function() {
-
+ challengeMap = {};
+ fs.readdir(__dirname + '../seed_data/challenges', function(err, files) {
+ if (err) {
+ debug(err);
+ } else {
+ var keyCounter = 0;
+ files = files.sort(function(a, b) {
+ return a.order < b.order ? a : b;
+ });
+ files.forEach(function(file) {
+ challengeMap[keyCounter++] = file;
+ });
+ }
+ });
};
module.exports = {
diff --git a/seed_data/challenges.json b/seed_data/challenges.json
new file mode 100644
index 0000000000..c1212e28a1
--- /dev/null
+++ b/seed_data/challenges.json
@@ -0,0 +1 @@
+["./challenges/prepwork.json", "./challenges/basics.json"]
\ No newline at end of file
diff --git a/seed_data/challenges/basic_css.json b/seed_data/challenges/basic_css.json
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/seed_data/challenges/basic_html.json b/seed_data/challenges/basic_html.json
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/seed_data/challenges/basic_javascript.json b/seed_data/challenges/basic_javascript.json
deleted file mode 100644
index 578dd17771..0000000000
--- a/seed_data/challenges/basic_javascript.json
+++ /dev/null
@@ -1,1488 +0,0 @@
-[
- {
- "_id" : "bd7123d8c441eddfaeb5bdef",
- "name": "Learn how Free Code Camp Works",
- "difficulty": 0.00,
- "description": [
- "Watch this 90 second video, or simply read this summary:",
- "Welcome to Free Code Camp. We're a community of busy people learning to code.",
- "We built this community because learning to code is hard. But anyone who can stay motivated can learn to code. And the best way to stay motivated is to code with friends.",
- "To maximize accessibility, all our challenges are self-paced, browser-based, and free.",
- "All of us start with the same 100 hours of interactive coding challenges. These cover Computer Science and databases. They also cover in-demand JavaScript tools like jQuery, Node.js and MongoDB.",
- "Once we have a basic understanding of web development, we'll spend another 900 hours putting that theory into practice. We'll build full stack solutions for nonprofits.",
- "By the end of this process, we'll be good at coding. We'll have a portfolio of apps with happy users to prove it. We'll also have an alumni network of fellow coders and nonprofits ready to serve as references.",
- "If you make it through Free Code Camp, you will be able to get a coding job. There are far more job openings out there than there are qualified coders to fill them.",
- "Also, for every pure coding job, there are at least 5 additional jobs that require some coding skills. So even if you decide not to pursue coding as a career, you'll still walk away with a valuable job skill.",
- "There are 3 keys to succeeding in our community: do the challenges, make friends, and find a routine.",
- "Now it's time to join our chatroom. Click the \"Go to my next challenge\" button to move on to your next challenge."
- ],
- "tests": [
- ""
- ],
- "challengeSeed": [
- "114486344"
- ],
- "challengeType" : 2
- },
- {
- "_id": "bd7123c8c441eddfaeb5bdef",
- "name": "Meet Booleans",
- "difficulty": "0.001",
- "description": [
- "Return true"
- ],
- "tests": [
- "expect(welcomeToBooleans()).to.be.a(\"boolean\");",
- "expect(welcomeToBooleans()).to.be.true;"
- ],
- "challengeSeed": [
- "function welcomeToBooleans() {\n // Good luck!\n return false;\n}\n\nwelcomeToBooleans();"
- ],
- "challengeType": 1
- },
- {
- "_id" : "bd7123c8c441eddfaeb5bdef",
- "name": "Start our Challenges",
- "difficulty": "0.002",
- "description": [
- "Welcome to Free Code Camp's first challenge! Click on the button below for further instructions.",
- "Awesome. Now you can read the rest of this challenge's instructions.",
- "You can edit code
in the text editor
we've embedded into this web page.",
- "Do you see the code in the text editor that says <h1>hello</h1>
? That's an HTML element
.",
- "Most HTML elements have an opening tag
and a closing tag
. Opening tags look like this: <h1>
. Closing tags look like this: </h1>
. Note that the only difference between opening and closing tags is that closing tags have a slash after their opening angle bracket.",
- "Once you've completed the challenge, the \"Go to my next challenge\" button will become enabled. Click it - or press control and enter at the same time - to advance to the next challenge.",
- "To enable the \"Go to my next challenge\" button on this exercise, change the h1
tag's text to say \"Hello World\" instead of \"Hello\"."
- ],
- "tests": [
- "expect((/hello(\\s)+world/gi).test($('h1').text())).to.be.true;"
- ],
- "challengeSeed": [
- "
h2
tag that says \"cat photo app\" to make a second HTML element
below the \"hello world\" h1
element.",
- "The h2 element you enter will create an h2 element on the website.",
- "This element tells the browser how to render the text that it contains.",
- "h2
elements are slightly smaller than h1
elements. There are also h3
, h4
, h5
and h6
elements."
- ],
- "tests": [
- "expect((/hello(\\s)+world/gi).test($('h1').text())).to.be.true;",
- "expect((/cat(\\s)+photo(\\s)+app/gi).test($('h2').text())).to.be.true;"
- ],
- "challengeSeed": [
- "p
element below the h2 element, and give it the text \"hello paragraph\".",
- "p
elements are the preferred element for normal-sized paragraph text on websites.",
- "You can create a p element like so: <p>I'm a p tag!</p>
"
- ],
- "tests": [
- "expect((/hello(\\s)+paragraph/gi).test($('p').text())).to.be.true;"
- ],
- "challengeSeed": [
- "line break
between the <h2>
and <p>
elements.",
- "You can create an line break element with <br/>
.",
- "Note that <br/>
has no closing tag. It is a self-closing
element. See how a forward-slash precedes the closing bracket?"
- ],
- "tests": [
- "expect($('br')).to.exist;"
- ],
- "challengeSeed": [
- "hello paragraph
" - ], - "challengeType": 0 - }, - - { - "_id" : "bad87fee1348bd9aedf08802", - "name": "Uncomment HTML", - "difficulty" : "0.04", - "description": [ - "Uncomment theh1
, h2
and p
elements.",
- "Commenting is a way that you can leave comments within your code without affecting the code itself.",
- "Commenting is also a convenient way to make code inactive without having to delete it entirely.",
- "You can start a comment with <!--
and end a comment with -->
."
- ],
- "tests": [
- "expect((/hello(\\s)+world/gi).test($('h1').text())).to.be.true;"
- ],
- "challengeSeed": [
- "",
- "",
- "",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
" - ], - "challengeType": 0 - }, - - { - "_id" : "bad87fee1348bd9aedf08809", - "name": "Using Important to Override Styles", - "difficulty" : "0.14", - "description": [ - "Apply both the \"blue-text\" and \"urgently-red\" classes to all h2 elements, but use!important
to ensure the element is rendered as being red.",
- "Sometimes HTML elements will receive conflicting information from CSS classes as to how they should be styled.",
- "If there's a conflict in the CSS, the browser will use whichever style declaration is closest to the bottom of the CSS document (whichever declaration comes last). Note that in-line style declarations are the final authority in how an HTML element will be rendered.",
- "There's one way to ensure that an element is rendered with a certain style, regardless of where that declaration is located. That one way is to use !important
.",
- "Look at the example in the editor's style tag to see how you can use !important.",
- "Now see if you can make sure the h2 element is rendered in the color red without removing the \"blue-text\" class, doing an in-line styling, or changing the sequence of CSS class declarations."
- ],
- "tests": [
- "expect($('h2')).to.have.class('urgently-red');",
- "expect($('h2')).to.have.class('blue-text');",
- "expect($('h2')).to.have.css('color', 'rgb(255, 0, 0)');"
- ],
- "challengeSeed": [
- "",
- "",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
" - ], - "challengeType": 0 - }, - - { - "_id" : "bad87fee1348bd9aedf08810", - "name": "Use Hex Codes for Precise Colors", - "difficulty" : "0.15", - "description": [ - "Change the hex code in the \"red-text\" class to hex code for the color red.", - "Hexadecimal (hex) code
is a popular way of specifying color in CSS.",
- "Hex code is called \"hex\" because each digit has 16 possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f",
- "The six hex code correspond to red-red-green-green-blue-blue.",
- "You can change these six values to make more than 16 million colors!",
- "The higher the value in a field, the more intense its color. For example, #000000 is black, #ffffff is white, and #00ff00 is bright green. You can also get less intense colors by using values lower than f. For example, #00f000 with the second green digit set to 0 is a light green, and #00f900 is a slightly brighter green",
- "Now figure out how to make the bright green in the \"red-text\" class into a bright red."
- ],
- "tests": [
- "expect($('h2')).to.have.css('color', 'rgb(255, 0, 0)');",
- "expect($('h2')).to.have.class('red-text');"
- ],
- "challengeSeed": [
- "",
- "",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
" - ], - "challengeType": 0 - }, - - { - "_id" : "bad87fee1348bd9bedf08810", - "name": "Use Shortened 3 Digit Hex Codes", - "difficulty" : "0.16", - "description": [ - "Change the hex code in the \"red-text\" class to the shortened 3-digit hex code for the color red.", - "You can also shorten the 6-digit color hex code to a 3-digit code. For example,#00ff00
becomes #0f0
. This is less precise, but equally effective."
- ],
- "tests": [
- "expect($('h2')).to.have.css('color', 'rgb(255, 0, 0)');",
- "expect($('h2')).to.have.class('red-text');"
- ],
- "challengeSeed": [
- "",
- "",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
" - ], - "challengeType": 0 - }, - - { - "_id" : "bad87fee1348bd9aedf08811", - "name": "Use RGB Codes for Precise Colors", - "difficulty" : "0.17", - "description": [ - "Change the RGB code to be red.", - "Another way to represent color in CSS is with RGB, or red-green-blue notation.", - "For each of the three colors, you specify a value between 0 and 256.", - "For example, black isrgb(0, 0, 0)
, white is rgb(255, 255, 255)
, bright green is rgb(0, 255, 0)
. You can also get less intense colors by using values lower than 255. For example, light green is rgb(0, 123, 0).",
- "If you think about it, this is just as precise as using hex code, because 16 times 16 is 256. In practice, most developers use hex code since it's faster to say out loud and to type."
- ],
- "tests": [
- "expect($('h2')).to.have.css('color', 'rgb(255, 0, 0)');",
- "expect($('h2')).to.have.class('red-text');"
- ],
- "challengeSeed": [
- "",
- "",
- "hello world
",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08812",
- "name": "Add an Image to your Website",
- "difficulty" : "0.18",
- "description": [
- "Use an img element to add the image http://bit.ly/cutegraycat
to your website.",
- "You can add images to your website by using the img
element.",
- "An example of this would be <img src=\"www.your-image-source.com/your-image.jpg\"/>
. Note that in most cases, img
elements are self-closing.",
- "Try it with this image: http://bit.ly/cutegraycat
."
- ],
- "tests": [
- "expect($('img').attr('src')).to.equal('http://bit.ly/cutegraycat');"
- ],
- "challengeSeed": [
- "",
- "",
- "hello world
",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9acdf08812",
- "name": "Specify an Image Size TEST",
- "difficulty" : "0.19",
- "description": [
- "Create a class called narrow-image
and use it to resize the image so that it's only 200 pixels wide",
- "Uh-oh, our image is too big to fit on a mobile phone. As a result, our user will need to scroll horizontally to view the image. But we can fix this by specifying an image size.",
- "CSS has an attribute called width
that controls an element's width. Just like with fonts, we'll use pixels(px) to specify the images width.",
- "Create a class called narrow-image
and added it to the image element. Change the width to 200 pixels."
- ],
- "tests": [
- "expect($('img')).to.have.class('narrow-image');",
- "expect($('img')).to.have.css('width', 200px)"
- ],
- "challengeSeed": [
- "",
- "hello world
",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9bedf08813",
- "name": "Add a Border Around an Element",
- "difficulty" : "0.20",
- "description": [
- "Create a class called \"thick-green-border\" that puts a 5-pixel-wide black border around your cat photo.",
- "CSS Borders
have attributes like style, color and width.",
- "We've created an example border around your h1 element. See if you can add a 10-pixel-wide green border around your cat photo."
- ],
- "tests": [
- "expect($('img')).to.have.class('thick-green-border');",
- "expect($('img')).to.have.css('border-color', 'rgb(0,255,0)'));",
- "expect($('img')).to.have.css('border-width', '10px');"
- ],
- "challengeSeed": [
- "",
- "hello world
",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08814",
- "name": "Add Rounded Corners with a Border Radius",
- "difficulty" : "0.21",
- "description": [
- "Give your cat photo a border radius of 10 pixels.",
- "Your cat photo currently has sharp corners. We can round out those corners with a CSS attribute called border-radius
.",
- "You can specify a border-radius
with pixels. This will affect how rounded the corners are. Add this attribute to your thick-green-border
class and set it to 10 pixels."
- ],
- "tests": [
- "expect($('img')).to.have.class('thick-green-border');",
- "expect($('img')).to.have.css('border-radius', '10px');"
- ],
- "challengeSeed": [
- "",
- "hello world
",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08815",
- "name": "Make an Image Circular with a Border Radius",
- "difficulty" : "0.22",
- "description": [
- "Give your cat photo a border-radius
of 50%.",
- "In addition to pixels, you can also specify a border-radius
of a percentage."
- ],
- "tests": [
- "expect($('img')).to.have.css('border-radius', '50%');"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08816",
- "name": "Use an Anchor Tag to Link to an External Page",
- "difficulty" : "0.23",
- "description": [
- "Create an anchor tag
hyperlink that links to freecodecamp.com",
- ""
- ],
- "tests": [
- "expect((/free(\\s+)?code(\\s+)?camp(\\s+)?/gi).test($('a').text())).to.be.true;",
- "expect($('a').filter(function(index) { return /freecodecamp\\.com/gi.test($('a')[index]); }).length).to.eql(1);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
",
- "
",
- "
",
- "This is a link to Google",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08817",
- "name": "Make Named Anchors using the Hash Symbol",
- "difficulty" : "0.24",
- "description": [
- "Use the hash symbol(#) to turn the link to the bottom of the page into a named anchor
.",
- "Sometimes you want to add anchor elements
to your website before you know where they will link.",
- "This is also handy when you're changing the behavior of a link using jQuery
, which we'll learn about later.",
- "Replace the href in the link to freecodecamp.com with a hash symbol to turn it into a named anchor
."
- ],
- "tests": [
- "expect((/this link leads nowhere/gi).test($('a').text())).to.be.true;",
- "expect($('a').filter(function(index) { return /#/gi.test($('a')[index]); }).length).to.eql(1);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
",
- "
",
- "
",
- "This named anchor leads nowhere",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08820",
- "name": "Turn an Image into a Link",
- "difficulty" : "0.25",
- "description": [
- "Wrap the gray cat's image with an anchor tag
that leads nowhere.",
- "You can make elements into links by wrapping them in an anchor tag
.",
- "Check out the example snow-colored cat's photo. When you hover over it with your cursor, you'll see the finger pointer you usually see when you hover over a link. The photo is now a link.",
- "Wrap your gray cat's photo in an anchor tag
",
- "Use the hash symbol as the anchor tag
's href
."
- ],
- "tests": [
- "expect($('a').filter(function(index) { return /#/gi.test($('a')[index]); }).length).to.eql(2);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08818",
- "name": "Add Alt Text to an image",
- "difficulty" : "0.26",
- "description": [
- "Add the alt text
\"a photo of a cute gray cat\" to our cat photo",
- "alt text
is what browsers will display if they fail to load the image. alt text
is also important for blind or visually impaired users to understand what an image portrays. Search engines also look at alt text
.",
- "In short, every image should have alt text
!",
- "You can add alt text right in the image tag, like we've done here with the \"cute white cat\" image."
- ],
- "tests": [
- "expect($('img').filter(function(){ return /cat/gi.test(this.alt) }).length).to.eql(2);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad88fee1348bd9aedf08825",
- "name": "Adjusting the Padding of an Element",
- "difficulty" : "0.27",
- "description": [
- "Change the padding
of the green box to match that of the red box.",
- "An element's padding
controls the amount of space between an element and its border
.",
- "Here, we can see that the green box and the red box and the green box are nested within the yellow box. Note that the red box has more padding
than the green box.",
- "When you increase the green box's padding, it will increase the distance between the word \"padding\" and the border around the text."
- ],
- "tests": [
- "expect($('.green-box')).to.have.css('padding', '20px')"
- ],
- "challengeSeed": [
- "",
- "margin
",
- "",
- "",
- " padding
",
- " padding
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08822",
- "name": "Adjust the Margin of an Element",
- "difficulty" : "0.28",
- "description": [
- "Change the margin
of the green box to match that of the red box.",
- "An element's margin
controls the amount of space between an element's border
and surrounding elements.",
- "Here, we can see that the green box and the red box and the green box are nested within the yellow box. Note that the red box has more margin
than the green box, making it appear smaller.",
- "When you increase the green box's padding, it will increase the distance between its border and surrounding elements."
- ],
- "tests": [
- "expect($('.green-box')).to.have.css('margin', '20px')"
- ],
- "challengeSeed": [
- "",
- "margin
",
- "",
- "",
- " padding
",
- " padding
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08823",
- "name": "Add a Negative Margin to an Element",
- "difficulty" : "0.29",
- "description": [
- "Change the margin
of the green box to a negative value, so it fills the entire horizontal width of the blue box.",
- "An element's margin
controls the amount of space between an element's border
and surrounding elements.",
- "If you set an element's margin to a negative value, the element will grow larger.",
- "Try to set the margin to a negative value like the one for the red box."
- ],
- "tests": [
- "expect($('.green-box')).to.have.css('margin', '-15px')"
- ],
- "challengeSeed": [
- "",
- "",
- "",
- " padding
",
- " padding
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08824",
- "name": "Add Different Padding to Each Side of an Element TEST",
- "difficulty" : "0.30",
- "description": [
- "Give the green box a padding of 40 pixels on its top and left side, but only 20 pixels on its bottom and right side.",
- "Sometimes you will want to customize an element so that it has different padding on each of its sides.",
- "CSS allows you to control the padding of an element on all four sides with padding-top
, padding-right
, padding-bottom
, and padding-left
attributes."
- ],
- "tests": [
- "expect($('.green-box')).to.have.css('padding-bottom', '20px')",
- "expect($('.green-box')).to.have.css('padding-left', '40px')"
- ],
- "challengeSeed": [
- "",
- "margin
",
- "",
- "",
- " padding
",
- " padding
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1248bd9aedf08824",
- "name": "Add Different a Margin to Each Side of an Element TEST",
- "difficulty" : "0.31",
- "description": [
- "Give the green box a margin of 40 pixels on its top and left side, but only 20 pixels on its bottom and right side.",
- "Sometimes you will want to customize an element so that it has a different margin on each of its sides.",
- "CSS allows you to control the margin of an element on all four sides with margin-top
, margin-right
, margin-bottom
, and margin-left
attributes."
- ],
- "tests": [
- "expect($('.green-box')).to.have.css('margin-bottom', '20px')",
- "expect($('.green-box')).to.have.css('margin-left', '40px')"
- ],
- "challengeSeed": [
- "",
- "margin
",
- "",
- "",
- " padding
",
- " padding
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9aedf08826",
- "name": "Use Clockwise Notation to Specify an Element's Padding",
- "difficulty" : "0.32",
- "description": [
- "Use Clockwise Notation
to give an element padding of 40 pixels on its top and left side, but only 20 pixels on its bottom and right side.",
- "Instead of specifying an element's padding-top
, padding-right
, padding-bottom
, and padding-left
attributes, you can specify them all in one line, like this: padding: 10px 20px 10px 20px;
.",
- "These four values work like a clock: top, right, bottom, left, and will produce the exact same result as using the side-specific padding instructions.",
- "You can also use this notation for margins!"
- ],
- "tests": [
- "expect($('.green-box')).to.have.css('margin-bottom', '20px')",
- "expect($('.green-box')).to.have.css('margin-left', '40px')"
- ],
- "challengeSeed": [
- "",
- "margin
",
- "",
- "",
- " padding
",
- " padding
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd9acde08812",
- "name": "Use Bootstrap for Responsive Images",
- "difficulty" : "0.33",
- "description": [
- "Add the img-responsive
Bootstrap class to the image.",
- "Specifying a width of 200 pixels on our img element made it fit our phone's screen, but it's not a perfect fit. It would be great if the image could be exactly the width of our phone's screen.",
- "Fortunately, there's a Responsive CSS Framework
called written by Twitter called Bootstrap. You can add Bootstrap to any app just by including it with <link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'/>
at the top of your HTML, but we've gone ahead and included it for you here.",
- "Bootstrap will figure out how wide your screen is and respond by resizing your HTML elements - hence the name Responsive Design
.",
- "Now all you need to do is add the img-responsive
class to your image."
- ],
- "tests": [
- "expect($('img')).to.have.class('img-responsive');"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "This is a link to Google",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348bd8acde08812",
- "name": "Center Text with Bootstrap",
- "difficulty" : "0.34",
- "description": [
- "Add Bootstrap's text-center
class to your h2 element.",
- "Now that we're using Bootstrap, we can center our heading elements (h2) to make them look better. All we need to do is add the class text-center
to the h1 and h2 elements.",
- "Note that you can add several classes to the same element by seperating each of them with a space, like this: <h2 class=\"text-red text-center\">your text</h2>
."
- ],
- "tests": [
- "expect($('h2')).to.have.class('text-center');"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348cd8acde08812",
- "name": "Create a Button",
- "difficulty" : "0.35",
- "description": [
- "Create a button with the text \"Delete\" using the HTML button
element.",
- "HTML has special elements that function like links, but look like buttons. Let's creating a default HTML button."
- ],
- "tests": [
- "expect((/delete/gi).test($('button').text())).to.be.true;"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- "
"
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348cd8acdf08812",
- "name": "Create a Bootstrap Button",
- "difficulty" : "0.36",
- "description": [
- "Apply the Bootstrap's btn
class to both of your buttons.",
- "Bootstrap has its own button styles, which look much better than the plain HTML ones."
- ],
- "tests": [
- "expect($('.btn').length).to.eql(2);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- "
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348cd8acef08812",
- "name": "Create a Block Element Bootstrap Button",
- "difficulty" : "0.37",
- "description": [
- "Add Bootstrap's btn-block
class to both of your buttons.",
- "Normally, your buttons are only as wide as the text they contain. By making them block elements
, your button will stretch to fill your page's entire horizontal space.",
- "Note that these buttons still need the btn
class."
- ],
- "tests": [
- "expect($('.btn-block').length).to.eql(2);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- "
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348cd8acef08812",
- "name": "Color a Bootstrap Button with Button Primary",
- "difficulty" : "0.38",
- "description": [
- "Add Bootstrap's btn-block
class to both of your buttons.",
- "Normally, your buttons are only as wide as the text they contain. By making them block elements
, your button will stretch to fill your page's entire horizontal space.",
- "Note that these buttons still need the btn
class."
- ],
- "tests": [
- "expect($('.btn-block').length).to.eql(2);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- "
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348cd8acef08812",
- "name": "Color a Bootstrap Button with Button Primary",
- "difficulty" : "0.39",
- "description": [
- "Add Bootstrap's btn-primary
class to both of your buttons.",
- "Bootstrap comes with several pre-defined colors for buttons. The btn-primary
class is the main button color you'll use throughout your app.",
- "Note that these buttons still need the btn
and btn-block
classes."
- ],
- "tests": [
- "expect($('.btn-primary').length).to.eql(2);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- "
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad87fee1348ce8acef08812",
- "name": "Warn your Users of a Dangerous Action with the Bootstrap Button Danger Class",
- "difficulty" : "0.40",
- "description": [
- "Change the \"Delete\" button from btn-primary
to btn-danger
.",
- "Bootstrap comes with several pre-defined colors for buttons. The btn-danger
class is the button color you'll use to notify users that the button performs a destructive action, such as deleting a cat photo.",
- "Note that this button still needs the btn
and btn-block
classes."
- ],
- "tests": [
- "expect($('.btn-danger').length).to.eql(1);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- "
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad88fee1348ce8acef08812",
- "name": "Use the Bootstrap Grid to Put Two Elements Side By Side",
- "difficulty" : "0.41",
- "description": [
- "Put the \"Like\" and \"Delete\" buttons side-by-side by wrapping them in both in a <div class=\"row\">
element and each of them in a <div class=\"row\">
element.",
- "Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div
element.",
- "The row
class is applied to a div, and the buttons themselves can be nested
within it."
- ],
- "tests": [
- "expect($('.row').length).to.eql(2);",
- "expect($('.col-xs-12').length).to.eql(4);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "",
- "",
- "
",
- ""
- ],
- "challengeType": 0
- },
-
- {
- "_id" : "bad89fee1348ce8acef08812",
- "name": "Wrap Side By Side Elements in a Bootstrap Row",
- "difficulty" : "0.42",
- "description": [
- "Put the \"Like\" and \"Delete\" buttons side-by-side by wrapping them in both in a <div class=\"row\">
element and each of them in a <div class=\"row\">
element.",
- "Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div
element.",
- "The row
class is applied to a div, and the buttons themselves can be nested
within it."
- ],
- "tests": [
- "expect($('.row').length).to.eql(2);",
- "expect($('.col-xs-12').length).to.eql(4);"
- ],
- "challengeSeed": [
- "",
- "cat photo app
",
- "
",
- "
",
- "",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "",
- "",
- "
",
- ""
- ],
- "challengeType": 0
- },
- {
- "_id" : "bad87fee1348bd9aedf08813",
- "name": "Add Alt Text to an Image TEST",
- "difficulty" : "0.43",
- "description": [
- "Add the alt text \"A picture of a gray cat\" to the image.",
- "Alt text
is a useful way to tell people (and web crawlers like Google) what is pictured in a photo. It's extremely important for helping blind or visually impaired people understand the content of your website.",
- "You can add alt text right in the img element like this: <img src=\"www.your-image-source.com/your-image.jpg\" alt=\"your alt text\"/>
."
- ],
- "tests": [
- "expect((/cat/gi).test($('img').attr('alt')).to.be.true;"
- ],
- "challengeSeed": [
- "",
- "hello world
",
- "cat photo app
",
- "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
",
- "
"
- ],
- "challengeType": 0
- }
-]
diff --git a/seed_data/challenges/basics.json b/seed_data/challenges/basics.json
new file mode 100644
index 0000000000..16134aa92f
--- /dev/null
+++ b/seed_data/challenges/basics.json
@@ -0,0 +1,59 @@
+{
+ "name": "basics",
+ "order" : 0.001,
+ "challenges": [
+ {
+ "_id": "bd7126d8c441eddfaeb5bd3e",
+ "name": "Meet Other Campers in your City",
+ "difficulty": 0.065,
+ "challengeSeed": "127358841",
+ "description": [
+ "One of the best ways to stay motivated when learning to code is to hang out with other campers.",
+ "Slack and Camper News are great ways to communicate with other campers, but there's no substitute for meeting people in-person.",
+ "The easiest way to meet other campers in your city is to join your city's Facebook Group. Click here to view our growing list of local groups.",
+ "Click the link to your city, then, once Facebook loads, click \"Join group\".",
+ "Our local groups are new, so if you don't see your city on this list, you should follow the directions to create a Facebook group for your city.",
+ "If you don't have a Facebook account, we strongly recommend you create one, even if it's just for the purpose of coordinating with campers in your city through this group.",
+ "Our groups allow you to create events, coordinate those events, and share photos from the events afterward.",
+ "Whether you're hosting a study group, pair programming at your local library, or going to a weekend hackathon, your city's group will help you make it happen."
+ ],
+ "challengeType": 2,
+ "tests": []
+ },
+ {
+ "_id": "bd7137d8c441eddfaeb5bdef",
+ "name": "Get Help the Hacker Way with RSAP",
+ "difficulty": 0.07,
+ "challengeSeed": "125407432",
+ "description": [
+ "Let's cover one last thing before you start working through our lessons: how to get help.",
+ "Any time you get stuck or don't know what to do next, follow this simple algorithm (procedure): RSAP (Read, Search, Ask, Post).",
+ "First, R - Read the documentation or error message. A key skill that good coders have is the ability to interpret and then follow instructions.",
+ "Next, S - Search Google. Good Google queries take a lot of practice. When you search Google, you usually want to include the language or framework you're using. You also want to limit the results to a recent period.",
+ "Then, if you still haven't found an answer to your question, A - Ask your friends. If you have trouble, you can ask your fellow campers. We have a special chat room specifically for getting help with tools you learn through these Free Code Camp Challenges. Go to https://freecode.slack.com/messages/help/. Keep this chat open while you work on the remaining challenges.",
+ "Finally, P - Post on Stack Overflow. Before you attempt to do this, read Stack Overflow's guide to asking good questions: http://stackoverflow.com/help/how-to-ask.",
+ "Here's our detailed field guide on getting help: http://freecodecamp.com/field-guide/how-do-i-get-help-when-i-get-stuck.",
+ "Now you have a clear algorithm to follow when you need help! Let's start coding! Move on to your next challenge."
+ ],
+ "challengeType": 2,
+ "tests": []
+ },
+ {
+ "_id": "bd7127d8c441eddfaeb5bdef",
+ "name": "Build a Landing Page with HTML",
+ "difficulty": 0.08,
+ "challengeSeed": "125671867",
+ "description": [
+ "Now it's time for us to start our actual coding lessons. We've curated a series of free, self-paced, browser-based lessons from providers like Codecademy and Stanford University.",
+ "These lessons will cover a lot of ground quickly, and will hold your hand throughout the process. Don't try to memorize everything - you'll spend more than a thousand hours practicing these later, and you can always look things up. Just keep moving.",
+ "If you've learned HTML and CSS before, these next few Waypoints will be a valuable review. If you haven't learned HTML or CSS before, you're in for a treat!",
+ "This Codecademy will quickly cover HTML, CSS and even Responsive Design with Bootstrap.",
+ "If you don't already have a Codecademy account, create one here: http://www.codecademy.com.",
+ "Go to http://www.codecademy.com/en/skills/make-a-website/topics/html-elements and complete the section.",
+ "Once you're done, mark this Waypoint complete and move on the next Waypoint."
+ ],
+ "challengeType": 2,
+ "tests": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/seed_data/challenges/prepwork.json b/seed_data/challenges/prepwork.json
new file mode 100644
index 0000000000..3049d6c31a
--- /dev/null
+++ b/seed_data/challenges/prepwork.json
@@ -0,0 +1,55 @@
+[
+ {
+ "_id": "bd7124d8c441eddfaeb5bdef",
+ "name": "Learn how Free Code Camp Works",
+ "difficulty": 0.01,
+ "challengeSeed": "125407438",
+ "description": [
+ "Watch this 1-minute video, or simply read this summary:",
+ "Welcome to Free Code Camp. We're a community of busy people learning to code by building projects for nonprofits.",
+ "We built this community because learning to code is hard. But anyone who can stay motivated can learn to code. And to stay motivated, you just need to: - make friends with people who code
- code a little every day
",
+ "All our challenges are - free
- self-paced
- browser-based
",
+ "We'll spend - 200 hours learning tools like HTML, CSS, JavaScript, Node.js and databases
- 600 hours building practice projects
- 800 hours building full stack solutions for nonprofits
",
+ "By the end, we'll - be good at coding
- have the portfolio of apps with happy users to prove it
",
+ "Once you make it through Free Code Camp, you will be able to get a coding job. There are far more job openings out there than there are qualified coders to fill them.",
+ "Now it's time to join our chat room. Click the \"I've completed this challenge\" button to move on to your next challenge."
+ ],
+ "challengeType": 2,
+ "tests": []
+ },
+ {
+ "_id": "bd7125d8c441eddfaeb5bd0f",
+ "name": "Join Our Chat Room",
+ "difficulty": 0.02,
+ "challengeSeed": "124555254",
+ "description": [
+ "Now we're going to join the Free Code Camp chat room. You can come here any time of day to hang out, ask questions, or find another camper to pair program with.",
+ "Make sure your Free Code Camp account includes your email address. You can do this here: http://freecodecamp.com/account.",
+ "Click this link, which will email you an invite to Free Code Camp's Slack chat room: http://freecodecamp.com/api/slack.",
+ "Now check your email and click the link in the email from Slack",
+ "Complete the sign up process, then update your biographical information and upload an image. A picture of your face works best. This is how people will see you in the chat room, so put your best foot forward.",
+ "Now enter the general chat room and introduce yourself to our chat room by typing: \"hello world!\".",
+ "Note that you're expected to follow our Code of Conduct: http://freecodecamp.com/field-guide/what-is-the-free-code-camp-code-of-conduct?",
+ "Tell your fellow campers how you found Free Code Camp. Also tell us why you want to learn to code.",
+ "Keep the chat room open while you work through the other challenges. That way you ask for help if you get stuck on a challenge. You can also socialize when you feel like taking a break.",
+ "You can also access this chat room by clicking the \"Chat\" button in the upper right hand corner."
+ ],
+ "challengeType": 2,
+ "tests": []
+ },
+ {
+ "_id": "bd7125d8c441eddfaeb5bdff",
+ "name": "Preview our Challenge Map",
+ "difficulty": 0.03,
+ "challengeSeed": "125407437",
+ "description": [
+ "Before you start learning how to code, we'd like to introduce you to a few things.",
+ "Let's look at our Challenge Map. Click on the \"Map\" button in the upper right hand corner. This map shows all the challenges that will teach you how to code.",
+ "You should complete all these challenges in order.",
+ "Once you finish these Waypoint challenges, you'll move on to Bonfires (algorithm practice), then Ziplines (front end development practice) and finally Basejumps (full stack development practice). After that, you'll start building projects for nonprofits.",
+ "This challenge map is just for your reference. When you return to FreeCodeCamp.com, we'll automatically redirect you to the next challenge that you should be doing."
+ ],
+ "challengeType": 2,
+ "tests": []
+ }
+]
\ No newline at end of file
diff --git a/seed_data/seed.js b/seed_data/seed.js
index 95c35b328f..fc87f56d02 100644
--- a/seed_data/seed.js
+++ b/seed_data/seed.js
@@ -1,96 +1,78 @@
require('dotenv').load();
-var Bonfire = require('../models/Bonfire.js'),
- Courseware = require('../models/Courseware.js'),
- FieldGuide = require('../models/FieldGuide.js'),
- Nonprofit = require('../models/Nonprofit.js'),
- mongoose = require('mongoose'),
- secrets = require('../config/secrets'),
- coursewares = require('./coursewares.json'),
- fieldGuides = require('./field-guides.json'),
- nonprofits = require('./nonprofits.json'),
- bonfires = require('./bonfires.json');
+var Challenge = require('../models/Challenge.js'),
+ FieldGuide = require('../models/FieldGuide.js'),
+ Nonprofit = require('../models/Nonprofit.js'),
+ mongoose = require('mongoose'),
+ secrets = require('../config/secrets'),
+ fieldGuides = require('./field-guides.json'),
+ nonprofits = require('./nonprofits.json'),
+ fs = require('fs');
mongoose.connect(secrets.db);
+var challenges = fs.readdirSync(__dirname + '/challenges');
var counter = 0;
-var offerings = 4;
+var offerings = 3;
var CompletionMonitor = function() {
- counter++;
- console.log('call ' + counter);
+ counter++;
+ console.log('call ' + counter);
- if (counter < offerings) {
- return;
- } else {
- process.exit(0);
- }
+ if (counter < offerings) {
+ return;
+ } else {
+ process.exit(0);
+ }
};
-
-Bonfire.remove({}, function(err, data) {
- if (err) {
- console.error(err);
- } else {
- console.log('Deleted ', data);
- }
- Bonfire.create(bonfires, function(err, data) {
- if (err) {
- console.log(err);
- } else {
- console.log('Saved ', data);
- }
- CompletionMonitor();
+Challenge.remove({}, function(err, data) {
+ if (err) {
+ console.err(err);
+ } else {
+ console.log('Deleted ', data);
+ }
+ challenges.forEach(function (file) {
+ Challenge.create(require('./challenges/' + file), function (err, data) {
+ if (err) {
+ console.log(err);
+ } else {
+ console.log('Successfully parsed %s', file);
+ }
});
- console.log('bonfires');
+ });
});
-
-Courseware.remove({}, function(err, data) {
- if (err) {
- console.error(err);
- } else {
- console.log('Deleted ', data);
- }
- Courseware.create(coursewares, function(err, data) {
- if (err) {
- console.log(err);
- } else {
- console.log('Saved ', data);
- }
- CompletionMonitor();
- });
- console.log('coursewares');
-});
-
+/*
FieldGuide.remove({}, function(err, data) {
+ if (err) {
+ console.error(err);
+ } else {
+ console.log('Deleted ', data);
+ }
+ FieldGuide.create(fieldGuides, function(err, data) {
if (err) {
- console.error(err);
+ console.log(err);
} else {
- console.log('Deleted ', data);
+ console.log('Saved ', data);
}
- FieldGuide.create(fieldGuides, function(err, data) {
- if (err) {
- console.log(err);
- } else {
- console.log('Saved ', data);
- }
- CompletionMonitor();
- });
- console.log('field guides');
+ CompletionMonitor();
+ });
+ console.log('field guides');
});
Nonprofit.remove({}, function(err, data) {
+ if (err) {
+ console.error(err);
+ } else {
+ console.log('Deleted ', data);
+ }
+ Nonprofit.create(nonprofits, function(err, data) {
if (err) {
- console.error(err);
+ console.log(err);
} else {
- console.log('Deleted ', data);
+ console.log('Saved ', data);
}
- Nonprofit.create(nonprofits, function(err, data) {
- if (err) {
- console.log(err);
- } else {
- console.log('Saved ', data);
- }
- CompletionMonitor();
- });
- console.log('nonprofits');
+ CompletionMonitor();
+ });
+ console.log('nonprofits');
});
+*/