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
| cp -pv --parents `git diff --name-only master..develop -- source/directory` target/directory | |
| cp -pv --parents $(git hist --since="6am" | awk '{print $2}' | xargs | git diff --name-only HEAD $(awk {'print $NF'}) ./) ./ChangedFiles |
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
| public static bool CustomStartsWith(this string a, string b) | |
| { | |
| int aLen = a.Length; | |
| int bLen = b.Length; | |
| int ap = 0; int bp = 0; | |
| while (ap < aLen && bp < bLen && a [ap] == b [bp]) | |
| { | |
| ap++; |
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
| public static bool CustomEndsWith(this string a, string b) | |
| { | |
| int ap = a.Length - 1; | |
| int bp = b.Length - 1; | |
| while (ap >= 0 && bp >= 0 && a [ap] == b [bp]) | |
| { | |
| ap--; | |
| bp--; | |
| } |
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 capitalizeFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1) | |
| const capitalizeAll = (str, toLower = false) => (toLower ? str.toLowerCase() : str).replace(/(?:^|\s|["'([{])+\S/g, match => match.toUpperCase()) |
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 randomStr = Math.random().toString(36).slice(2); | |
| const anotherRandomStr = length => [...Array(length)].map(() => Math.random().toString(36)[2]).join(''); |
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 arr = [1,[2,[3,[4,[5]]]]]; | |
| const dArray = arr.toString().split(',').map((num) => Number(num)); |
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 generateRandomHexColor = () => | |
| `#${Math.floor(Math.random() * 0xffffff).toString(16)}`; | |
| const generateRandomRgbColor = () => | |
| `rgb(${new Array(3).fill(0).map(() => Math.floor(Math.random() * 256))})`; |
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 shuffleArray = (arr) => arr.sort(() => Math.random() - 0.5); |
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
| // Проблема: Потеря окружения | |
| for(var i = 0; i <= 10; i++) { | |
| setTimeout(function() { | |
| console.log(i) | |
| }, 2000); | |
| } | |
| // 1. С помощью внешней функции через параметр | |
| function func(value) {console.log(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
| const DAYS = [ | |
| 'Sunday', | |
| 'Monday', | |
| 'Tuesday', | |
| 'Wednesday', | |
| 'Thursday', | |
| 'Friday', | |
| 'Saturday', | |
| ]; |
NewerOlder