From 5b3eb6ad18c078ac36c5bb076bb4c423e425019f Mon Sep 17 00:00:00 2001 From: Joseph Morse Date: Fri, 4 Mar 2016 12:15:02 -0500 Subject: [PATCH 1/3] Added Prefix Hint to React Recipe Box This adds a hint to the React Recipe Box project, and closes #7297. Translations of the hint would still be needed. --- .../02-data-visualization-certification/react-projects.json | 1 + 1 file changed, 1 insertion(+) diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index b7875926ed..49a542ce1f 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -127,6 +127,7 @@ "User Story: I can edit these recipes.", "User Story: I can delete these recipes.", "User Story: All new recipes I add are saved in my browser's local storage. If I refresh the page, these recipes will still be there.", + "Hint: You should prefix your local storage keys on CodePen, i.e. _username_recipes", "Remember to use Read-Search-Ask if you get stuck.", "When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." From eaa513dc56b166b586737c1afeefa105b8b2fde8 Mon Sep 17 00:00:00 2001 From: "Alister N. Mada" Date: Sun, 6 Mar 2016 06:20:34 +0700 Subject: [PATCH 2/3] Redirect /twitch to Twitch channel --- server/boot/randomAPIs.js | 4 +- server/views/resources/twitch.jade | 68 ------------------------------ 2 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 server/views/resources/twitch.jade diff --git a/server/boot/randomAPIs.js b/server/boot/randomAPIs.js index 62e4438fad..f7237bf038 100644 --- a/server/boot/randomAPIs.js +++ b/server/boot/randomAPIs.js @@ -276,9 +276,7 @@ module.exports = function(app) { } function twitch(req, res) { - res.render('resources/twitch', { - title: 'Watch us code on Twitch.tv and LiveCoding.tv' - }); + res.redirect('https://twitch.tv/freecodecamp'); } function unsubscribe(req, res, next) { diff --git a/server/views/resources/twitch.jade b/server/views/resources/twitch.jade deleted file mode 100644 index 1b89b17432..0000000000 --- a/server/views/resources/twitch.jade +++ /dev/null @@ -1,68 +0,0 @@ -extends ../layout -block content - .col-xs-12 - .panel.panel-info - .panel-heading.text-center Watch us code on our Twitch.tv channel - .panel-body.text-center - .row - .col-xs-12 - h2 Watch the live stream below or on our   - a(href="http://twitch.tv/freecodecamp", target='_blank') Twitch.tv channel - | . - .spacer - .row - .col-md-8.col-xs-12 - .embed-responsive.embed-responsive-16by9 - iframe(src='http://www.twitch.tv/freecodecamp/embed', frameborder='0', scrolling='no') - .col-md-4.col-xs-12 - .visible-sm.visible-xs - .embed-responsive.embed-responsive-16by9 - iframe(src='http://www.twitch.tv/freecodecamp/chat?popout=', frameborder='0', scrolling='no') - .visible-md.visible-lg - .embed-responsive.embed-responsive-twitch-chat - iframe(src='http://www.twitch.tv/freecodecamp/chat?popout=', frameborder='0', scrolling='no') - .row - .col-xs-12 - h2 Check out our scheduled shows. You can add them to your calendar. - .embed-responsive.embed-responsive-16by9 - iframe.embed-responsive-item(src="https://www.google.com/calendar/embed?src=freecodecamp.com_r06116ile3o6ucpif7s0g281tc%40group.calendar.google.com&ctz=America/New_York&mode=AGENDA" style="border: 0" width="800" height="600" frameborder="0" scrolling="no") - br - .row - .col-xs-12 - h2 Here are some of our previous shows (you can full-screen them): - .row.negative-20 - .col-xs-12.col-sm-12.col-md-6 - .embed-responsive.embed-responsive-16by9.big-break - iframe.embed-responsive-item(src='//www.youtube.com/embed/Z_43xApGB9Y') - p.wrappable.negative-30 link:   - a(href="http://www.youtube.com/watch/Fn9HMn79KH0") http://www.youtube.com/watch/Z_43xApGB9Y - .col-xs-12.col-sm-12.col-md-6 - .embed-responsive.embed-responsive-16by9.big-break - iframe.embed-responsive-item(src='//www.youtube.com/embed/PvWHzcebjjQ') - p.wrappable.negative-30 link:   - a(href="http://www.youtube.com/watch/Fn9HMn79KH0") http://www.youtube.com/watch/PvWHzcebjjQ - .col-xs-12.col-sm-12.col-md-6 - .embed-responsive.embed-responsive-16by9.big-break - iframe.embed-responsive-item(src='//www.youtube.com/embed/yHL6mEr-LGY') - p.wrappable.negative-30 link:   - a(href="http://www.youtube.com/watch/Fn9HMn79KH0") http://www.youtube.com/watch/yHL6mEr-LGY - .col-xs-12.col-sm-12.col-md-6 - .embed-responsive.embed-responsive-16by9.big-break - iframe.embed-responsive-item(src='//www.youtube.com/embed/dolG-yRMcPs') - p.wrappable.negative-30 link:   - a(href="http://www.youtube.com/watch/Fn9HMn79KH0") http://www.youtube.com/watch/dolG-yRMcPs - .col-xs-12.col-sm-12.col-md-6 - .embed-responsive.embed-responsive-16by9.big-break - iframe.embed-responsive-item(src='//www.youtube.com/embed/YMz_vrK_KlQ') - p.wrappable.negative-30 link:   - a(href="http://www.youtube.com/watch/_BErpDdmBOw") http://www.youtube.com/watch/YMz_vrK_KlQ - .col-xs-12.col-sm-12.col-md-6 - .embed-responsive.embed-responsive-16by9.big-break - iframe.embed-responsive-item(src='//www.youtube.com/embed/bbFVxaza8Ik') - p.wrappable.negative-30 link:   - a(href="http://www.youtube.com/watch/S7iRBZJwOAs") http://www.youtube.com/watch/bbFVxaza8Ik - br - br - br - if !user - a.btn.btn-cta.signup-btn.btn-primary(href="/login") Start learning to code (it's free) From e657b96dbc04b7ffcf88a2e68a945d4207d572cf Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sun, 13 Mar 2016 18:04:24 -0700 Subject: [PATCH 3/3] Coerce values to string before using validator methods --- common/models/promo.js | 8 ++++---- server/boot/challenge.js | 4 ++-- server/boot/story.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/models/promo.js b/common/models/promo.js index 4dedb9a940..ec4970d461 100644 --- a/common/models/promo.js +++ b/common/models/promo.js @@ -1,4 +1,4 @@ -import { isAlphanumeric, isHexadecimal } from 'validator'; +import { isAlphanumeric, isMongoId } from 'validator'; import debug from 'debug'; const log = debug('fcc:models:promo'); @@ -6,16 +6,16 @@ const log = debug('fcc:models:promo'); export default function promo(Promo) { Promo.getButton = function getButton(id, code, type = 'isNot') { const Job = Promo.app.models.Job; - if (!id || !isHexadecimal(id)) { + if (!id || !isMongoId('' + id)) { return Promise.reject(new Error( 'Must include job id' )); } if ( - !isAlphanumeric(code) && + !isAlphanumeric('' + code) && type && - !isAlphanumeric(type) + !isAlphanumeric('' + type) ) { return Promise.reject(new Error( 'Code or Type should be an alphanumeric' diff --git a/server/boot/challenge.js b/server/boot/challenge.js index d793b9fbfd..b5350d418a 100644 --- a/server/boot/challenge.js +++ b/server/boot/challenge.js @@ -431,7 +431,7 @@ module.exports = function(app) { challengeId = badIdMap[challengeId]; } - if (!isMongoId(challengeId)) { + if (!isMongoId('' + challengeId)) { challengeId = null; } @@ -456,7 +456,7 @@ module.exports = function(app) { challengeId = badIdMap[challengeId]; } - if (!isMongoId(challengeId)) { + if (!isMongoId('' + challengeId)) { challengeId = null; } diff --git a/server/boot/story.js b/server/boot/story.js index 8857290bc0..55eb3a52c2 100755 --- a/server/boot/story.js +++ b/server/boot/story.js @@ -343,7 +343,7 @@ module.exports = function(app) { } var url = req.body.data.url; - if (!validator.isURL(url)) { + if (!validator.isURL('' + url)) { req.flash('errors', { msg: "The URL you submitted doesn't appear valid" });