One of my colleagues shared an article on writing (good) Git commit messages today: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the
| { | |
| ... | |
| "imageOptimization": { | |
| "cloudinary": { | |
| "baseUrl": "https://res.cloudinary.com/summertimesadness/image/fetch/f_auto,q_auto" | |
| } | |
| } | |
| } |
One of my colleagues shared an article on writing (good) Git commit messages today: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the
| /** | |
| * Get plural by number | |
| * @param {Number} value - number | |
| * @param {Array} cases - array of cases | |
| * @returns {String} case | |
| */ | |
| const plural = (value, cases) => { | |
| let n = Math.abs(value); | |
| n %= 100; |
| /** | |
| * | |
| * @param {Number} date - число в ms | |
| * @param {String} separator - разделитель для даты, например 01.01.1970 | |
| * @param {String} format - формат вывода даты, например, 1970.02.25 | |
| */ | |
| function formatDateString(date, separator, format) { | |
| if (!date) { | |
| return; | |
| } |
| const steps = [31, 29, 31, 30, 31, 30]; | |
| const year = []; | |
| let modifiedYear = [] | |
| // First date | |
| const counterDate = 14; | |
| // step is equal to month length | |
| steps.forEach(count => { | |
| year.push(Array(count).fill(0)) |
Актулизировано на момент 22.11.2018
- gzip 1 - минимальный уровень сжатия gzip, результат .gz
- gzip 9 - максимальный уровень сжатия gzip, результат .gz
- zopfli - отдельный алгоритм совместимый с распаковщиком gzip, результат .gz
- brotli 11 - полностью новый формат, 11 это максимальный уровень сжатия, результат .br
Не рассматривается - sdch(нет поддержки в современных браузерах), попытки запустить gzip > 1, zopfli, brotli на лету без пребилда сжатых файлов (для нас не актуально, очень много данных)
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| var bar = function (data) { | |
| return setTimeout(function() { | |
| return 'async data'; | |
| }, 1000); | |
| } | |
| var foo = function () { | |
| this._promise new Promise(function(resolve, reject) { | |
| this.once('bar', resolve) | |
| }) |
There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.
All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.
git config --global core.excludesfile ~/.gitignore
git config --global core.excludesfile %USERPROFILE%\.gitignore