Merge branch 'staging' of https://github.com/freecodecamp/freecodecamp into staging

This commit is contained in:
Quincy Larson
2015-11-13 17:15:23 -08:00
12 changed files with 148 additions and 55 deletions

View File

@ -491,6 +491,12 @@ thead {
color: #009900
}
.testimonial-image-jobs {
border-radius: 5px;
color: #009900
}
.default-border-radius {
border-radius: 5px;
}

View File

@ -42,14 +42,15 @@ export default React.createClass({
},
renderLinks() {
return navLinks.map(({ content, link, react }, index) => {
return navLinks.map(({ content, link, react, target }, index) => {
if (react) {
return (
<LinkContainer
eventKey={ index + 1 }
key={ content }
to={ link }>
<NavItem>
<NavItem
target={ target || null } >
{ content }
</NavItem>
</LinkContainer>
@ -59,7 +60,8 @@ export default React.createClass({
<NavItem
eventKey={ index + 1 }
href={ link }
key={ content }>
key={ content }
target={ target || null }>
{ content }
</NavItem>
);

View File

@ -3,10 +3,16 @@
"link": "/map"
}, {
"content": "Chat",
"link": "//gitter.im/FreeCodeCamp/FreeCodeCamp"
"link": "//gitter.im/FreeCodeCamp/FreeCodeCamp",
"target": "_blank"
},{
"content": "Wiki",
"link": "https://github.com/freecodecamp/freecodecamp/wiki/",
"target": "_blank"
},{
"content": "News",
"link": "/news"
"link": "/news",
"target": "_blank"
},{
"content": "Jobs",
"link": "/jobs",

View File

@ -3,7 +3,6 @@ import { contain } from 'thundercats-react';
import { Button, Panel, Row, Col } from 'react-bootstrap';
import ListJobs from './List.jsx';
import TwitterBtn from './TwitterBtn.jsx';
export default contain(
{
@ -61,7 +60,6 @@ export default contain(
render() {
const {
children,
numOfFollowers,
jobs,
appActions
} = this.props;
@ -74,27 +72,55 @@ export default contain(
mdOffset= { 1 }
xs={ 12 }>
<h1 className='text-center'>
Hire JavaScript engineers experienced in
HTML5, Node.js, MongoDB, and Agile Development
Hire a JavaScript engineer who's experienced in HTML5,
Node.js, MongoDB, and Agile Development.
</h1>
<div className='spacer' />
<Row className='text-center'>
<Col
sm={ 8 }
smOffset={ 2 }
xs={ 12 }>
<Button
bsSize='large'
className='signup-btn btn-block'
className='signup-btn btn-block btn-cta'
onClick={ ()=> {
appActions.updateRoute('/jobs/new');
}}>
Post a job: $200 for 30 days + weekly tweets
Post a job: $200 for 30 days
</Button>
<div className='button-spacer' />
<TwitterBtn count={ numOfFollowers || 0 } />
<div className='spacer' />
</Col>
</Row>
<div className='spacer' />
<Row>
<Col
md={ 2 }
xs={ 4 }>
<img
alt={`
a photo of Michael Gai, who recently hired a software
engineer through Free Code Camp
`}
className='img-responsive testimonial-image-jobs img-center'
src='http://i.imgur.com/tGcAA8H.jpg' />
</Col>
<Col
md={ 10 }
xs={ 8 }>
<blockquote>
<p>
We hired our last developer out of Free Code Camp
and couldn't be happier. Free Code Camp is now
our go-to way to bring on pre-screened candidates
who are enthusiastic about learning quickly and
becoming immediately productive in their new career.
</p>
<footer>
Michael Gai, <cite>CEO at CoNarrative</cite>
</footer>
</blockquote>
</Col>
</Row>
<Row>
{ this.renderChild(children, jobs) ||
this.renderList(this.handleJobClick, jobs) }

View File

@ -101,8 +101,8 @@
"react": "~0.14.2",
"react-bootstrap": "~0.27.3",
"react-motion": "~0.3.1",
"react-router": "^1.0.0-rc4",
"react-router-bootstrap": "~0.19.2",
"react-router": "^1.0.0",
"react-router-bootstrap": "https://github.com/FreeCodeCamp/react-router-bootstrap.git#freecodecamp",
"react-vimeo": "~0.0.3",
"request": "^2.65.0",
"rev-del": "^1.0.5",

View File

@ -169,6 +169,7 @@
"String.toLowerCase()"
],
"solutions": [
"function palindrome(str) {\n var string = str.toLowerCase().split(/[^A-Za-z0-9]/gi).join('');\n var aux = string.split('');\n if (aux.join('') === aux.reverse().join('')){\n return true;\n }\n\n return false;\n}"
],
"type": "bonfire",
"challengeType": 5,

View File

@ -959,7 +959,7 @@
"<code>&nbsp;&nbsp;ourArray.push(i);</code>",
"<code>}</code>",
"<code>ourArray</code> will now contain <code>[10,8,6,4,2]</code>.",
"Let's change our <code>initialization</code> and <code>final-expression</code> so we can count backward by twos for numbers.",
"Let's change our <code>initialization</code> and <code>final-expression</code> so we can count backward by twos by odd numbers.",
"Push the odd numbers from 9 through 1 to <code>myArray</code> using a <code>for</code> loop."
],
"tests":[
@ -978,12 +978,11 @@
"// Only change code below this line.",
"",
"",
"",
"// Only change code above this line.",
"",
"if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}",
""
],
"tail": [
"if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}"
],
"type": "waypoint",
"challengeType": 1
},
@ -1333,12 +1332,13 @@
" ",
" // Only change code above this line.",
" ",
" $(\".logger\").html(\"\");",
" $(\".logger\").html(\"Not A Win\")",
" ",
" if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
" $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
" ",
" ",
" $(\".logger\").append(\" Not A Win\")",
" return [slotOne, slotTwo, slotThree];",
" }",
"",
@ -1460,13 +1460,14 @@
"title": "Add your JavaScript Slot Machine Slots",
"description": [
"Now that our slots will each generate random numbers, we need to check whether they've all returned the same number.",
"If they have, we should notify our user that they've won.",
"Otherwise, we should return <code>null</code>, which is a JavaScript data structure that means nothing.",
"If all three numbers match, we should return the number that we have in three of slots or leave it as <code>null</code>.",
"Let's create an <code>if statement</code> with multiple conditions in order to check whether all numbers are equal.",
"<code>if (slotOne !== slotTwo || slotTwo !== slotThree) {</code>",
"If they have, we should notify our user that they've won and we should return <code>null</code>.",
"<code>null</code> is a JavaScript data structure that means nothing.",
"The user wins when all the three numbers match. Let's create an <code>if statement</code> with multiple conditions in order to check whether all numbers are equal.",
"<code>if(slotOne === slotTwo && slotTwo === slotThree){</code>",
"<code>&nbsp;&nbsp;return null;</code>",
"<code>}</code>"
"<code>}</code>",
"Also, we need to show the user that he has won the game when he gets the same number in all the slots.",
"If all three numbers match, we should also set the text <code>\"It's A Win\"</code> to the element with class <code>logger</code>."
],
"tests": [
"assert((function(){var data = runSlots();return data === null || data.toString().length === 1;})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return <code>null</code>.')"
@ -1484,8 +1485,6 @@
" slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" ",
" $(\".logger\").html(\"\");",
" $(\".logger\").html(\"Not A Win\");",
" ",
" // Only change code below this line.",
" ",
@ -1493,11 +1492,12 @@
" ",
" // Only change code above this line.",
" ",
" if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
" $(\".logger\").html(slotOne);",
" $(\".logger\").append(\" \" + slotTwo);",
" $(\".logger\").append(\" \" + slotThree);",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
" ",
" $(\".logger\").append(\" Not A Win\");",
" ",
" return [slotOne, slotTwo, slotThree];",
" }",
"",
@ -1622,7 +1622,7 @@
"Let's use the jQuery <code>selector</code> <code>$(\".slot\")</code> to select all of the slots.",
"Once they are all selected, we can use <code>bracket notation</code> to access each individual slot:",
"<code>$($(\".slot\")[0]).html(slotOne);</code>",
"This jQuery will select the first and update the slot's HTML to display the correct number.",
"This jQuery will select the first slot and update it's HTML to display the correct number.",
"Use the above selector to display each number in its corresponding slot."
],
"tests": [
@ -1642,8 +1642,6 @@
" slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" ",
" $(\".logger\").html(\"\");",
" $(\".logger\").html(\"Not A Win\")",
" ",
" // Only change code below this line.",
" ",
@ -1652,15 +1650,17 @@
" // Only change code above this line.",
" ",
" if (slotOne === slotTwo && slotTwo === slotThree) {",
" return slotOne;",
" $(\".logger\").html(\" It's A Win\")",
" return null;",
" }",
" ",
" if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
" $(\".logger\").html(slotOne);",
" $(\".logger\").append(\" \" + slotTwo);",
" $(\".logger\").append(\" \" + slotThree);",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
" ",
" $(\".logger\").append(\" Not A Win\");",
" ",
" ",
" return [slotOne, slotTwo, slotThree];",
" }",
"",
@ -1811,8 +1811,6 @@
" slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;",
" ",
" $('.logger').html('');",
" $('.logger').html('Not A Win');",
" ",
" // Only change code below this line.",
" ",
@ -1821,15 +1819,16 @@
" // Only change code above this line.",
" ",
" if (slotOne === slotTwo && slotTwo === slotThree) {",
" return slotOne;",
" $('.logger').html(\"It's A Win\");",
" return null;",
" }",
" ",
" if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined) {",
" $('.logger').html(slotOne);",
" $('.logger').append(' ' + slotTwo);",
" $('.logger').append(' ' + slotThree);",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
" ",
" $('.logger').append(\" Not A Win\");",
" ",
" return [slotOne, slotTwo, slotThree];",
" }",
"",

View File

@ -105,7 +105,7 @@
"title":"Make Instances of Objects with a Constructor Function",
"description":[
"Now let's put that great <code>constructor</code> function we made in the last lesson to use!",
"To use a <code>constructor</code> function we call it with the <code>new</code> keyword in front if it like:",
"To use a <code>constructor</code> function we call it with the <code>new</code> keyword in front of it like:",
"<code>var myCar = new Car();</code>",
"<code>myCar</code> is now an <code>instance</code> of the <code>Car</code> constructor that looks like the object it described:",
"<code>{</code>",
@ -113,7 +113,7 @@
"<code>&nbsp;&nbsp;engines: 1,</code>",
"<code>&nbsp;&nbsp;seats: 1</code>",
"<code>}</code>",
"Note that it is important to use the <code>new</code> keyword when calling a constructor. This is how javascript knows to create a new object and that all the references to <code>this</code> inside the constructor should be referring to this new object.",
"Note that it is important to use the <code>new</code> keyword when calling a constructor. This is how Javascript knows to create a new object and that all the references to <code>this</code> inside the constructor should be referring to this new object.",
"Now, once the <code>myCar</code> <code>instance</code> is created it can be used like any other object and can have its properties accessed and modified the same way you would usually. For example:",
"<code>myCar.turboType = \"twin\";</code>",
"Our <code>myCar</code> variable now has a property <code>turboType</code> with a value of <code>\"twin\"</code>.",
@ -387,7 +387,7 @@
"description": [
"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.",
"Use <code>reverse</code> to reverse the <code>array</code> variable and assign it to <code>myArray</code>."
"Use <code>reverse</code> to reverse the <code>array</code> variable and assign it to <code>newArray</code>."
],
"tests": [
"assert.deepEqual(newArray, [7,6,5,4,3,2,1], 'message: You should reverse the array.');",
@ -402,7 +402,9 @@
"var newArray = array;",
"",
"// Only change code above this line.",
"",
""
],
"tail":[
"(function() {return newArray;})();"
],
"challengeType": 1,
@ -410,7 +412,7 @@
},
{
"id": "cf1111c1c16feddfaeb3bdef",
"title": "Concatenate Strings with .concat",
"title": "Concatenate Arrays with .concat",
"description": [
"<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.",

View File

@ -64,6 +64,7 @@ module.exports = function(app) {
router.post('/news/userstories', userStories);
router.get('/news/hot', hotJSON);
router.get('/news/feed', RSSFeed);
router.get('/stories/hotStories', hotJSON);
router.get(
'/stories/submit',
@ -105,6 +106,26 @@ module.exports = function(app) {
);
}
function RSSFeed(req, res, next) {
var query = {
order: 'timePosted DESC',
limit: 1000
};
findStory(query).subscribe(
function(stories) {
var sliceVal = stories.length >= 100 ? 100 : stories.length;
var data = stories.sort(sortByRank).slice(0, sliceVal);
res.render('feed', {
title: 'FreeCodeCamp Camper News RSS Feed',
description: 'RSS Feed for FreeCodeCamp Top 100 Hot Camper News',
url: 'http://www.freecodecamp.com/news',
FeedPosts: data
});
},
next
);
}
function hot(req, res) {
return res.render('stories/index', {
title: 'Top Stories on Camper News',

View File

@ -20,6 +20,20 @@
"description": "A path to a free education in Computer Science.",
"image": "https://camo.githubusercontent.com/c42438055d3fee26b29e6d046fd8d06ebff3db20/687474703a2f2f692e696d6775722e636f6d2f6838786a72726a2e706e67"
},
{
"camper": "akiralaine",
"name": "Musare",
"url": "http://musare.com/",
"description": "Musare is a modern, collaborative, open-source Music App.",
"image": "http://i.imgur.com/Y4D4MPL.png"
},
{
"camper": "storbeck",
"name": "Free Code Camp Event Zipline: Recipe Box",
"url": "http://codepen.io/GeoffStorbeck/full/bVKyzd/",
"description": "Try to reverse engineer this Recipe Box as an optional Zipline challenge.",
"image": "http://i.imgur.com/5o0bwVQ.png"
},
{
"camper": "akiralaine",
"name": "Camper News Bot",

15
server/views/feed.jade Normal file
View File

@ -0,0 +1,15 @@
doctype xml
rss(version="2.0", xmlns:atom="http://www.w3.org/2005/Atom")
channel
title= title
link= url
description= description
atom:link(href="http://www.freecodecamp.com/news/feed", rel="self", type="application/rss+xml")
for post in FeedPosts
if (post.link).match(/https*:\/\/\w+(\.\w+)*/)
item
title #{ post.headline.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"') }
description <![CDATA[!{ post.metaDescription }]]>
pubDate= (new Date(post.timePosted)).toUTCString()
link= post.link
guid(isPermaLink="false")= post.link

View File

@ -60,3 +60,4 @@ link(rel="mstile", sizes="310x150", href="https://s3.amazonaws.com/freecodecamp/
link(rel="mstile", sizes="70x70", href="https://s3.amazonaws.com/freecodecamp/favicons/mstile-70x70.png")
link(rel="favicon", href="https://s3.amazonaws.com/freecodecamp/favicons/favicon.ico")
link(rel='shortcut icon', href='//s3.amazonaws.com/freecodecamp/favicons/favicon.ico')
link(rel="alternate" type="application/rss+xml" title="RSS Feed for FreeCodeCamp Camper News" href="http://www.freecodecamp.com/news/feed")