This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // [1,1,2,2,3,4,4,5,5] | |
| // Version using purely arrays: | |
| // Complexity: LogO because I'm filtering the main array | |
| // to find the repetitions, best scenario, we would need | |
| // 1 iteration (scenario where the first element is the | |
| // one that doesn't have any repetition) | |
| function findRepeatedNumberV1(arr: number[]) { | |
| for(let i = 0; i < arr.length ; i ++) { | |
| const repetitions = arr.filter(num => num === arr[i]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| .bordered { | |
| border-top: dotted 1px var(--color); | |
| border-bottom: solid 2px var(--color); | |
| } | |
| #menu a.bordered { | |
| --color: #111; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .bordered { | |
| border-top: dotted 1px var(--color); | |
| border-bottom: solid 2px var(--color); | |
| } | |
| #menu a.bordered { | |
| --color: #111; | |
| } | |
| .post a.bordered { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .bordered(@color) { | |
| border-top: dotted 1px @color; | |
| border-bottom: solid 2px @color; | |
| } | |
| #menu a { | |
| .bordered(#111); | |
| } | |
| .post a { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :root { | |
| --width: 30px; | |
| } | |
| .container { | |
| width: var(--width, 100%); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :root { | |
| --width: 30px; | |
| } | |
| .container { | |
| width: var(--width); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --width: 10px; | |
| --shadow: box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FancyArray extends Array { | |
| multiply() { | |
| this.forEach(el => this.push(el * el)) | |
| } | |
| } | |
| const a = new FancyArray(1,2,3,4,5) | |
| a.multiply() | |
| console.log(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <my-component [(title)]="myAwesomeTitle"></my-component> | |
| <!-- | |
| This means that the 'title' variable is going to point to the variable 'myAwesomeTitle' | |
| if something changes the variable 'title' inside the component 'my-component', the change | |
| is going to be propagated until the variable 'myAwesomeTitle' | |
| --> | |
| <input [(ngModel)]="name" /> | |
| <!-- | |
| This is an example of a two-way binding to an special directive. This directive is the one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p>{{myAwesomeText | uppercase}}</p> | |
| <!-- | |
| After the expression is evaluated, the value is going to be tranformed to uppercase | |
| --> | |
| <p>{{myAwesomeText?.fallbackValue}}</p> | |
| <!-- | |
| In case the variable 'myAwesomeText' is null or undefined, Angular will render the variable | |
| 'fallbackValue' As a good practice, the 'fallbackValue' must not be null or undefined | |
| --> |
NewerOlder