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
| // Remove Duplicates from an array | |
| const removeDuplicates = | |
| arr => arr.filter((item, index) => index === arr.indexOf(item)); | |
| const removeDuplicates1 = array => [...new Set(array)]; | |
| const removeDuplicates2 = array => Array.from(new Set(array)); | |
| // Flattens an array(doesn't flatten deeply). |
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
| /*TODO MAKE IT IN ES6 | |
| var data=[4,5,6,9,10,14,15,20,21,22,23,24,25,30,31,34] | |
| output | |
| 4-6,9-10,14-15,20-25,30-31,34 | |
| */ | |
| var data=[4,5,6,9,10,14,15,20,21,22,23,24,25,30,31,34,36,37,94,95]; | |
| var start=data[0]; | |
| var temp=1; | |
| var a=0; |
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
| //Creates a function out of '!'. | |
| //Use this to improve code readability. | |
| //Instead of... if (!loggedIn) {} | |
| //..do this.. if not(loggedIn) {} | |
| const not = value => !value; |
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
| /* ========================================================================== | |
| These following classes can be used to add safe-area padding to the either 4 directions | |
| ========================================================================== */ | |
| .iphoneXSafeArea--top{ | |
| /* iOS 11.2+ */ | |
| padding-top: env(safe-area-inset-top); | |
| /* iOS 11 */ |
NewerOlder