From 62bd350a291171d446a531ecc87e6d31d2ac278e Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 4 Feb 2015 12:52:19 -0800 Subject: [PATCH 01/14] expand landing page copy and update the faq parital --- views/home.jade | 9 +++++++-- views/partials/faq.jade | 7 ------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/views/home.jade b/views/home.jade index 650b1048f1..6fcec23b5d 100644 --- a/views/home.jade +++ b/views/home.jade @@ -68,14 +68,19 @@ block content .col-xs-12.col-sm-12.col-md-3 .landing-skill-icon.ion-ios-loop-strong h2.black-text Agile + br .big-break - h2   - h2 Why you should join our community: + h2 Why you should join our community right now: h3.col-xs-offset-0.col-sm-offset-1.col-md-offset-2 ul.text-left li.ion-code   We're thousands of professionals, all learning to code together li.ion-code   We're building projects for dozens of nonprofits li.ion-code   Our community is 100% free and open source + li.ion-code   You'll learn Full Stack JavaScript and become a Software Engineer + li.ion-code   You'll work through our focused, interactive courses and tutorials + li.ion-code   You'll learn to code at your own pace, in your browser or on your phone + li.ion-code   You'll become qualified for thousands of jobs currently going unfilled + li.ion-code   You can get help in real time from our community chat rooms and forum li.ion-code   We all share one goal: to boost our careers with code .big-break a.btn.btn-cta.signup-btn(href="/login") Learn to code today (it's free) \ No newline at end of file diff --git a/views/partials/faq.jade b/views/partials/faq.jade index f1acaa784f..569969a62e 100644 --- a/views/partials/faq.jade +++ b/views/partials/faq.jade @@ -72,10 +72,3 @@ p.landing-p Unlike coding bootcamps, anyone can study at Free Code Camp. We're not going to tell you that you can't become a software engineer. We believe the only person who should be able to tell you that is you. If you persevere, and keep working through our challenges and nonprofit projects, you will become an employable software engineer. br br - .text-center - a.btn.btn-cta.signup-btn.cta(href="/login") Start learning to code (it's free) - br - br - a.btn.nonprofit-cta.btn-success(href="/nonprofits") I'm with a nonprofit and want help coding something - br - br From f2ad94d7c68abd8f2feac0e162e15dac2ef3018e Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 4 Feb 2015 13:04:51 -0800 Subject: [PATCH 02/14] add h1 text to bonfire, challenge and account views --- public/css/main.less | 6 ++++++ views/account/show.jade | 3 ++- views/bonfire/show.jade | 3 +-- views/challenges/show.jade | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/public/css/main.less b/public/css/main.less index ca77373c7b..8553d372bc 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -136,6 +136,12 @@ ul { font-size: 25px; } +.panel-heading > h1 { + font-size: 25px; + padding: 2px; + margin: 2px; +} + .navbar-brand { font-size: 26px; } diff --git a/views/account/show.jade b/views/account/show.jade index cae103557f..36a8122d3d 100644 --- a/views/account/show.jade +++ b/views/account/show.jade @@ -2,7 +2,8 @@ extends ../layout block content .col-xs-12.col-sm-12.col-md-12 .panel.panel-primary - .panel-heading.text-center #{username} + .panel-heading.text-center + h1 #{username}'s portfolio .panel-body .row .col-xs-12 diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index 3fd59f5f69..75baa836ca 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -20,8 +20,7 @@ block content .row .col-xs-12.col-sm-12.col-md-4.bonfire-top #testCreatePanel - - h2.text-center= name + h1.text-center= name h2.text-center.bonfire-flames if (difficulty == "0") i.ion-ios-flame-outline diff --git a/views/challenges/show.jade b/views/challenges/show.jade index 13dc136c08..3e20d43033 100644 --- a/views/challenges/show.jade +++ b/views/challenges/show.jade @@ -3,7 +3,8 @@ block content .row .col-sm-12.col-md-12.col-xs-12 .panel.panel-primary - .panel-heading.text-center #{name} (takes #{time} minutes) + .panel-heading.text-center + h1 #{name} (takes #{time} minutes) script. var bonfireName = null; .panel.panel-body From 62abc4b3ee9be7381b42f98ee0adc3a68a287d0e Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 4 Feb 2015 15:26:13 -0800 Subject: [PATCH 03/14] update nonprofit project text and add footer back into landing page --- views/contact/nonprofits.jade | 2 +- views/partials/footer.jade | 39 +++++++++++++++++------------------ 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/views/contact/nonprofits.jade b/views/contact/nonprofits.jade index 7df7fe5ae5..f52f36bec9 100644 --- a/views/contact/nonprofits.jade +++ b/views/contact/nonprofits.jade @@ -11,7 +11,7 @@ block content ul li • Meet with them regularly to provide direction and answer questions li • Clearly communicate your project's goals: what will this project solve, and for whom? - li • Understand that they will build your project using JavaScript frameworks (as opposed to older or proprietary tools) + li • Understand that all our projects involve building new sites using modern JavaScript frameworks. We're happy to build a replacement for your old Wordpress or Drupal, but we cannot expand or maintain it. li • Keep your expectations high. Our students' goal is to produce work that's up to your standards h3 If you're OK with these terms, great! We'd love to help you! Fill in this form and we'll get right back to you. form.form-horizontal(role='form', action="/nonprofits/", method='POST', novalidate='novalidate', name='nonprofitForm') diff --git a/views/partials/footer.jade b/views/partials/footer.jade index 8651171bf6..7eab9a6f40 100644 --- a/views/partials/footer.jade +++ b/views/partials/footer.jade @@ -1,20 +1,19 @@ -- if (!landingPage) - .fcc-footer - .col-xs-12 - a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank') - |   - a.ion-social-twitch-outline(title="Free Code Camp Live Pair Programming on Twitch.TV", href="http://www.twitch.tv/freecodecamp", target='_blank') - |   - a.ion-social-github(title="Free Code Camp on GitHub", href="http://github.com/freecodecamp", target='_blank') - |   - a.ion-social-twitter(title="Free Code Camp on Twitter", href="http://twitter.com/freecodecamp", target='_blank') - |   - a.ion-social-facebook(title="Free Code Camp on Facebook", href="http://facebook.com/freecodecamp", target='_blank') - |   - a.ion-social-linkedin(title="Free Code Camp on LinkedIn", href="http://linkedin.com/company/4831032?free-code-camp", target='_blank') - |   - a.ion-information-circled(title="About Free Code Camp", href="/learn-to-code") - |   - a.ion-locked(title="Free Code Camp's Privacy Policy", href="/privacy") - |   - a.ion-code-working(title="Bonfire Coding Playground", href="/playground") \ No newline at end of file +.fcc-footer + .col-xs-12 + a.ion-speakerphone(title="Free Code Camp's Blog", href='http://blog.freecodecamp.com', target='_blank') + |   + a.ion-social-twitch-outline(title="Free Code Camp Live Pair Programming on Twitch.TV", href="http://www.twitch.tv/freecodecamp", target='_blank') + |   + a.ion-social-github(title="Free Code Camp on GitHub", href="http://github.com/freecodecamp", target='_blank') + |   + a.ion-social-twitter(title="Free Code Camp on Twitter", href="http://twitter.com/freecodecamp", target='_blank') + |   + a.ion-social-facebook(title="Free Code Camp on Facebook", href="http://facebook.com/freecodecamp", target='_blank') + |   + a.ion-social-linkedin(title="Free Code Camp on LinkedIn", href="http://linkedin.com/company/4831032?free-code-camp", target='_blank') + |   + a.ion-information-circled(title="About Free Code Camp", href="/learn-to-code") + |   + a.ion-locked(title="Free Code Camp's Privacy Policy", href="/privacy") + |   + a.ion-code-working(title="Bonfire Coding Playground", href="/playground") \ No newline at end of file From 1f36c262649e59c2878c32d855a0569c4b20b406 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 4 Feb 2015 16:11:48 -0800 Subject: [PATCH 04/14] minor changes to landing page --- views/home.jade | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/home.jade b/views/home.jade index 6fcec23b5d..206cfd7811 100644 --- a/views/home.jade +++ b/views/home.jade @@ -69,9 +69,10 @@ block content .landing-skill-icon.ion-ios-loop-strong h2.black-text Agile br + br .big-break h2 Why you should join our community right now: - h3.col-xs-offset-0.col-sm-offset-1.col-md-offset-2 + h3.col-xs-offset-0.col-sm-offset-1 ul.text-left li.ion-code   We're thousands of professionals, all learning to code together li.ion-code   We're building projects for dozens of nonprofits @@ -81,6 +82,6 @@ block content li.ion-code   You'll learn to code at your own pace, in your browser or on your phone li.ion-code   You'll become qualified for thousands of jobs currently going unfilled li.ion-code   You can get help in real time from our community chat rooms and forum - li.ion-code   We all share one goal: to boost our careers with code + li.ion-code   We all share one common goal: to boost our careers with code .big-break a.btn.btn-cta.signup-btn(href="/login") Learn to code today (it's free) \ No newline at end of file From 829ace0365687abb0d5f368478e9e8fe0614c3aa Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Wed, 4 Feb 2015 16:42:54 -0800 Subject: [PATCH 05/14] fix a strange edge case on public portfolio pages --- views/account/show.jade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/views/account/show.jade b/views/account/show.jade index 36a8122d3d..2f4d8648a1 100644 --- a/views/account/show.jade +++ b/views/account/show.jade @@ -11,7 +11,10 @@ block content if picture img.img-center.img-responsive.public-profile-img(src=picture) else - img.img-center.img-responsive.public-profile-img(src='#{user.gravatar(200)}') + if (user) + img.img-center.img-responsive.public-profile-img(src='#{user.gravatar(200)}') + else + img.img-center.img-responsive.public-profile-img(src='https://gravatar.com/avatar/d704cc72a5cd0bfa482ee71f4d557daa?s=200&d=retro') h1.text-center.negative-5 - if (twitterHandle) a.ion-social-twitter.text-primary(title="@#{username}'s Twitter Profile", href="http://twitter.com/#{twitterHandle}", target='_blank') From 995ba0b9ede19b4eb8706dfeef34f11738504a32 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Thu, 5 Feb 2015 10:01:55 -0500 Subject: [PATCH 06/14] Fixed accessibility issue whereby completion button for bonfires was set to be hidden to screenreaders --- views/bonfire/show.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index 3fd59f5f69..ac6b5b25e3 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -123,7 +123,7 @@ block content span.ion-close-circled | Username not found - a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block.next-bonfire-button(name='_csrf', value=_csrf, aria-hidden='true', ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Take me to my next challenge + a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block.next-bonfire-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Take me to my next challenge - if (points && points > 2) From bccc37f55d98d7caf5d5c4cacf803a844068402f Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Thu, 5 Feb 2015 13:56:44 -0800 Subject: [PATCH 07/14] add more compliments and remove image validation from the profile image field --- controllers/resources.json | 26 ++++++++++++++++++++++++-- views/account/account.jade | 6 +----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/controllers/resources.json b/controllers/resources.json index fab538f2ff..8a9fae7e28 100644 --- a/controllers/resources.json +++ b/controllers/resources.json @@ -162,7 +162,7 @@ "compliments": [ "Over the top!", "Down the rabbit hole we go!", - "Somewhere over the rainbow!", + "Follow the white rabbit!", "Eye of the tiger!", "Run, Forest, run!", "Welcome to the Rock!", @@ -213,6 +213,7 @@ "It's alive. It's alive!", "Sonic Boom!", "Here's looking at you, Code!", + "Ride like the wind!", "The more you code!", "Legen - wait for it - dary!", "Ludicrous Speed! Go!", @@ -223,7 +224,28 @@ "By the power of Grayskull!", "You did it!", "Storm that castle!", - "Face-melting guitar Solo!" + "Face-melting guitar Solo!", + "Checkmate!", + "Remember the Alamo!", + "Bodacious!", + "You're the man now, dog!", + "Tubular!", + "You're outta sight!", + "Keep calm and code on!", + "Even sad panda smiles!", + "Even grumpy cat approves!", + "Koolaid Man says oh yeah!", + "Bullseye!", + "You stay classy, San Diego!", + "Loud noises!", + "Me want cookie!", + "Far out!", + "You're heating up!", + "Crash override!", + "This is Sparta!", + "You ARE the law!", + "Hasta la vista, challenge!", + "Huh? It's just a box...", ], "phrases": [ "Shout it from on top of a mountain", diff --git a/views/account/account.jade b/views/account/account.jade index 05d68eb9b0..08ba8b0ccd 100644 --- a/views/account/account.jade +++ b/views/account/account.jade @@ -77,15 +77,11 @@ block content .form-group label.col-sm-3.col-sm-offset-2.control-label(for='email') Link to Profile Photo (1:1 ratio) .col-sm-4 - input.form-control(type='url', name='picture', id='picture', ng-model='user.profile.picture', placeholder='http://www.example.com/image.jpg', ng-pattern="/[\.](jpg|png|jpeg|gif)\s?$/") + input.form-control(type='url', name='picture', id='picture', ng-model='user.profile.picture', placeholder='http://www.example.com/image.jpg') .col-sm-4.col-sm-offset-5(ng-show="profileForm.picture.$error.url && !profileForm.picture.$pristine") alert(type='danger') span.ion-close-circled | Please enter a valid URL format (http://www.example.com/image.jpg). - .col-sm-4.col-sm-offset-5(ng-show="profileForm.picture.$error.pattern") - alert(type='danger') - span.ion-close-circled - | The image URL must end in .jpg, .png, .jpeg or .gif. .form-group label.col-sm-3.col-sm-offset-2.control-label(for='bio') Bio (140 characters) .col-sm-4 From 2314ab91c2c0b6ac8cb7e62f0c6232b8db663017 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Thu, 5 Feb 2015 14:02:02 -0800 Subject: [PATCH 08/14] remove comma from resources that was haphazardly left there --- controllers/resources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/resources.json b/controllers/resources.json index 8a9fae7e28..66169ef785 100644 --- a/controllers/resources.json +++ b/controllers/resources.json @@ -245,7 +245,7 @@ "This is Sparta!", "You ARE the law!", "Hasta la vista, challenge!", - "Huh? It's just a box...", + "Huh? It's just a box..." ], "phrases": [ "Shout it from on top of a mountain", From fc3ae2a623169516fae5c133d8b05d5ff39e3ff4 Mon Sep 17 00:00:00 2001 From: Branden Byers Date: Thu, 5 Feb 2015 16:22:42 -0600 Subject: [PATCH 09/14] Fix typo in Bonfire Challenge Challenge id: a3566b1109230028080c9345 --- seed_data/bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index f9db0be523..831c9123d7 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -136,7 +136,7 @@ "name": "Sum All Numbers in a Range", "difficulty": "2.00", "description": [ - "We'll pass you an array of two numbers. Return the sum those two numbers and all numbers between them.", + "We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them.", "The lowest number will not always come first." ], "challengeEntryPoint": "sumAll([1, 4]);", From 3ef334ac6f1d1ccd558fa6ab9a7f4f41e348c795 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Thu, 5 Feb 2015 23:35:09 -0500 Subject: [PATCH 10/14] New bonfire challenges added --- seed_data/bonfires.json | 99 ++++++++++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 30 deletions(-) diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 831c9123d7..5fad31e466 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -149,9 +149,29 @@ "expect(sumAll([10, 5])).to.equal(45);" ] }, + { + "_id": "d5de63ebea8dbee56860f4f2", + "name": "Diff Two Arrays", + "difficulty": "2.01", + "description": [ + "Compare two arrays and return a new array with any items not found in both of the original arrays." + ], + "challengeEntryPoint": "diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);", + "challengeSeed": "function diff(arr1, arr2) {\n var newArr = [];\r\n // Same, same; but different.\r\n return newArr;\r\n}", + "tests": [ + "expect(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])).to.be.a('array');", + "assert.deepEqual(diff(['diorite', 'andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['pink wool'], 'arrays with only one difference');", + "assert.includeMembers(diff(['andesite', 'grass', 'dirt', 'pink wool', 'dead shrub'], ['diorite', 'andesite', 'grass', 'dirt', 'dead shrub']), ['diorite', 'pink wool'], 'arrays with more than one difference');", + "assert.deepEqual(diff(['andesite', 'grass', 'dirt', 'dead shrub'], ['andesite', 'grass', 'dirt', 'dead shrub']), [], 'arrays with no difference');", + "assert.deepEqual(diff([1, 2, 3, 5], [1, 2, 3, 4, 5]), [4], 'arrays with numbers');", + "assert.includeMembers(diff([1, 'calf', 3, 'piglet'], [1, 'calf', 3, 4]), ['piglet', 4], 'arrays with numbers and strings');", + "assert.deepEqual(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');" + ] + }, { "_id": "a5229172f011153519423690", "name": "Sum All Odd Fibonacci Numbers", + "difficulty": "2.09", "description": [ "Return the sum of all odd fibonacci numbers up to and including the passed number if it is a fibonacci number.", "The first few numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8, and each subsequent number is the sum of the previous two numbers.", @@ -202,10 +222,38 @@ "(smallestCommons([1,13])).should.equal(360360);" ] }, + { + "_id": "a2f1d72d9b908d0bd72bb9f6", + "name": "Make a Person", + "difficulty": "3.12", + "description": [ + "Fill in the object constructor with the methods specified in the tests.", + "Those methods are getFirstName(), getLastName(), getFullName(), setFirstName(), setLastName(), and setFullName().", + "These methods must be the only available means for interacting with the object.", + "There will be some linting errors on the tests, you may safely ignore them. You should see undefined in the console output." + ], + "challengeEntryPoint": "var bob = new Person('Bob Ross');", + "challengeSeed": "var Person = function(firstAndLast) {\n return firstAndLast;\r\n};", + "tests": [ + "expect(Object.keys(bob).length).to.eql(6);", + "expect(bob instanceof Person).to.be.true;", + "expect(bob.firstName).to.be.undefined();", + "expect(bob.lastName).to.be.undefined();", + "expect(bob.getFirstName()).to.eql('Bob');", + "expect(bob.getLastName()).to.eql('Ross');", + "expect(bob.getFullName()).to.eql('Bob Ross');", + "bob.setFirstName('Happy');", + "expect(bob.getFirstName()).to.eql('Happy');", + "bob.setLastName('Trees');", + "expect(bob.getLastName()).to.eql('Trees');", + "bob.setFullName('George Carlin');", + "expect(bob.getFullName()).to.eql('George Carlin');" + ] + }, { "_id" : "aff0395860f5d3034dc0bfc9", "name": "Validate US Telephone Numbers", - "difficulty": "3.10", + "difficulty": "4.01", "description": [ "Return true if the passed string is a valid US phone number", "The user may fill out the form field any way they choose as long as it is a valid US number. The following are all valid formats for US numbers:", @@ -239,10 +287,29 @@ "challengeSeed": "function telephoneCheck(str) {\n // Good luck!\n return true;\n}\n\n", "challengeEntryPoint": "telephoneCheck(\"555-555-5555\");" }, + { + "_id": "ca2e6f85cab2ab736c9a9b24", + "name": "Cash Register", + "difficulty": "4.02", + "description": [ + "Design a cash register drawer function that accepts purchase price as the first argument, payment as the second argument, and cash-in-drawer (cid) as the third argument. cid is a 2d array listing available currency. Return the string \"Insufficient Funds\" if change due is less than the cash-in-drawer. Return the string \"Closed\" if cash-in-drawer is equal to the change due. Otherwise, return change in coin and bills, sorted in highest to lowest order." + ], + "challengeEntryPoint": "drawer(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]]);", + "challengeSeed": "function drawer(price, cash, cid) {\n var change;\r\n // Here is your change, ma'am.\r\n return change;\r\n}\r\n\r\n// Example cash-in-drawer array:\r\n// [['PENNY', 1.01],\r\n// ['NICKEL', 2.05],\r\n// ['DIME', 3.10],\r\n// ['QUARTER', 4.25],\r\n// ['ONE', 90.00],\r\n// ['FIVE', 55.00],\r\n// ['TEN', 20.00],\r\n// ['TWENTY', 60.00],\r\n// ['ONE HUNDRED', 100.00]]", + "tests": [ + "expect(drawer(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]])).to.be.a('array');", + "expect(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", + "expect(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", + "assert.deepEqual(drawer(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]]), [['QUARTER', 0.50]], 'return correct change');", + "assert.deepEqual(drawer(3.26, 100.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]]), [['TWENTY', 80.00], ['TEN', 10.00], ['FIVE', 5], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');", + "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), 'Insufficient Funds', 'insufficient funds');", + "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), \"Closed\", 'cash-in-drawer equals change');" + ] + }, { "_id": "556138aff60341a09ed6c480", "name": "Inventory Update", - "difficulty": "3.11", + "difficulty": "4.03", "description": [ "Compare and update inventory stored in a 2d array against a second 2d array of a fresh delivery. Update current inventory item quantity, and if an item cannot be found, add the new item and quantity into the inventory array in alphabetical order." ], @@ -256,34 +323,6 @@ "assert.deepEqual(inventory([], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]);", "assert.deepEqual(inventory([[0, 'Bowling Ball'], [0, 'Dirty Sock'], [0, 'Hair pin'], [0, 'Microphone']], [[1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [1, 'Bowling Ball'], [1, 'Toothpaste']]), [[1, 'Bowling Ball'], [1, 'Dirty Sock'], [1, 'Hair pin'], [1, 'Half-Eaten Apple'], [1, 'Microphone'], [1, 'Toothpaste']]);" ] - }, - { - "_id": "a2f1d72d9b908d0bd72bb9f6", - "name": "Make a Person", - "difficulty": "3.12", - "description": [ - "Fill in the object constructor with the methods specified in the tests.", - "Those methods are getFirstName(), getLastName(), getFullName(), setFirstName(), setLastName(), and setFullName().", - "These methods must be the only available means for interacting with the object.", - "There will be some linting errors on the tests, you may safely ignore them. You should see undefined in the console output." - ], - "challengeEntryPoint": "var bob = new Person('Bob Ross');", - "challengeSeed": "var Person = function(firstAndLast) {\n return firstAndLast;\r\n};", - "tests": [ - "expect(Object.keys(bob).length).to.eql(6);", - "expect(bob instanceof Person).to.be.true;", - "expect(bob.firstName).to.be.undefined();", - "expect(bob.lastName).to.be.undefined();", - "expect(bob.getFirstName()).to.eql('Bob');", - "expect(bob.getLastName()).to.eql('Ross');", - "expect(bob.getFullName()).to.eql('Bob Ross');", - "bob.setFirstName('Happy');", - "expect(bob.getFirstName()).to.eql('Happy');", - "bob.setLastName('Trees');", - "expect(bob.getLastName()).to.eql('Trees');", - "bob.setFullName('George Carlin');", - "expect(bob.getFullName()).to.eql('George Carlin');" - ] } ] From dcb057a175bef4e78246482f0540f7d4cd127f71 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Fri, 6 Feb 2015 01:51:54 -0500 Subject: [PATCH 11/14] Fixing routing issue for unfound bonfires --- controllers/bonfire.js | 72 ++++++++++++++++------------------------- seed_data/bonfires.json | 2 +- views/bonfire/show.jade | 3 +- 3 files changed, 31 insertions(+), 46 deletions(-) diff --git a/controllers/bonfire.js b/controllers/bonfire.js index 980c98feb6..52c011062b 100644 --- a/controllers/bonfire.js +++ b/controllers/bonfire.js @@ -63,24 +63,6 @@ exports.returnNextBonfire = function(req, res, next) { nameString = bonfire[0].name.toLowerCase().replace(/\s/g, '-'); return res.redirect('/bonfires/' + nameString); - //res.render('bonfire/show', { - // completedWith: null, - // title: bonfire[bonfireNumber].name, - // name: bonfire[bonfireNumber].name, - // difficulty: +bonfire[bonfireNumber].difficulty, - // brief: bonfire[bonfireNumber].description[0], - // details: bonfire[bonfireNumber].description.slice(1), - // tests: bonfire[bonfireNumber].tests, - // challengeSeed: bonfire[bonfireNumber].challengeSeed, - // challengeEntryPoint: bonfire[bonfireNumber].challengeEntryPoint, - // cc: req.user ? req.user.bonfiresHash : undefined, - // points: req.user ? req.user.points : undefined, - // verb: resources.randomVerb(), - // phrase: resources.randomPhrase(), - // compliments: resources.randomCompliment(), - // bonfires: bonfire, - // bonfireHash: bonfire[bonfireNumber]._id - //}); }); }; @@ -94,37 +76,39 @@ exports.returnIndividualBonfire = function(req, res, next) { if (err) { next(err); } - var dashedNameFull = bonfire[bonfireNumber].name.toLowerCase().replace(/\s/g, '-'); - if (dashedNameFull != dashedName) { - return res.redirect('../bonfires/' + dashedNameFull); - } if (bonfire.length < 1) { req.flash('errors', { msg: "404: We couldn't find a bonfire with that name. Please double check the name." }); - return res.redirect('/bonfires/meet-bonfire') - } else { - res.render('bonfire/show', { - completedWith: null, - title: bonfire[bonfireNumber].name, - dashedName: dashedName, - name: bonfire[bonfireNumber].name, - difficulty: Math.floor(+bonfire[bonfireNumber].difficulty), - brief: bonfire[bonfireNumber].description[0], - details: bonfire[bonfireNumber].description.slice(1), - tests: bonfire[bonfireNumber].tests, - challengeSeed: bonfire[bonfireNumber].challengeSeed, - challengeEntryPoint: bonfire[bonfireNumber].challengeEntryPoint, - cc: !!req.user, - points: req.user ? req.user.points : undefined, - verb: resources.randomVerb(), - phrase: resources.randomPhrase(), - compliment: resources.randomCompliment(), - bonfires: bonfire, - bonfireHash: bonfire[bonfireNumber]._id - - }); + return res.redirect('/bonfires/meet-bonfire'); } + bonfire = bonfire.pop(); + var dashedNameFull = bonfire.name.toLowerCase().replace(/\s/g, '-'); + if (dashedNameFull != dashedName) { + return res.redirect('../bonfires/' + dashedNameFull); + } + + res.render('bonfire/show', { + completedWith: null, + title: bonfire.name, + dashedName: dashedName, + name: bonfire.name, + difficulty: Math.floor(+bonfire.difficulty), + brief: bonfire.description[0], + details: bonfire.description.slice(1), + tests: bonfire.tests, + challengeSeed: bonfire.challengeSeed, + challengeEntryPoint: bonfire.challengeEntryPoint, + cc: !!req.user, + points: req.user ? req.user.points : undefined, + verb: resources.randomVerb(), + phrase: resources.randomPhrase(), + compliment: resources.randomCompliment(), + bonfires: bonfire, + bonfireHash: bonfire._id + + }); + }); }; diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 5fad31e466..1cb19a6d30 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -1,7 +1,7 @@ [ { "_id" : "ad7123c8c441eddfaeb5bdef", - "name": "Meet Bonfire!", + "name": "Meet Bonfire", "difficulty": "0", "description": [ "Click the button below for further instructions.", diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index 992574169e..f5c90a2c6c 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -138,4 +138,5 @@ block content .modal-header.challenge-list-header Bonfires a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × .modal-body - include ../partials/bonfires + // + include ../partials/bonfires From ca26c38cc7fcfd060dbc1e72cd5bd20682731ce3 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Fri, 6 Feb 2015 01:54:23 -0500 Subject: [PATCH 12/14] Adding forever --- Procfile | 1 + package.json | 1 + 2 files changed, 2 insertions(+) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000000..7769836542 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: ./node_modules/.bin/forever -m 5 server.js \ No newline at end of file diff --git a/package.json b/package.json index 0c40e74a12..25bbaff7d8 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "express-flash": "^0.0.2", "express-session": "^1.9.2", "express-validator": "^2.8.0", + "forever": "^0.14.1", "github-api": "^0.7.0", "helmet": "^0.5.3", "jade": "^1.8.0", From 6b80460556aea6cceccd4478b72add557937721b Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Fri, 6 Feb 2015 01:59:43 -0500 Subject: [PATCH 13/14] Changing forever script to correctly target app.js --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 7769836542..6e36002829 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: ./node_modules/.bin/forever -m 5 server.js \ No newline at end of file +web: ./node_modules/.bin/forever -m 5 app.js \ No newline at end of file From a487e8c7ddc0102e9439988c50b73230b37f030a Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Fri, 6 Feb 2015 02:01:38 -0500 Subject: [PATCH 14/14] Adding postinstall tasks --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25bbaff7d8..430ab67139 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "scripts": { "start": "node app.js", "test": "mocha", - "prepublish": "node seed_data/seed.js" + "postinstall": "node seed_data/seed.js" }, "dependencies": { "async": "^0.9.0",