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
| function arrayPlusArray(arr1, arr2) { | |
| return arr1.concat(arr2).reduce((acc, cur) => acc + cur); | |
| } |
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
| // return masked string | |
| function maskify(cc) { | |
| return cc.replace(/.(?=.{4})/g, "#"); | |
| } | |
| // or | |
| function maskify(cc) { | |
| return cc.replace(/.(?=....)/g, '#'); | |
| } | |
| // or | |
| function maskify(cc) { |
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
| const dblTouchTapMaxDelay = 300 | |
| let latestTouchTap = { | |
| time: 0, | |
| target: null, | |
| } | |
| export default function isDblTouchTap(event) { | |
| const touchTap = { | |
| time: new Date().getTime(), | |
| target: event.currentTarget, |
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
| // with recursion | |
| function findAll(obj, key){ | |
| if(Array.isArray(obj)){ | |
| return obj.reduce((a,v) => a.concat(findAll(v, key)),[]); | |
| } | |
| if(typeof obj === 'object'){ | |
| return Object.keys(obj).reduce(function(v, k){ | |
| if(k === key){ | |
| return v.concat(obj[k]); | |
| } |
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
| function difference(object, base) { | |
| return _.transform(object, (result, value, key) => { | |
| if (!_.isEqual(value, base[key])) { | |
| result[key] = _.isObject(value) && _.isObject(base[key]) ? difference(value, base[key]) : 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
| ssh-keygen -t rsa -C "<email>" -f <name_key> |
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
| exec zsh -l |
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
| /* Document | |
| 1. Change from `box-sizing: content-box` so that `width` is not affected by `padding` or `border`. | |
| 2. Change the default font family in all browsers. | |
| 3. Correct the line height in all browsers. | |
| 4. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS. | |
| 5. Setting @viewport causes scrollbars to overlap content in IE11 and Edge, so we force a non-overlapping, non-auto-hiding scrollbar to counteract. | |
| 6. Change the default tap highlight to be completely transparent in iOS. | |
| */ | |
| *, | |
| *::before, |
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
| /* | |
| INPUT | |
| anagrams(['xxy', 'cab', 'bca', 'cab', 'bac', 'baa', 'abb', 'dash', 'shad']) | |
| OUTPUT | |
| [ | |
| ['xxy'], | |
| ['cab', 'bca’, 'bac'], | |
| ['dash', 'shad'], | |
| ['abb'], |
OlderNewer
Полное руководство по Flexbox