diff --git a/.gitignore b/.gitignore index cf70988..928c471 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/node_modules +.DS_Store \ No newline at end of file diff --git a/src/week1/day0/.empty b/src/week1/day0-1/.empty similarity index 100% rename from src/week1/day0/.empty rename to src/week1/day0-1/.empty diff --git a/src/week1/day0-1/expenses.html b/src/week1/day0-1/expenses.html new file mode 100644 index 0000000..e427466 --- /dev/null +++ b/src/week1/day0-1/expenses.html @@ -0,0 +1,40 @@ + + + + + + + Expenses + + +
+

Expenses

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
NombreEmpresaMonto a pagar
LuzEdea5000
GasGas Pampeana8000
CelularPersonal1000
+ + diff --git a/src/week1/day0-1/lion-3576045_960_720.jpg b/src/week1/day0-1/lion-3576045_960_720.jpg new file mode 100644 index 0000000..01074de Binary files /dev/null and b/src/week1/day0-1/lion-3576045_960_720.jpg differ diff --git a/src/week1/day0-1/multimedia.html b/src/week1/day0-1/multimedia.html new file mode 100644 index 0000000..b15140f --- /dev/null +++ b/src/week1/day0-1/multimedia.html @@ -0,0 +1,25 @@ + + + + + + + Multimedia + + +
+

Multimedia

+
+ + + Lion + + diff --git a/src/week1/day0-1/sign-up.html b/src/week1/day0-1/sign-up.html new file mode 100644 index 0000000..18d3608 --- /dev/null +++ b/src/week1/day0-1/sign-up.html @@ -0,0 +1,55 @@ + + + + + + + Sign up + + + +
+

Sign up

+
+
+
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + + + + +
+
+ + diff --git a/src/week1/day0-1/todo-list.html b/src/week1/day0-1/todo-list.html new file mode 100644 index 0000000..009bb26 --- /dev/null +++ b/src/week1/day0-1/todo-list.html @@ -0,0 +1,22 @@ + + + + + + + My todo list + + +
+

My todo list

+
+
+ +
+ + diff --git a/src/week1/days2-5/FizzBuzzExercise.js b/src/week1/days2-5/FizzBuzzExercise.js new file mode 100644 index 0000000..f71016f --- /dev/null +++ b/src/week1/days2-5/FizzBuzzExercise.js @@ -0,0 +1,10 @@ +for (let i = 1; i <= 100; i++) { + result = ""; + if (i % 3 === 0) { + result = "fizz"; + } + if (i % 5 === 0) { + result = "buzz"; + } + console.log(result || i); +} diff --git a/src/week1/days2-5/aList.js b/src/week1/days2-5/aList.js new file mode 100644 index 0000000..a0aa70a --- /dev/null +++ b/src/week1/days2-5/aList.js @@ -0,0 +1,43 @@ +function arrayToList(array) { + let list = null; + for (let i = array.length - 1; i >= 0; i--) { + list = {value: array[i], rest: list}; + } + return list; + } + + function listToArray(list) { + let array = []; + for (let node = list; node; node = node.rest) { + array.push(node.value); + } + return array; + } + + function prepend(value, list) { + return {value, rest: list}; + } + + function nth(list, n) { + if (!list) return undefined; + else if (n == 0) return list.value; + else return nth(list.rest, n - 1); + } + + console.log(arrayToList([10, 20])); + // → {value: 10, rest: {value: 20, rest: null}} + console.log(listToArray(arrayToList([10, 20, 30]))); + // → [10, 20, 30] + console.log(prepend(10, prepend(20, null))); + // → {value: 10, rest: {value: 20, rest: null}} + console.log(nth(arrayToList([10, 20, 30]), 1)); + // → 20 + + console.log(arrayToList([10, 20])); + // → {value: 10, rest: {value: 20, rest: null}} + console.log(listToArray(arrayToList([10, 20, 30]))); + // → [10, 20, 30] + console.log(prepend(10, prepend(20, null))); + // → {value: 10, rest: {value: 20, rest: null}} + console.log(nth(arrayToList([10, 20, 30]), 1)); + // → 20 \ No newline at end of file diff --git a/src/week1/days2-5/beanCounting.js b/src/week1/days2-5/beanCounting.js new file mode 100644 index 0000000..3347b2c --- /dev/null +++ b/src/week1/days2-5/beanCounting.js @@ -0,0 +1,17 @@ +function countChar(string, ch) { + let counted = 0; + for (let i = 0; i < string.length; i++) { + if (string[i] == ch) { + counted += 1; + } + } + return counted; + } + + function countBs(string) { + return countChar(string, "B"); + } + console.log(countBs("BBC")); + // → 2 + console.log(countChar("kakkerlak", "k")); + // → 4 \ No newline at end of file diff --git a/src/week1/days2-5/chessboard.js b/src/week1/days2-5/chessboard.js new file mode 100644 index 0000000..b041616 --- /dev/null +++ b/src/week1/days2-5/chessboard.js @@ -0,0 +1,10 @@ +chessboard = (num) => { + let output = ""; + for (i = 1; i <= num; i++) { + for (j = 1; j <= num; j++) { + (i + j) % 2 == 0 ? (output += "") : (output += "#"); + } + output += "\n"; + } + console.log(output); +}; diff --git a/src/week1/days2-5/deepComparison.js b/src/week1/days2-5/deepComparison.js new file mode 100644 index 0000000..74f18a2 --- /dev/null +++ b/src/week1/days2-5/deepComparison.js @@ -0,0 +1,24 @@ +function deepEqual(a, b) { + if (a === b) return true; + + if (a == null || typeof a != "object" || + b == null || typeof b != "object") return false; + + let keysA = Object.keys(a), keysB = Object.keys(b); + + if (keysA.length != keysB.length) return false; + + for (let key of keysA) { + if (!keysB.includes(key) || !deepEqual(a[key], b[key])) return false; + } + + return true; + } + + let obj = {here: {is: "an"}, object: 2}; + console.log(deepEqual(obj, obj)); + // → true + console.log(deepEqual(obj, {here: 1, object: 2})); + // → false + console.log(deepEqual(obj, {here: {is: "an"}, object: 2})); + // → true \ No newline at end of file diff --git a/src/week1/days2-5/index.html b/src/week1/days2-5/index.html new file mode 100644 index 0000000..ff778d4 --- /dev/null +++ b/src/week1/days2-5/index.html @@ -0,0 +1,134 @@ + + + + + layout page test + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Mi fantastico layout

+ +
+ +
+ + +
+

Section title

+
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce at + lorem enim. Nulla mattis aliquam est, ut lobortis libero molestie + vel. Morbi eu urna quis nisi tincidunt volutpat vel sed arcu. Fusce + nibh dolor, malesuada nec luctus ac, lacinia tempus ex. Nullam + vestibulum volutpat lorem vel lobortis. Nunc congue mollis erat, nec + placerat nibh pulvinar ultrices. Vestibulum nisi lacus, tincidunt ut + elit non, eleifend ornare ligula. Fusce dignissim mauris id tellus + auctor, ac hendrerit turpis condimentum. Nulla tellus metus, cursus + ut finibus sit amet, aliquam ac ante. Proin fermentum felis et risus + molestie, feugiat faucibus ligula condimentum. Sed cursus purus + vulputate neque faucibus, ac semper velit bibendum. Duis nec mauris + laoreet nibh consequat maximus non at sapien. Ut sed pretium quam. + Fusce lacinia urna eget orci suscipit, id rhoncus elit pellentesque. + Vivamus quis eros in sem suscipit porta. Aliquam sit amet ex + pretium, interdum ipsum in, volutpat tortor. +

+

+ Curabitur a augue dictum, consequat elit sit amet, scelerisque nisi. + Nullam tellus felis, sollicitudin a purus in, tristique ultricies + enim. Quisque sed tortor vel nulla vestibulum tristique sed eu nunc. + Phasellus ac magna nisl. Mauris non mi tristique, blandit risus a, + tempus velit. Aliquam porttitor posuere elementum. In imperdiet + mattis massa, ac egestas quam pretium nec. Suspendisse potenti. + Fusce eu dolor ex. Duis vitae elit scelerisque, malesuada mi at, + egestas enim. Suspendisse potenti. In pellentesque condimentum + euismod. In hac habitasse platea dictumst. +

+
+
Section footer
+
+ + +
+ + + + + + + + + diff --git a/src/week1/days2-5/loopingTriangle.js b/src/week1/days2-5/loopingTriangle.js new file mode 100644 index 0000000..dda3347 --- /dev/null +++ b/src/week1/days2-5/loopingTriangle.js @@ -0,0 +1,3 @@ +for (let i = 1; i <= 7; i = i + 1){ + console.log(i); + }; \ No newline at end of file diff --git a/src/week1/days2-5/minimum.js b/src/week1/days2-5/minimum.js new file mode 100644 index 0000000..31e2fd5 --- /dev/null +++ b/src/week1/days2-5/minimum.js @@ -0,0 +1,9 @@ +function min(a, b) { + if (a < b) return a; + else return b; +} + +console.log(Math.min(0, 10)); +// → 0 +console.log(Math.min(0, -10)); +// → -10 diff --git a/src/week1/days2-5/normalize.css b/src/week1/days2-5/normalize.css new file mode 100644 index 0000000..192eb9c --- /dev/null +++ b/src/week1/days2-5/normalize.css @@ -0,0 +1,349 @@ +/*! 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/days2-5/recursion.js b/src/week1/days2-5/recursion.js new file mode 100644 index 0000000..a5c1dd3 --- /dev/null +++ b/src/week1/days2-5/recursion.js @@ -0,0 +1,12 @@ +function isEven(n) { + if (n == 0) return true; + else if (n == 1) return false; + else if (n < 0) return isEven(-n); + else return isEven(n - 2); + } + console.log(isEven(50)); + // → true + console.log(isEven(75)); + // → false + console.log(isEven(-1)); + // → ?? \ No newline at end of file diff --git a/src/week1/days2-5/reversinAnArray.js b/src/week1/days2-5/reversinAnArray.js new file mode 100644 index 0000000..95da22a --- /dev/null +++ b/src/week1/days2-5/reversinAnArray.js @@ -0,0 +1,25 @@ +function range(start, end, step = start < end ? 1 : -1) { + let array = []; + + if (step > 0) { + for (let i = start; i <= end; i += step) array.push(i); + } else { + for (let i = start; i >= end; i += step) array.push(i); + } + return array; + } + + function sum(array) { + let total = 0; + for (let value of array) { + total += value; + } + return total; + } + + console.log(range(1, 10)); + // → [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + console.log(range(5, 2, -1)); + // → [5, 4, 3, 2] + console.log(sum(range(1, 10))); + // → 55 \ No newline at end of file diff --git a/src/week1/days2-5/style.css b/src/week1/days2-5/style.css new file mode 100644 index 0000000..4ce3804 --- /dev/null +++ b/src/week1/days2-5/style.css @@ -0,0 +1,92 @@ +html { + font-family: 14px; +} +.hidden { + display: none; +} + +.header { + display: flex; + justify-content: space-between; + align-items: center; + background: magenta; + padding: 10px; +} + +h1 { + font-size: medium; + margin: 0; + text-align: center; +} + +.main-column { + display: flex; + justify-content: space-between; + flex-direction: column; +} + +ul li a { + white-space: nowrap +} + +.navigation { + flex-grow: 1; + flex-direction: column; + padding: 10px; + background: yellowgreen; +} + +.content { + display: flex; + flex-grow: 1; + flex-direction: column; + padding: 10px; + background: #fff; +} + +.content > header { + background-color: cornsilk; + text-align: center; + font-style: normal; + font-size: medium; +} + +.content > article { + font-size: small; + padding: 4px; + background-color: darkgray; +} + +.content > footer { + font-style: italic; + font-size: medium; + background-color: darkkhaki; + text-align: center; +} + +.sidebar { + display: flex; + flex-direction: column; + flex-grow: 1; + padding: 10px; + background: seashell; +} + +.footer { + background: magenta; + padding: 10px; +} + +@media screen and (min-width: 640px) { + #navigation-menu { + display: flex; + + } + #menu-btn { + display: none; + } + + .main-column { + flex-direction: row; + } +} diff --git a/src/week1/days2-5/theSumOfRange.js b/src/week1/days2-5/theSumOfRange.js new file mode 100644 index 0000000..95da22a --- /dev/null +++ b/src/week1/days2-5/theSumOfRange.js @@ -0,0 +1,25 @@ +function range(start, end, step = start < end ? 1 : -1) { + let array = []; + + if (step > 0) { + for (let i = start; i <= end; i += step) array.push(i); + } else { + for (let i = start; i >= end; i += step) array.push(i); + } + return array; + } + + function sum(array) { + let total = 0; + for (let value of array) { + total += value; + } + return total; + } + + console.log(range(1, 10)); + // → [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + console.log(range(5, 2, -1)); + // → [5, 4, 3, 2] + console.log(sum(range(1, 10))); + // → 55 \ No newline at end of file