From 759cc3cc8667db63f999c88dd8734cca688c82a7 Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Tue, 15 Dec 2020 18:46:44 -0600 Subject: [PATCH 01/12] day 0 HTML basics --- src/week1/day0/expenses_list.html | 34 +++++++++++++++++++++++++++++++ src/week1/day0/media_content.html | 22 ++++++++++++++++++++ src/week1/day0/todo_list.html | 16 +++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 src/week1/day0/expenses_list.html create mode 100644 src/week1/day0/media_content.html create mode 100644 src/week1/day0/todo_list.html diff --git a/src/week1/day0/expenses_list.html b/src/week1/day0/expenses_list.html new file mode 100644 index 0000000..b622f6b --- /dev/null +++ b/src/week1/day0/expenses_list.html @@ -0,0 +1,34 @@ + + + + + + Expenses list + + + + + + + + + + + + + + + + + + + + + + + + + +
#descriptionquantity$
1.........
2.........
+ + diff --git a/src/week1/day0/media_content.html b/src/week1/day0/media_content.html new file mode 100644 index 0000000..0d47bbd --- /dev/null +++ b/src/week1/day0/media_content.html @@ -0,0 +1,22 @@ + + + + + + Media content + + + +
+ pink flamingo +
+ + + diff --git a/src/week1/day0/todo_list.html b/src/week1/day0/todo_list.html new file mode 100644 index 0000000..c495c0c --- /dev/null +++ b/src/week1/day0/todo_list.html @@ -0,0 +1,16 @@ + + + + + + My todo list + + + + + From 7d6807783078d84b0fce12b514615b98308f9c52 Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Sat, 26 Dec 2020 22:22:46 -0600 Subject: [PATCH 02/12] css classes --- src/week1/day0/css_basics/css/normalize.css | 351 ++++++++++++++++++ src/week1/day0/css_basics/css/style.css | 57 +++ src/week1/day0/css_basics/index.html | 23 ++ .../day0/{ => html_basics}/expenses_list.html | 0 .../day0/{ => html_basics}/media_content.html | 0 .../day0/{ => html_basics}/todo_list.html | 0 6 files changed, 431 insertions(+) create mode 100644 src/week1/day0/css_basics/css/normalize.css create mode 100644 src/week1/day0/css_basics/css/style.css create mode 100644 src/week1/day0/css_basics/index.html rename src/week1/day0/{ => html_basics}/expenses_list.html (100%) rename src/week1/day0/{ => html_basics}/media_content.html (100%) rename src/week1/day0/{ => html_basics}/todo_list.html (100%) diff --git a/src/week1/day0/css_basics/css/normalize.css b/src/week1/day0/css_basics/css/normalize.css new file mode 100644 index 0000000..e1348b6 --- /dev/null +++ b/src/week1/day0/css_basics/css/normalize.css @@ -0,0 +1,351 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { + /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { + /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type='button'], +[type='reset'], +[type='submit'] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type='button']::-moz-focus-inner, +[type='reset']::-moz-focus-inner, +[type='submit']::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type='button']:-moz-focusring, +[type='reset']:-moz-focusring, +[type='submit']:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type='checkbox'], +[type='radio'] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type='number']::-webkit-inner-spin-button, +[type='number']::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type='search'] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type='search']::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/src/week1/day0/css_basics/css/style.css b/src/week1/day0/css_basics/css/style.css new file mode 100644 index 0000000..daf6c94 --- /dev/null +++ b/src/week1/day0/css_basics/css/style.css @@ -0,0 +1,57 @@ +header { + background-color: aqua; +} + +footer { + background-color: burlywood; +} + +aside { + background-color: cornflowerblue; +} + +nav { + background-color: darkgrey; +} + +* { + font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; + font-size: 14px; +} + +header, +footer { + text-align: center; +} + +.header { + font-size: 46px; +} + +.footer { + font-size: 10px; +} + +.content { + font-size: 14px; +} + +.navigation { + font-size: 12px; +} + +.sidebar { + font-size: 10px; +} + +*[class$='r'] { + background-color: magenta; +} + +*[class*='a']:not(*[class$='r']) { + background-color: blue; +} + +.oh-no-inline-styles { + background-color: green !important; +} diff --git a/src/week1/day0/css_basics/index.html b/src/week1/day0/css_basics/index.html new file mode 100644 index 0000000..27ad17c --- /dev/null +++ b/src/week1/day0/css_basics/index.html @@ -0,0 +1,23 @@ + + + + + + CSS Basics + + + + + + +
header
+ +
+ section +
header
+
article
+
footer
+
+ + + diff --git a/src/week1/day0/expenses_list.html b/src/week1/day0/html_basics/expenses_list.html similarity index 100% rename from src/week1/day0/expenses_list.html rename to src/week1/day0/html_basics/expenses_list.html diff --git a/src/week1/day0/media_content.html b/src/week1/day0/html_basics/media_content.html similarity index 100% rename from src/week1/day0/media_content.html rename to src/week1/day0/html_basics/media_content.html diff --git a/src/week1/day0/todo_list.html b/src/week1/day0/html_basics/todo_list.html similarity index 100% rename from src/week1/day0/todo_list.html rename to src/week1/day0/html_basics/todo_list.html From 77a61421ffc67b13faf9cf515023bb66b9681fe3 Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Sun, 27 Dec 2020 22:30:43 -0600 Subject: [PATCH 03/12] css layout --- src/week1/day0/css_basics/css/style.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/week1/day0/css_basics/css/style.css b/src/week1/day0/css_basics/css/style.css index daf6c94..da3d158 100644 --- a/src/week1/day0/css_basics/css/style.css +++ b/src/week1/day0/css_basics/css/style.css @@ -26,6 +26,7 @@ footer { .header { font-size: 46px; + height: 50px; } .footer { @@ -34,14 +35,22 @@ footer { .content { font-size: 14px; + margin-left: 400px; + margin-right: 400px; } .navigation { font-size: 12px; + position: absolute; + width: 400px; } .sidebar { font-size: 10px; + position: absolute; + right: 0; + top: 50px; + width: 400px; } *[class$='r'] { From 5a29ec0554bd69bfdf445206c2a925682954362b Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Wed, 30 Dec 2020 00:20:35 -0600 Subject: [PATCH 04/12] final practice using html and css --- .../html_css_practice/css/grid-layout.css | 71 ++++ .../day0/html_css_practice/css/normalize.css | 351 ++++++++++++++++++ .../day0/html_css_practice/css/style.css | 15 + src/week1/day0/html_css_practice/galery.html | 81 ++++ 4 files changed, 518 insertions(+) create mode 100644 src/week1/day0/html_css_practice/css/grid-layout.css create mode 100644 src/week1/day0/html_css_practice/css/normalize.css create mode 100644 src/week1/day0/html_css_practice/css/style.css create mode 100644 src/week1/day0/html_css_practice/galery.html diff --git a/src/week1/day0/html_css_practice/css/grid-layout.css b/src/week1/day0/html_css_practice/css/grid-layout.css new file mode 100644 index 0000000..51294a1 --- /dev/null +++ b/src/week1/day0/html_css_practice/css/grid-layout.css @@ -0,0 +1,71 @@ +/* --- layout --- */ +/* based in http://adamkaplan.me/grid/ */ + +/* small screen (default)*/ +html { + font-size: 100%; +} + +/* medium screen (640px) */ +@media (min-width: 40rem) { + html { + font-size: 112%; + } +} + +/* large screen (1024px) */ +@media (min-width: 64rem) { + html { + font-size: 120%; + } +} + +*, +*::before, +*::after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +.container { + margin: 0 auto; + max-width: 48rem; + width: 90%; +} + +.clearfix::before, +.clearfix::after { + content: ' '; + display: table; +} + +.clearfix::after { + clear: both; +} + +.clearfix { + *zoom: 1; +} + +.column { + float: left; + padding-left: 1rem; + padding-right: 1rem; +} + +.column .full { + width: 100%; +} + +.column .fourth { + width: 25%; +} + +.column .tree-fourth { + width: 75%; +} + +.column .third { + width: 33.3%; +} diff --git a/src/week1/day0/html_css_practice/css/normalize.css b/src/week1/day0/html_css_practice/css/normalize.css new file mode 100644 index 0000000..e1348b6 --- /dev/null +++ b/src/week1/day0/html_css_practice/css/normalize.css @@ -0,0 +1,351 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { + /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { + /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type='button'], +[type='reset'], +[type='submit'] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type='button']::-moz-focus-inner, +[type='reset']::-moz-focus-inner, +[type='submit']::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type='button']:-moz-focusring, +[type='reset']:-moz-focusring, +[type='submit']:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type='checkbox'], +[type='radio'] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type='number']::-webkit-inner-spin-button, +[type='number']::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type='search'] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type='search']::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/src/week1/day0/html_css_practice/css/style.css b/src/week1/day0/html_css_practice/css/style.css new file mode 100644 index 0000000..5c61e80 --- /dev/null +++ b/src/week1/day0/html_css_practice/css/style.css @@ -0,0 +1,15 @@ +.description_wrap { + visibility: hidden; +} + +.img_wrap:hover .description_wrap { + visibility: visible; +} + +.description_wrap img { + opacity: 26%; +} + +.description { + position: absolute; +} diff --git a/src/week1/day0/html_css_practice/galery.html b/src/week1/day0/html_css_practice/galery.html new file mode 100644 index 0000000..94a30bf --- /dev/null +++ b/src/week1/day0/html_css_practice/galery.html @@ -0,0 +1,81 @@ + + + + + + + + + + Galery for practice + + +
+
+
Pictures
+
+ Lorem ipsum dolor sit amet consectetur, adipisicing elit. Labore iusto laborum ut temporibus omnis, deserunt + debitis aliquid iste fugiat accusantium eum porro architecto ea dolorum quas, velit quam officia assumenda. +
+
+
+
+
+
+

description 1

+ Museum +
+ Ready to work +
+
+
+
+
+

description 2

+ Cow +
+ Peaceful sea +
+
+
+
+
+

description 3

+ Flying fish +
+ Green grass +
+
+
+
+
+
+
+

description 4

+ Fresh plants +
+ Book +
+
+
+
+
+

description 5

+ Sky +
+ Mountains +
+
+
+
+
+

description 6

+ Forest +
+ desert plants +
+
+
+
+ + From 82c8118b69b1d54acf20fe17291a8796db867c96 Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Fri, 1 Jan 2021 16:10:33 -0600 Subject: [PATCH 05/12] exercises javascript chapter 2 --- src/week1/days2-5/chapter2/excercises_c2.js | 47 +++++++++++++++++++++ src/week1/days2-5/chapter2/test_c2.html | 11 +++++ 2 files changed, 58 insertions(+) create mode 100644 src/week1/days2-5/chapter2/excercises_c2.js create mode 100644 src/week1/days2-5/chapter2/test_c2.html diff --git a/src/week1/days2-5/chapter2/excercises_c2.js b/src/week1/days2-5/chapter2/excercises_c2.js new file mode 100644 index 0000000..6b50b95 --- /dev/null +++ b/src/week1/days2-5/chapter2/excercises_c2.js @@ -0,0 +1,47 @@ +// looping triangle +console.log("looping triangle"); +let figure = ""; +for (let cont = 0; cont < 7; cont++) { + figure += "#"; + console.log(figure); +} + +// print numbers +console.log("print numbers, Fizz, Buzz, FizzBuzz"); +for (let cont = 1; cont <= 100; cont++) { + if (cont % 3 == 0) { + console.log(cont, " - Fizz"); + } else if (cont % 5 == 0) { + console.log(cont, " - Buzz"); + } if (cont % 3 == 0 && cont % 5 == 0) { + console.log(cont, " - FizzBuzz"); + } else { + console.log(cont); + } +} + +console.log("chessboard 8x8"); +let chessLine = "# # # # # # # #" +for (let cont = 0; cont < 8; cont++) { + if (cont % 2 != 0){ + console.log(" ", chessLine); + } else { + console.log(chessLine); + } +} + +console.log("chessboard size"); +let chessSize = 10; +let colChar = ""; +for (let line = 0; line < chessSize; line++) { + let chessLine = ""; + for (let col = 0; col < chessSize; col++) { + chessLine += colChar + "# "; + } + if (line % 2 != 0){ + chessLine = " " + chessLine + } else { + chessLine = "" + chessLine + } + console.log(chessLine); +} \ No newline at end of file diff --git a/src/week1/days2-5/chapter2/test_c2.html b/src/week1/days2-5/chapter2/test_c2.html new file mode 100644 index 0000000..43e2e8f --- /dev/null +++ b/src/week1/days2-5/chapter2/test_c2.html @@ -0,0 +1,11 @@ + + + + + + + + test js + + + From bb848555e57d450e6094ad19dca7835b52279e8c Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Fri, 1 Jan 2021 19:19:03 -0600 Subject: [PATCH 06/12] exercises chapter 3 --- src/week1/days2-5/chapter2/test_c2.html | 2 +- src/week1/days2-5/chapter3/exercises_c3.js | 53 ++++++++++++++++++++++ src/week1/days2-5/chapter3/test_c3.html | 11 +++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/week1/days2-5/chapter3/exercises_c3.js create mode 100644 src/week1/days2-5/chapter3/test_c3.html diff --git a/src/week1/days2-5/chapter2/test_c2.html b/src/week1/days2-5/chapter2/test_c2.html index 43e2e8f..be5d59c 100644 --- a/src/week1/days2-5/chapter2/test_c2.html +++ b/src/week1/days2-5/chapter2/test_c2.html @@ -5,7 +5,7 @@ - test js + test js chapter 2 diff --git a/src/week1/days2-5/chapter3/exercises_c3.js b/src/week1/days2-5/chapter3/exercises_c3.js new file mode 100644 index 0000000..e0713da --- /dev/null +++ b/src/week1/days2-5/chapter3/exercises_c3.js @@ -0,0 +1,53 @@ +// minimum +console.log("Minimum"); +let n1 = 5; +let n2 = 22 +let result = (n1, n2) => n1 < n2 ? n1 :n2; +console.log(result(n1, n2)); + +// even or odd +console.log("Even or odd"); +function isEven(number) { + if (number == 0) { + console.log("::: number is even :::"); + } else if (number == 1) { + console.log("::: number is odd :::"); + } else { + isEven(number - 2); + } +} + +isEven(50); +isEven(75); +//isEven(-1); + +// search and count +console.log("count B's"); +function countBs(text) { + let total = 0; + + for (let index = 0; index < text.length; index++) { + if (text.charAt(index).toUpperCase() === 'B') { + total++ + } + } + + return total; +} + +console.log(countBs("BBS")); + +console.log("count defined char"); +function countChar(text, charToFind) { + let total = 0; + + for (let index = 0; index < text.length; index++) { + if (text.charAt(index).toUpperCase() === charToFind.toUpperCase()) { + total++ + } + } + + return total; +} + +console.log(countChar("kaKkerlak", "k")); \ No newline at end of file diff --git a/src/week1/days2-5/chapter3/test_c3.html b/src/week1/days2-5/chapter3/test_c3.html new file mode 100644 index 0000000..aba0154 --- /dev/null +++ b/src/week1/days2-5/chapter3/test_c3.html @@ -0,0 +1,11 @@ + + + + + + + + test js chapter3 + + + From 86c7db3f8ae4ecae3766f05bae15b25583a1f0a1 Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Mon, 11 Jan 2021 20:25:32 -0600 Subject: [PATCH 07/12] exercises javascript --- src/week1/days2-5/chapter4/exercises_c4.js | 185 +++++++++++++++++++++ src/week1/days2-5/chapter4/test_c4.html | 11 ++ 2 files changed, 196 insertions(+) create mode 100644 src/week1/days2-5/chapter4/exercises_c4.js create mode 100644 src/week1/days2-5/chapter4/test_c4.html diff --git a/src/week1/days2-5/chapter4/exercises_c4.js b/src/week1/days2-5/chapter4/exercises_c4.js new file mode 100644 index 0000000..5af2b20 --- /dev/null +++ b/src/week1/days2-5/chapter4/exercises_c4.js @@ -0,0 +1,185 @@ +console.log("::: The sum of a range :::") +function range(numStart, numEnd) { + let range =[]; + if (numEnd > numStart) { + for (let cont = numStart; cont <= numEnd; cont++) { + range.push(cont); + } + } else { + for (let cont = numStart; cont >= numEnd; cont--) { + range.push(cont); + } + } + console.log(range); + return range; +} + +function sum(range) { + let sumatory = 0; + for (let index = 0; index < range.length; index++) { + sumatory += range[index]; + } + return sumatory; +} + +console.log(sum(range(5, 2))); + +console.log("::: The sum of a range (modified) :::") +function range2(numStart, numEnd, step) { + let range =[]; + if (numEnd > numStart) { + for (let cont = numStart; cont <= numEnd; step == undefined ? cont++ : cont += step) { + range.push(cont); + } + } else { + for (let cont = numStart; cont >= numEnd; step == undefined ? cont-- : cont += step) { + range.push(cont); + } + } + console.log(range); + return range; +} + +function sum2(range) { + let sumatory = 0; + for (let index = 0; index < range.length; index++) { + sumatory += range[index]; + } + return sumatory; +} + +console.log(sum2(range2(2, 5))); + +// reverse array (exercise 1) +console.log("::: reverse array :::"); +function reverseArray(array) { + let arrayCopy = []; + + for (let i = array.length -1; i >= 0; i--) { + arrayCopy.push(array[i]); + } + + return arrayCopy; +} + +console.log("reverseArray::: ", reverseArray(['A', 'B', 'C'])); + +// reverseArrayInPlace +console.log("::: reverse array in place:::"); +function reverseArrayInPlace(array) { + console.log("array in::: ", array); + let middleLength = 0; + if (array.length % 2 == 0) { + middleLength = (array.length / 2); + } else { + middleLength = parseInt((array.length / 2)); + } + + let first = 0; + let last = 0; + for (let index = 0; index < middleLength; index++) { + first = array[index]; + last = array[(array.length - 1) - index]; + array.splice(index, 1, last); + array.splice((array.length - 1) - index, 1, first); + } + return array; +} + +console.log("array out:::", reverseArrayInPlace([1, 2, 3, 4, 5])); + +// array to list +console.log("array to list"); + +function arrayToList(arrayValues) { + let listValues = {}; + + for(let cont = arrayValues.length-1; cont >= 0; cont--) { + if (listValues.value == undefined) { + listValues = {"value" : arrayValues[cont], "rest" : null}; + } else { + listValues = {"value" : arrayValues[cont], "rest" : listValues}; + } + + } + return listValues; +} + +console.log(arrayToList([10, 20, 30])); + +// list to array +console.log("list to array"); + +function listToArray(listElements) { + arrayElements = []; + while (listElements != null) { + arrayElements.push(listElements.value); + listElements = listElements.rest; + } + return arrayElements; +} + +console.log(listToArray(arrayToList([10, 20, 30]))); + +// prepend +console.log("Prepend"); +function prepend(element, list) { + return {"value" : element, "rest" : list}; +} + +console.log(prepend(10, prepend(20, null))); + +//nth +console.log("nth"); + +function nth(list, searchElementIndex) { + console.log(listToArray(list)); + return listToArray(list)[searchElementIndex]; +} + +console.log(nth(arrayToList([10, 20, 30]), 1)); + +// deep equal +console.log("deep equal"); + +function deepEqual(val1, val2) { + let result = false; + + if (val1 === null && val2 === null || val1 === undefined && val2 === undefined) { + // validate null object and values + result = true; + } else if(val1 !== null && val2 !== null && typeof(val1) !== "object" && typeof(val2) !== "object" && val1 === val2) { + // validate number, string, boolean + result = true; + } else if (val1 !== null && val2 !== null && typeof(val1) === "object" && typeof(val2) === "object") { + // validate object + if (Object.keys(val1).length === Object.keys(val2).length) { + // validate num of keys + for (let i = 0; i < Object.keys(val1).length; i++) { + // validate key names + if(Object.keys(val1)[i] !== Object.keys(val2)[i]) { + result = false; + break; + } else { + result = true; + } + } + for (let key in val1) { + // compare data in object + if (!deepEqual(val1[key], val2[key])) { + result = false; + break; + } else { + result = true; + } + } + } + } + + return result; +} + +let obj = {here: {is: "an"}, object: 2}; +console.log(deepEqual(obj, obj)); +console.log(deepEqual(obj, {here: 1, object: 2})); +console.log(deepEqual(obj, {here: {is: "an"}, object: 2})); \ No newline at end of file diff --git a/src/week1/days2-5/chapter4/test_c4.html b/src/week1/days2-5/chapter4/test_c4.html new file mode 100644 index 0000000..4044c3b --- /dev/null +++ b/src/week1/days2-5/chapter4/test_c4.html @@ -0,0 +1,11 @@ + + + + + + + + test js chapter4 + + + From a5e515f2878aaeab8fb45b7fab6018810fdc079b Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Tue, 12 Jan 2021 20:36:08 -0600 Subject: [PATCH 08/12] week 2 day 1 --- src/week2/day1/index.html | 65 +++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/src/week2/day1/index.html b/src/week2/day1/index.html index 246e778..b3bb4ed 100644 --- a/src/week2/day1/index.html +++ b/src/week2/day1/index.html @@ -1,24 +1,63 @@ - + + + + + + Creating elements + + +
+
+

+ + +

+ +
+
+
+ + + + diff --git a/src/week2/day3/indexEvents.html b/src/week2/day3/indexEvents.html index 7fc3f8a..c7850e9 100644 --- a/src/week2/day3/indexEvents.html +++ b/src/week2/day3/indexEvents.html @@ -1,10 +1,5 @@ - + + + + + + Events + + + + + + + + + From 20303fd950dde608341de28f5ac02a67599ce8e3 Mon Sep 17 00:00:00 2001 From: Francisco Antonio Rodriguez Romero Date: Sun, 24 Jan 2021 21:03:51 -0600 Subject: [PATCH 12/12] week 2 days 4 and 5 --- src/week2/day4-5/expressDemo.js | 10 +++++++++- src/week2/day4-5/fsDemo.js | 22 +++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/week2/day4-5/expressDemo.js b/src/week2/day4-5/expressDemo.js index 000831f..9fc1141 100644 --- a/src/week2/day4-5/expressDemo.js +++ b/src/week2/day4-5/expressDemo.js @@ -1,4 +1,6 @@ -const express = ; +// import {router} from "./randomRoute/randomRoute"; + +const express = require("express"); const app = express(); const port = 3000; @@ -6,6 +8,12 @@ app.get('/', (req, res) => { res.send('Hello There!'); }) +app.get('/random', (req, res) => { + res.send("

" + Math.floor(Math.random()*101) + "

"); +}) + +// app.use(router); + app.listen(port, () => { console.log('Example server listening on port ' + port); console.log('Enter http://localhost:' + port + ' on your browser') diff --git a/src/week2/day4-5/fsDemo.js b/src/week2/day4-5/fsDemo.js index 8d42541..f757c78 100644 --- a/src/week2/day4-5/fsDemo.js +++ b/src/week2/day4-5/fsDemo.js @@ -2,12 +2,24 @@ const fs = require('fs'); var fileName = "test.txt", content = "Hey There!"; -fs.writeFile(__dirname + "/" + fileName, content, function(err) { - if(err) { - return console.log(err) - } +// fs.writeFile(__dirname + "/" + fileName, content, function(err) { +// if(err) { +// return console.log(err) +// } +// console.log("The file was saved!"); +// }); - console.log("The file was saved!"); +fs.open(__dirname + "/" + fileName, 'r', function(err, f) { + if(!err) { + console.log("file found"); + } else { + fs.writeFile(__dirname + "/" + fileName, content, function(err) { + if(err) { + return console.log(err) + } + console.log("The file was saved!"); + }); + } }); // This is a node app, this code saves a file on the current path with