Merge pull request #7945 from FreeCodeCamp/staging

Releasing Staging
This commit is contained in:
Berkeley Martinez
2016-04-06 14:29:31 -07:00
15 changed files with 381 additions and 304 deletions

View File

@ -92,12 +92,6 @@
"twitter": { "twitter": {
"type": "string" "type": "string"
}, },
"facebook": {
"type": "string"
},
"google": {
"type": "string"
},
"currentStreak": { "currentStreak": {
"type": "number", "type": "number",
"default": 0 "default": 0

View File

@ -660,7 +660,7 @@
[ [
"//i.imgur.com/fTFMjwf.gif", "//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.", "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. 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 top 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" "https://github.com/FreeCodeCamp/freecodecamp/wiki/List-of-Free-Code-Camp-city-based-Campsites"
] ]
], ],
@ -748,7 +748,7 @@
[ [
"//i.imgur.com/ZRgXraT.gif", "//i.imgur.com/ZRgXraT.gif",
"A gif showing us scrolling through our challenge map.", "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. We recommend that you complete these from top to bottom, at a sustainable pace. 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. You can always go to your most recent challenge by clicking the \"Learn\" button.", "Now you're ready to start coding. The \"Map\" button in your upper right hand corner will show you our challenge map. We recommend that you complete these from top to bottom, at a sustainable pace. 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.",
"" ""
] ]
], ],

View File

@ -405,9 +405,12 @@
"id": "a3f503de51cfab748ff001aa", "id": "a3f503de51cfab748ff001aa",
"title": "Pairwise", "title": "Pairwise",
"description": [ "description": [
"Return the sum of all element indices of array <code>arr</code> that can be paired with one other element to form a sum that equals the value in the second argument <code>arg</code>. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.", "Given an array <code>arr</code>, find element pairs whose sum equal the second argument <code>arg</code> and return the sum of their indices.",
"For example, <code>pairwise([1, 4, 2, 3, 0, 5], 7)</code> should return <code>11</code> because 4, 2, 3 and 5 can be paired with each other to equal 7 and their indices (1, 2, 3, and 5) sum to 11.", "If multiple pairs are possible that have the same numeric elements but different indices, return the smallest sum of indices. Once an element has been used, it cannot be reused to pair with another.",
"<code>pairwise([1, 3, 2, 4], 4)</code> would only return <code>1</code>, because only the first two elements can be paired to equal 4, and the first element has an index of 0!", "For example <code>pairwise([7, 9, 11, 13, 15], 20)</code> returns <code>6</code>. The pairs that sum to 20 are <code>[7, 13]</code> and <code>[9, 11]</code>. We can then write out the array with their indices and values.",
"<table class=\"table\"><tr><th><b>Index</b></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th></tr><tr><td>Value</td><td>7</td><td>9</td><td>11</td><td>13</td><td>15</td></tr></table>",
"Below we'll take their corresponding indices and add them.",
"7 + 13 = 20 &#8594; Indices 0 + 3 = 3<br>9 + 11 = 20 &#8594; Indices 1 + 2 = 3<br>3 + 3 = 6 &#8594 Return <code>6</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. Try to pair program. Write your own 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. Try to pair program. Write your own code."
], ],
"challengeSeed": [ "challengeSeed": [

View File

@ -177,8 +177,12 @@
], ],
"challengeSeed": [ "challengeSeed": [
"function whereAreYou(collection, source) {", "function whereAreYou(collection, source) {",
" var arr = [];",
" // What's in a name?", " // What's in a name?",
" var arr = [];",
" // Only change code below this line",
" ",
" ",
" // Only change code above this line",
" return arr;", " return arr;",
"}", "}",
"", "",

View File

@ -1,32 +1,59 @@
import { Observable } from 'rx';
import dedent from 'dedent'; import dedent from 'dedent';
import moment from 'moment'; import moment from 'moment';
import { observeMethod } from '../utils/rx'; import { timeCache, observeMethod } from '../utils/rx';
function numberWithCommas(x) { function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
} }
// userCount(where: Object) => Observable[Number]
// getCertCount(userCount: userCount, cert: String) => Observable[Number]
function getCertCount(userCount, cert) {
return userCount({ [cert]: true })
// using This-Bind operator
::timeCache(2, 'hours');
}
export default function about(app) { export default function about(app) {
const router = app.loopback.Router(); const router = app.loopback.Router();
const User = app.models.User; const User = app.models.User;
const userCount$ = observeMethod(User, 'count'); const userCount = observeMethod(User, 'count');
const frontEndCount$ = getCertCount(userCount, 'isFrontEndCert');
const dataVisCount$ = getCertCount(userCount, 'isDataVisCert');
const backEndCount$ = getCertCount(userCount, 'isBackEndCert');
function showAbout(req, res, next) { function showAbout(req, res, next) {
const daysRunning = moment().diff(new Date('10/15/2014'), 'days'); const daysRunning = moment().diff(new Date('10/15/2014'), 'days');
userCount$() Observable.combineLatest(
.map(camperCount => numberWithCommas(camperCount)) frontEndCount$,
.doOnNext(camperCount => { dataVisCount$,
backEndCount$,
(frontEndCount = 0, dataVisCount = 0, backEndCount = 0) => ({
frontEndCount,
dataVisCount,
backEndCount
})
)
.doOnNext(({ frontEndCount, dataVisCount, backEndCount }) => {
res.render('resources/about', { res.render('resources/about', {
camperCount, frontEndCount: numberWithCommas(frontEndCount),
dataVisCount: numberWithCommas(dataVisCount),
backEndCount: numberWithCommas(backEndCount),
daysRunning, daysRunning,
title: dedent` title: dedent`
About our Open Source Community, our social media presence, About our Open Source Community, our social media presence,
and how to contact us`.split('\n').join(' '), and how to contact us
`.split('\n').join(' '),
globalCompletedCount: numberWithCommas( globalCompletedCount: numberWithCommas(
5612952 + (Math.floor((Date.now() - 1446268581061) / 1800)) 5612952 + (Math.floor((Date.now() - 1446268581061) / 1800))
) ),
globalPledgedAmount: numberWithCommas(Math.floor(
28000 +
((Date.now() - 1456207176902) / (2629746000 / 2000) * 8.30)
))
}); });
}) })
.subscribe(() => {}, next); .subscribe(() => {}, next);

View File

@ -43,6 +43,7 @@ module.exports = function(app) {
router.get('/how-nonprofit-projects-work', howNonprofitProjectsWork); router.get('/how-nonprofit-projects-work', howNonprofitProjectsWork);
router.get('/code-of-conduct', codeOfConduct); router.get('/code-of-conduct', codeOfConduct);
router.get('/academic-honesty', academicHonesty); router.get('/academic-honesty', academicHonesty);
router.get('/news', news);
router.get( router.get(
'/the-fastest-web-page-on-the-internet', '/the-fastest-web-page-on-the-internet',
@ -284,6 +285,12 @@ module.exports = function(app) {
}); });
} }
function news(req, res) {
res.render('resources/camper-news-deprecated', {
title: 'Camper News'
});
}
function twitch(req, res) { function twitch(req, res) {
res.redirect('https://twitch.tv/freecodecamp'); res.redirect('https://twitch.tv/freecodecamp');
} }

View File

@ -78,7 +78,6 @@ module.exports = function(app) {
); );
router.post('/stories/preliminary', ifNoUser401, newStory); router.post('/stories/preliminary', ifNoUser401, newStory);
router.post('/stories/', ifNoUser401, storySubmission); router.post('/stories/', ifNoUser401, storySubmission);
router.get('/news/', hot);
router.post('/stories/search', getStories); router.post('/stories/search', getStories);
router.get('/news/:storyName', returnIndividualStory); router.get('/news/:storyName', returnIndividualStory);
router.post('/stories/upvote/', ifNoUser401, upvote); router.post('/stories/upvote/', ifNoUser401, upvote);
@ -127,13 +126,6 @@ module.exports = function(app) {
); );
} }
function hot(req, res) {
return res.render('stories/index', {
title: 'Top Stories on Camper News',
page: 'hot'
});
}
function submitNew(req, res) { function submitNew(req, res) {
if (!req.user.isGithubCool) { if (!req.user.isGithubCool) {
req.flash('errors', { req.flash('errors', {

View File

@ -1,4 +1,5 @@
import Rx from 'rx'; import Rx, { AsyncSubject, Observable } from 'rx';
import moment from 'moment';
import debugFactory from 'debug'; import debugFactory from 'debug';
const debug = debugFactory('fcc:rxUtils'); const debug = debugFactory('fcc:rxUtils');
@ -31,3 +32,22 @@ export function observeQuery(Model, method, query) {
export function observeMethod(context, methodName) { export function observeMethod(context, methodName) {
return Rx.Observable.fromNodeCallback(context[methodName], context); return Rx.Observable.fromNodeCallback(context[methodName], context);
} }
// timeChache(amount: Number, unit: String) => Observable
export function timeCache(time, unit) {
const source = this;
let cache;
let expireCacheAt;
return Observable.create(observable => {
// if there is no expire time set
// or if expireCacheAt is smaller than now,
// set new expire time in MS and create new subscription to source
if (!expireCacheAt || expireCacheAt < Date.now()) {
// set expire in ms;
expireCacheAt = moment().add(time, unit).valueOf();
cache = new AsyncSubject();
source.subscribe(cache);
}
return cache.subscribe(observable);
});
}

View File

@ -17,18 +17,10 @@ block content
a.btn.btn-lg.btn-block.btn-twitter.btn-link-social(href='/link/twitter') a.btn.btn-lg.btn-block.btn-twitter.btn-link-social(href='/link/twitter')
i.fa.fa-twitter i.fa.fa-twitter
| Add my Twitter to my portfolio | Add my Twitter to my portfolio
if (!user.facebook)
a.btn.btn-lg.btn-block.btn-facebook.btn-link-social(href='/link/facebook')
i.fa.fa-facebook
| Add my Facebook to my portfolio
if (!user.linkedin) if (!user.linkedin)
a.btn.btn-lg.btn-block.btn-linkedin.btn-link-social(href='/link/linkedin') a.btn.btn-lg.btn-block.btn-linkedin.btn-link-social(href='/link/linkedin')
i.fa.fa-linkedin i.fa.fa-linkedin
| Add my LinkedIn to my portfolio | Add my LinkedIn to my portfolio
if (!user.google)
a.btn.btn-lg.btn-block.btn-google.btn-link-social(href='/link/google')
i.fa.fa-google-plus
| Add my Google+ to my portfolio
.spacer .spacer
h2.text-center Account Settings h2.text-center Account Settings
.row .row

View File

@ -34,10 +34,6 @@ block content
a.fa.fa-github-square.text-primary(title="@#{username}'s GitHub Profile", href=github, target='_blank') a.fa.fa-github-square.text-primary(title="@#{username}'s GitHub Profile", href=github, target='_blank')
if (linkedin) if (linkedin)
a.fa.fa-linkedin-square.text-primary(title="@#{username}'s LinkedIn Profile", href=linkedin, target='_blank') a.fa.fa-linkedin-square.text-primary(title="@#{username}'s LinkedIn Profile", href=linkedin, target='_blank')
if (facebook)
a.fa.fa-facebook-square.text-primary(title="@#{username}'s Facebook Profile", href='https://facebook.com/' + facebook, target='_blank')
if (google)
a.fa.fa-google-plus-square.text-primary(title="@#{username}'s Google Profile", href='https://plus.google.com/' + google, target='_blank')
h1.flat-top.wrappable= name h1.flat-top.wrappable= name
h1.flat-top.wrappable= location h1.flat-top.wrappable= location
h1.flat-top.text-primary= "[ " + (progressTimestamps.length) + " ]" h1.flat-top.text-primary= "[ " + (progressTimestamps.length) + " ]"

View File

@ -9,7 +9,7 @@ block content
.big-break .big-break
.col-xs-12.col-sm-12.col-md-3 .col-xs-12.col-sm-12.col-md-3
img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_connect.svg', alt='Get great references and connections to start your software engineer career') img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_connect.svg', alt='Get great references and connections to start your software engineer career')
p.large-p Join a community of 200,000+ developers. p.large-p Join a community of 300,000+ developers.
.col-xs-12.col-sm-12.col-md-3 .col-xs-12.col-sm-12.col-md-3
img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_learn.svg', alt='Learn to code and learn full stack JavaScript') img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_learn.svg', alt='Learn to code and learn full stack JavaScript')
p.large-p Work on coding challenges together. p.large-p Work on coding challenges together.

View File

@ -9,18 +9,31 @@ block content
span.tag Established:&#9; span.tag Established:&#9;
span.text-primary #{daysRunning} span.text-primary #{daysRunning}
| days ago | days ago
li
span.tag Population:&#9;
span.text-primary #{camperCount}
| campers
li
span.tag Completed:&#9;
span.text-primary #{globalCompletedCount}
| challenges
li.nowrap li.nowrap
span.tag Donated:&#9; span.tag Donated:&#9;
span.text-primary $850,000 span.text-primary $850,000
| in pro-bono code | in pro-bono code
li.nowrap
span.tag Pledged:&#9;
span.text-primary $#{globalPledgedAmount}
| to nonprofits
.row
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-6.col-md-offset-3
h2.text-center Certifications
hr
ul.population-table
li.nowrap
span.tag Front End:&#9;
span.text-primary #{frontEndCount}
| earned
li.nowrap
span.tag Data Viz:&#9;
span.text-primary #{dataVisCount}
| earned
li.nowrap
span.tag Back End:&#9;
span.text-primary #{backEndCount}
| earned
.spacer .spacer
.row .row
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-6.col-md-offset-3 .col-xs-12.col-sm-10.col-sm-offset-1.col-md-6.col-md-offset-3

View File

@ -0,0 +1,7 @@
extends ../layout
block content
h1.text-center We have discontinued Camper News.
h2.text-center We are now using our subreddit instead.
h3.text-center Here is a&thinsp;
a(href='https://www.reddit.com/r/FreeCodeCamp/search?sort=top&q=flair%3AArticle&restrict_sr=on&t=week' target='_blank') Camper News-like way to use our subreddit
| .

View File

@ -2,6 +2,28 @@ extends ../layout
block content block content
h1.text-center Shop h1.text-center Shop
hr hr
.row
.col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.text-center
img.img-responsive.img-center(src='//i.imgur.com/GzpUBR5.jpg')
h3 Women's fitted black t-shirt
h4 Only $19.99!
p This high-quality American Apparel t-shirt will help you look like the fantastic developer you are.
.spacer
a.btn.btn-lg.signup-btn.btn-block(href='//teespring.com/free-code-camp-tshirt-black#pid=70&cid=2343&sid=front' target='_blank') Get this awesome shirt
.button-spacer
a.btn.btn-primary.btn-lg.btn-block(href='//teespring.com/black-free-code-camp-tshirt-eu#pid=375&cid=100052&sid=front' target='_blank') Get it here if you live in Europe
hr
.row
.col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.text-center
img.img-responsive.img-center(src='//i.imgur.com/ENPVayN.jpg')
h3 Men's black t-shirt
h4 Only $19.99!
p Features Free Code Camp's classy "function call" logo. You can't have too many awesome black t-shirts!
.spacer
a.btn.btn-lg.signup-btn.btn-block(href='//teespring.com/free-code-camp-tshirt-black' target='_blank') Get this awesome shirt
.button-spacer
a.btn.btn-primary.btn-lg.btn-block(href='//teespring.com/black-free-code-camp-tshirt-eu' target='_blank') Get it here if you live in Europe
hr
.row .row
.col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.text-center .col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.text-center
img.img-responsive.img-center(src='//i.imgur.com/MH1CvwY.jpg') img.img-responsive.img-center(src='//i.imgur.com/MH1CvwY.jpg')
@ -9,9 +31,9 @@ block content
h4 Get two for only $5, with free shipping anywhere! h4 Get two for only $5, with free shipping anywhere!
p These durable 2" (5 cm) stickers sport a matte finish, and look great anywhere - especially on your laptop. p These durable 2" (5 cm) stickers sport a matte finish, and look great anywhere - especially on your laptop.
html. html.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <form action="//www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="R9AGYKJUCU37N"> <input type="hidden" name="hosted_button_id" value="R9AGYKJUCU37N">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <input type="image" src="//www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> <img alt="" border="0" src="//www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form> </form>