diff --git a/Fundamentals 5/caesar/caesar.js b/Fundamentals 5/caesar/caesar.js index f4d6a25..35d82a5 100644 --- a/Fundamentals 5/caesar/caesar.js +++ b/Fundamentals 5/caesar/caesar.js @@ -1,5 +1,30 @@ -const caesar = function() { +const caesar = function (userInput, shiftNumber) { + let result = ""; -} + for (let i = 0; i < userInput.length; i++) { + // check if shiftNumber is a negative number + if (shiftNumber < 0) { + shiftNumber = 26 + (shiftNumber % 26); + } -module.exports = caesar + // Uppercase letters + if (userInput.charCodeAt(i) >= 65 && userInput.charCodeAt(i) <= 90) { + const charCode = userInput.charCodeAt(i); + result += String.fromCharCode(((charCode - 65 + shiftNumber) % 26) + 65); + + // Lowercase letters + } else if (userInput.charCodeAt(i) >= 97 && userInput.charCodeAt(i) <= 122) { + const charCode = userInput.charCodeAt(i); + result += String.fromCharCode(((charCode - 97 + shiftNumber) % 26) + 97); + + // if it's not a letter + } else { + result += userInput.charAt(i); + } + } + + return result; + +}; + +module.exports = caesar; diff --git a/Fundamentals 5/caesar/caesar.spec.js b/Fundamentals 5/caesar/caesar.spec.js index 49fe254..c4052cd 100644 --- a/Fundamentals 5/caesar/caesar.spec.js +++ b/Fundamentals 5/caesar/caesar.spec.js @@ -4,22 +4,22 @@ describe('caesar', function() { it('works with single letters', function() { expect(caesar('A', 1)).toEqual('B'); }); - xit('works with words', function() { + it('works with words', function() { expect(caesar('Aaa', 1)).toEqual('Bbb'); }); - xit('works with phrases', function() { + it('works with phrases', function() { expect(caesar('Hello, World!', 5)).toEqual('Mjqqt, Btwqi!'); }); - xit('works with negative shift', function() { + it('works with negative shift', function() { expect(caesar('Mjqqt, Btwqi!', -5)).toEqual('Hello, World!'); }); - xit('wraps', function() { + it('wraps', function() { expect(caesar('Z', 1)).toEqual('A'); }); - xit('works with large shift factors', function() { + it('works with large shift factors', function() { expect(caesar('Hello, World!', 75)).toEqual('Ebiil, Tloia!'); }); - xit('works with large negative shift factors', function() { + it('works with large negative shift factors', function() { expect(caesar('Hello, World!', -29)).toEqual('Ebiil, Tloia!'); }); }); diff --git a/Fundamentals 5/calculator/calculator.js b/Fundamentals 5/calculator/calculator.js index 2d904a8..0f452c8 100644 --- a/Fundamentals 5/calculator/calculator.js +++ b/Fundamentals 5/calculator/calculator.js @@ -1,25 +1,35 @@ -function add () { - +function add (a, b) { + return a + b; } -function subtract () { - +function subtract (a, b) { + return a - b; } -function sum () { - +function sum (array) { + return array.reduce((total, num) => { + return total + num; + }, 0); } -function multiply () { - +function multiply (array) { + return array.reduce((total, num) => { + return total * num; + }, 1); } -function power() { - +function power(a, b) { + return a ** b; } -function factorial() { - +function factorial(n) { + if (n === 0 || n === 1) { + return 1; + } + for (let i = n-1; i >= 1; i--) { + n *= i; + } + return n; } module.exports = { diff --git a/Fundamentals 5/calculator/calculator.spec.js b/Fundamentals 5/calculator/calculator.spec.js index 150a0aa..c1bdb94 100644 --- a/Fundamentals 5/calculator/calculator.spec.js +++ b/Fundamentals 5/calculator/calculator.spec.js @@ -5,73 +5,73 @@ describe('add', function() { expect(calculator.add(0,0)).toEqual(0); }); - xit('adds 2 and 2', function() { + it('adds 2 and 2', function() { expect(calculator.add(2,2)).toEqual(4); }); - xit('adds positive numbers', function() { + it('adds positive numbers', function() { expect(calculator.add(2,6)).toEqual(8); }); }); describe('subtract', function() { - xit('subtracts numbers', function() { + it('subtracts numbers', function() { expect(calculator.subtract(10,4)).toEqual(6); }); }); describe('sum', function() { - xit('computes the sum of an empty array', function() { + it('computes the sum of an empty array', function() { expect(calculator.sum([])).toEqual(0); }); - xit('computes the sum of an array of one number', function() { + it('computes the sum of an array of one number', function() { expect(calculator.sum([7])).toEqual(7); }); - xit('computes the sum of an array of two numbers', function() { + it('computes the sum of an array of two numbers', function() { expect(calculator.sum([7,11])).toEqual(18); }); - xit('computes the sum of an array of many numbers', function() { + it('computes the sum of an array of many numbers', function() { expect(calculator.sum([1,3,5,7,9])).toEqual(25); }); }); describe('multiply', function() { - xit('multiplies two numbers', function() { + it('multiplies two numbers', function() { expect(calculator.multiply([2,4])).toEqual(8); }); - xit('multiplies several numbers', function() { + it('multiplies several numbers', function() { expect(calculator.multiply([2,4,6,8,10,12,14])).toEqual(645120); }); }); describe('power', function() { - xit('raises one number to the power of another number', function() { + it('raises one number to the power of another number', function() { expect(calculator.power(4,3)).toEqual(64); // 4 to third power is 64 }); }); describe('factorial', function() { - xit('computes the factorial of 0', function() { + it('computes the factorial of 0', function() { expect(calculator.factorial(0)).toEqual(1); // 0! = 1 }); - xit('computes the factorial of 1', function() { + it('computes the factorial of 1', function() { expect(calculator.factorial(1)).toEqual(1); }); - xit('computes the factorial of 2', function() { + it('computes the factorial of 2', function() { expect(calculator.factorial(2)).toEqual(2); }); - xit('computes the factorial of 5', function() { + it('computes the factorial of 5', function() { expect(calculator.factorial(5)).toEqual(120); }); - xit('computes the factorial of 10', function() { + it('computes the factorial of 10', function() { expect(calculator.factorial(10)).toEqual(3628800); }); }); diff --git a/Fundamentals 5/fibonacci/fibonacci.js b/Fundamentals 5/fibonacci/fibonacci.js index fd597f9..d5ad1e6 100644 --- a/Fundamentals 5/fibonacci/fibonacci.js +++ b/Fundamentals 5/fibonacci/fibonacci.js @@ -1,5 +1,14 @@ -const fibonacci = function() { - +const fibonacci = function(n) { + let array = [0, 1]; + + if (n > 0) { + for (let i = 2; i < n+1; i++) { + array.push(array[i-2] + array[i-1]); + } + return array[n]; + } else { + return "OOPS"; + } } module.exports = fibonacci diff --git a/Fundamentals 5/fibonacci/fibonacci.spec.js b/Fundamentals 5/fibonacci/fibonacci.spec.js index cafe796..9f9d19d 100644 --- a/Fundamentals 5/fibonacci/fibonacci.spec.js +++ b/Fundamentals 5/fibonacci/fibonacci.spec.js @@ -4,28 +4,28 @@ describe('fibonacci', function() { it('works', function() { expect(fibonacci(4)).toEqual(3); }); - xit('works', function() { + it('works', function() { expect(fibonacci(6)).toEqual(8); }); - xit('works', function() { + it('works', function() { expect(fibonacci(10)).toEqual(55); }); - xit('works', function() { + it('works', function() { expect(fibonacci(15)).toEqual(610); }); - xit('works', function() { + it('works', function() { expect(fibonacci(25)).toEqual(75025); }); - xit('doesn\'t accept negatives', function() { + it('doesn\'t accept negatives', function() { expect(fibonacci(-25)).toEqual("OOPS"); }); - xit('DOES accept strings', function() { + it('DOES accept strings', function() { expect(fibonacci("1")).toEqual(1); }); - xit('DOES accept strings', function() { + it('DOES accept strings', function() { expect(fibonacci("2")).toEqual(1); }); - xit('DOES accept strings', function() { + it('DOES accept strings', function() { expect(fibonacci("8")).toEqual(21); }); }); diff --git a/Fundamentals 5/findTheOldest/findTheOldest.js b/Fundamentals 5/findTheOldest/findTheOldest.js index 8094505..2163cb9 100644 --- a/Fundamentals 5/findTheOldest/findTheOldest.js +++ b/Fundamentals 5/findTheOldest/findTheOldest.js @@ -1,5 +1,8 @@ -let findTheOldest = function() { - +let findTheOldest = function(array) { + array.sort((a, b) => { + return a.yearOfBirth - b.yearOfBirth; + }); + return array[0]; } module.exports = findTheOldest diff --git a/Fundamentals 5/getTheTitles/getTheTitles.js b/Fundamentals 5/getTheTitles/getTheTitles.js index 2b52aa0..4b76837 100644 --- a/Fundamentals 5/getTheTitles/getTheTitles.js +++ b/Fundamentals 5/getTheTitles/getTheTitles.js @@ -1,5 +1,8 @@ -const getTheTitles = function() { - +const getTheTitles = function(array) { + const result = array.map(element => { + return element.title; + }) + return result; } -module.exports = getTheTitles; +module.exports = getTheTitles; \ No newline at end of file diff --git a/Fundamentals 5/palindromes/palindromes.js b/Fundamentals 5/palindromes/palindromes.js index ccfda4b..0cb9cfc 100644 --- a/Fundamentals 5/palindromes/palindromes.js +++ b/Fundamentals 5/palindromes/palindromes.js @@ -1,5 +1,9 @@ -const palindromes = function() { +const palindromes = function(str) { + const punctuation = /[^A-Za-z0-9]/g; + const strLowNoPunct = str.toLowerCase().replace(punctuation, ""); + const strReversed = strLowNoPunct.split('').reverse().join(''); + return strLowNoPunct === strReversed; } module.exports = palindromes diff --git a/Fundamentals 5/palindromes/palindromes.spec.js b/Fundamentals 5/palindromes/palindromes.spec.js index 2588cf2..0ca36cd 100644 --- a/Fundamentals 5/palindromes/palindromes.spec.js +++ b/Fundamentals 5/palindromes/palindromes.spec.js @@ -4,19 +4,19 @@ describe('palindromes', function() { it('works with single words', function() { expect(palindromes('racecar')).toEqual(true); }); - xit('works with punctuation ', function() { + it('works with punctuation ', function() { expect(palindromes('racecar!')).toEqual(true); }); - xit('works with upper-case letters ', function() { + it('works with upper-case letters ', function() { expect(palindromes('Racecar!')).toEqual(true); }); - xit('works with multiple words', function() { + it('works with multiple words', function() { expect(palindromes('A car, a man, a maraca.')).toEqual(true); }); - xit('works with multiple words', function() { + it('works with multiple words', function() { expect(palindromes('Animal loots foliated detail of stool lamina.')).toEqual(true); }); - xit('doesn\'t just always return true', function() { + it('doesn\'t just always return true', function() { expect(palindromes('ZZZZ car, a man, a maraca.')).toEqual(false); }); diff --git a/Pricing Plans/Individual A/Pricing-Plans--Boozt.jpg b/Pricing Plans/Individual A/Pricing-Plans--Boozt.jpg deleted file mode 100644 index bd74326..0000000 Binary files a/Pricing Plans/Individual A/Pricing-Plans--Boozt.jpg and /dev/null differ diff --git a/Pricing Plans/Individual B/Pricing-Plans--Minimal.png b/Pricing Plans/Individual B/Pricing-Plans--Minimal.png deleted file mode 100644 index 60ef1ad..0000000 Binary files a/Pricing Plans/Individual B/Pricing-Plans--Minimal.png and /dev/null differ diff --git a/Pricing Plans/Individual C/Pricing-Plans--Subscription.jpg b/Pricing Plans/Individual C/Pricing-Plans--Subscription.jpg deleted file mode 100644 index cf2706a..0000000 Binary files a/Pricing Plans/Individual C/Pricing-Plans--Subscription.jpg and /dev/null differ diff --git a/Pricing Plans/Individual D/Pricing-Plans--ZenDesk.jpg b/Pricing Plans/Individual D/Pricing-Plans--ZenDesk.jpg deleted file mode 100644 index 9d8f29b..0000000 Binary files a/Pricing Plans/Individual D/Pricing-Plans--ZenDesk.jpg and /dev/null differ diff --git a/Pricing Plans/Mockup-to-HTML.jpg b/Pricing Plans/Mockup-to-HTML.jpg deleted file mode 100644 index 821a011..0000000 Binary files a/Pricing Plans/Mockup-to-HTML.jpg and /dev/null differ diff --git a/Pricing Plans/Mockup.jpg b/Pricing Plans/Mockup.jpg deleted file mode 100644 index 0cd4dec..0000000 Binary files a/Pricing Plans/Mockup.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Basic-02.jpg b/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Basic-02.jpg deleted file mode 100644 index 27eaf16..0000000 Binary files a/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Basic-02.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Pro-03.jpg b/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Pro-03.jpg deleted file mode 100644 index a2797fd..0000000 Binary files a/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Pro-03.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Starter-01.jpg b/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Starter-01.jpg deleted file mode 100644 index 2684227..0000000 Binary files a/Pricing Plans/Pricing Plans A/Pricing-Plans--A--Starter-01.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans A/Pricing-Plans--A.jpg b/Pricing Plans/Pricing Plans A/Pricing-Plans--A.jpg deleted file mode 100644 index f00fe8e..0000000 Binary files a/Pricing Plans/Pricing Plans A/Pricing-Plans--A.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Basic-01.jpg b/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Basic-01.jpg deleted file mode 100644 index 4854af8..0000000 Binary files a/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Basic-01.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Business-03.psd b/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Business-03.psd deleted file mode 100644 index 48c56ef..0000000 Binary files a/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Business-03.psd and /dev/null differ diff --git a/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Pro-02.jpg b/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Pro-02.jpg deleted file mode 100644 index a6e1400..0000000 Binary files a/Pricing Plans/Pricing Plans B/Pricing-Plans--B--Pro-02.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans B/Pricing-Plans--B.jpg b/Pricing Plans/Pricing Plans B/Pricing-Plans--B.jpg deleted file mode 100644 index d73c879..0000000 Binary files a/Pricing Plans/Pricing Plans B/Pricing-Plans--B.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Advanced-02.jpg b/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Advanced-02.jpg deleted file mode 100644 index 61cc7e2..0000000 Binary files a/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Advanced-02.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Business-03.jpg b/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Business-03.jpg deleted file mode 100644 index a5686b1..0000000 Binary files a/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Business-03.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Personal-01.jpg b/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Personal-01.jpg deleted file mode 100644 index a7448ec..0000000 Binary files a/Pricing Plans/Pricing Plans C/Pricing-Plans--C--Personal-01.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans C/Pricing-Plans--C.jpg b/Pricing Plans/Pricing Plans C/Pricing-Plans--C.jpg deleted file mode 100644 index f33fddb..0000000 Binary files a/Pricing Plans/Pricing Plans C/Pricing-Plans--C.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Business-03.jpg b/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Business-03.jpg deleted file mode 100644 index 2be4e82..0000000 Binary files a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Business-03.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Enterprise-04.jpg b/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Enterprise-04.jpg deleted file mode 100644 index 0fac90d..0000000 Binary files a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Enterprise-04.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Starter-01.jpg b/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Starter-01.jpg deleted file mode 100644 index ed78e69..0000000 Binary files a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Starter-01.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Team-02.jpg b/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Team-02.jpg deleted file mode 100644 index efedb35..0000000 Binary files a/Pricing Plans/Pricing Plans D/Pricing-Plans--D--Team-02.jpg and /dev/null differ diff --git a/Pricing Plans/Pricing Plans D/Pricing-Plans--D.png b/Pricing Plans/Pricing Plans D/Pricing-Plans--D.png deleted file mode 100644 index 6bfbb92..0000000 Binary files a/Pricing Plans/Pricing Plans D/Pricing-Plans--D.png and /dev/null differ diff --git a/Pricing Plans/README.md b/Pricing Plans/README.md deleted file mode 100644 index 5811311..0000000 --- a/Pricing Plans/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# CSS-Exercise-Recreate-PowerUps - -Practice HTML and CSS by recreating real-life websites - Power Ups! - -### Learning Objectives - -- Loading Google Fonts -- Using form and the input radio element -- Using Flexbox -- Using media queries -- Centering block elements using margin: 0 auto; -- Transitions -- CSS: box-shadow, border-radius, etc. - -## Description - -Recreate the following Pricing Plans mockup using HTML and CSS: - -![](Mockup.jpg) - -![](Mockup-to-HTML.jpg) - -1) Group Assignment: Work with your team to recreate a pricing plan (choose A, B, C or D from the `Pricing Plan` folders). - -2) Individual Assignment: Pick one pricing plan section from the `Individual` folders and try to recreate it on your own. Ask for help, but NOT for code! - -> MAKE SURE TO CHECK YOUR CODE THROUGH W3C VALIDATOR AND CHROME'S LIGHTHOUSE AUDITING TOOL (CHECK FOR A11y, SEO, BEST PRACTICES SCORES). - -Good luck! - -:movie_camera: Today's recordings of the Live session - -Part I: https://www.youtube.com/watch?v=rJTvhQem1PU&list=PLwnRAxFwLPiDItr-uRuy0UL-ouNsNv5Y2&index=19 -Part II: https://www.youtube.com/watch?v=qiGZVbbGZpA&list=PLwnRAxFwLPiDItr-uRuy0UL-ouNsNv5Y2&index=20 -Session Notes: https://docs.google.com/document/d/1zPmYNDAM7YSgiTOtp6hRSttR6nDEFd-oiSc-defe9NY/edit?usp=sharing - diff --git a/Pricing Plans/images/Builder-Widgets-Pro.jpg b/Pricing Plans/images/Builder-Widgets-Pro.jpg deleted file mode 100644 index 57fdfd6..0000000 Binary files a/Pricing Plans/images/Builder-Widgets-Pro.jpg and /dev/null differ diff --git a/Pricing Plans/images/Site-Shield-Standard.jpg b/Pricing Plans/images/Site-Shield-Standard.jpg deleted file mode 100644 index 2ae48e3..0000000 Binary files a/Pricing Plans/images/Site-Shield-Standard.jpg and /dev/null differ diff --git a/Pricing Plans/images/Theme-Setup-Service.jpg b/Pricing Plans/images/Theme-Setup-Service.jpg deleted file mode 100644 index 87daf98..0000000 Binary files a/Pricing Plans/images/Theme-Setup-Service.jpg and /dev/null differ diff --git a/Pricing Plans/live-session-code.html b/Pricing Plans/live-session-code.html deleted file mode 100644 index 9b32f20..0000000 --- a/Pricing Plans/live-session-code.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - Power Ups! - - - -
-
-

Consider These Power-ups!

-
-
-
- site shield standard plan -

Site Shield Standard

-

$59.00/mo

-

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Laudantium harum, beatae consequatur dicta non cumque! Exercitationem numquam quod velit, mollitia facere, corrupti reiciendis est expedita, maxime sapiente cupiditate fugit natus.

- -
-
- builder widgets pro plan -

Builder Widget Pro

-

$59.00/mo

-

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Laudantium harum, beatae consequatur dicta non cumque! Exercitationem numquam quod velit, mollitia facere, corrupti reiciendis est expedita, maxime sapiente cupiditate fugit natus.

- -
-
- theme setup plan -

Theme Setup Service

-

$59.00/mo

-

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Laudantium harum, beatae consequatur dicta non cumque! Exercitationem numquam quod velit, mollitia facere, corrupti reiciendis est expedita, maxime sapiente cupiditate fugit natus.

- -
-
- -
- - - \ No newline at end of file diff --git a/Pricing Plans/solution.html b/Pricing Plans/solution.html deleted file mode 100644 index 7f60a02..0000000 --- a/Pricing Plans/solution.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - Power-ups! - - - - - -

Consider These Power-Ups!

-
-
- -

SITE SHIELD STANDARD

-

$59.00/mo

-

We'll provide your WordPress site with virus/malware protection, daily backups, updates, maintenance, and customization, then send you a monthly report. Let us manage your site, so you don't have to. It's like insurance - for your website.

- -
-
- -

BUILDER WIDGETS PRO

-

The Organic solution to complicated page builders! Organic Builder Widgets uses 16 premium widgets and the native customizer interface to build dynamic pages. It's simple, fast and beautifully designed.

-
-

- - -
- - -

-
- -
-
- -

THEME SETUP SERVICE

-

$299.00

-

We will install WordPress, your new Organic Theme, essential plugins and demo content. In addition, we will setup the theme options, spam protection, add your logo and a custom background - saving you potentially hours of work!

- -
-
- - - \ No newline at end of file