Skip to content

Instantly share code, notes, and snippets.

View DenisIzmaylov's full-sized avatar
🎯
Focusing

Denis Izmaylov DenisIzmaylov

🎯
Focusing
View GitHub Profile
@DenisIzmaylov
DenisIzmaylov / nodemailer-example.js
Last active August 23, 2023 05:24
NodeMailer.js usage
import path from 'path';
import nodemailer from 'nodemailer';
import { htmlToText } from 'nodemailer-html-to-text';
import templates from '../templates';
import projectInfo from '../../project-info';
import logger from '../../logger';
const moduleLogger = logger.child({
module: 'emailServiceActions'
});
const packageInfo = require('../../../package.json');
@DenisIzmaylov
DenisIzmaylov / INSTALLATION.md
Last active April 27, 2023 15:44
OS X 10.11 El Capitan: fresh install with Node.js (io.js) Developer Environment

OS X 10.11 (El Capitan) / Node.js and io.js Developer Environment

Custom recipe to get OS X 10.11 El Capitan running from scratch with useful applications and Node.js Developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after fresh install.

Content

@DenisIzmaylov
DenisIzmaylov / README.md
Last active March 1, 2022 15:10
Step By Step Guide To Setup Docker Registry

Step By Step Guide To Setup CI/CD With Docker Registry

Step-by-Step Guide how to install CI/CD with Docker Registry On Ubuntu 14.04 LTS from scratch.

  1. Install Docker using Official Manual or just run:
sudo bash
apt-get update
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@DenisIzmaylov
DenisIzmaylov / offset.js
Created July 24, 2015 09:12
Offset (with limit) calculation / validation
function offset(count, offset, limit) {
const finalOffset = Math.max(Math.min(count, offset), 0);
const remainedCount = Math.min(count, count - finalOffset);
const finalCount = (typeof limit === 'number') ? Math.min(limit, remainedCount) : remainedCount;
return { offset: finalOffset, finalCount: finalCount };
}
console.log(offset(10, 0)); // {"offset":0,"finalCount":10}
console.log(offset(10, 4)); // {"offset":4,"finalCount":6}
console.log(offset(10, 10)); // {"offset":10,"finalCount":0}
@DenisIzmaylov
DenisIzmaylov / i18n-data.json
Last active May 3, 2021 21:12
Easy i18n translation in your ES6 apps
{
"ru": {
"Your original english text": "Твой оригинальный русский текст"
}
}
@DenisIzmaylov
DenisIzmaylov / INSTALLATION.md
Last active February 5, 2021 07:47
DigitalOcean Dokku: fresh install with Node.js Environment

DigitalOcean Dokku / Node.js Cloud Environment

Custom recipe to get full Node.js Cloud Environment in DigitalOcean Dokku droplet running from scratch. Yes. Your own Heroku for $5 per month.

I use this gist to keep track of the important configuration steps required to have a functioning system after fresh install.

When you have executed that's all step by step you will get a new working and stable system which is ready to host & serve your Node.js application and databases.

@DenisIzmaylov
DenisIzmaylov / case-1.js
Last active December 16, 2019 01:41
Clean Code?
// Bad
books.forEach(book => {
if (book[title]) {
if (book[author]) {
console.log(book)
}
}
})
// Good