Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

Sayuj Sehgal sayuj1

🌴
On vacation
View GitHub Profile
@sayuj1
sayuj1 / send-email.js
Created Jul 1, 2020
Send email in node js app using nodemailer
View send-email.js
// Nodemailer is a module for Node. js applications to allow easy as cake email sending.
// I am assuming you have stored your SMTP details in the .env file.
// For development purpose I haved used mailtrap.io for sending email.
// Basically mailtrap creates a virtual inbox where all the mails received without spamming real customers or flooding your own and team members inboxes.
// Importing nodemailer
const nodemailer = require('nodemailer');
// Here is a small function that sends email using SMTP service.
const sendEmail = async options => {
@sayuj1
sayuj1 / css media queries.css
Last active Jun 30, 2020
CSS media queries template
View css media queries.css
/* Small devices (landscape phones, 576px and up) */
@media screen and (min-width: 576px) {
}
/* Medium devices (tablets, 768px and up) */
@media screen and (min-width: 768px) {
}
/* Large devices (desktops, 992px and up) */
@media screen and (min-width: 992px) {
@sayuj1
sayuj1 / redis server connecting through redis-cli.txt
Last active Jun 30, 2020
Commands to connect redis server both locally/cloud hosted using redis-cli
View redis server connecting through redis-cli.txt
There are two ways to connect remote redis server using redis-cli:
1. Using host & port individually as options in command
redis-cli -h host -p port
If your instance is password protected
redis-cli -h host -p port -a password
e.g. if my-web.cache.amazonaws.com is the host url and 6379 is the port
Then this will be the command:
View redis-config.js
// Port, host and auth token of Redis server might be defined as environment
// variables. If not, fall back to defaults.
let redisPort = process.env.REDIS_PORT || 6379,
redisHost = process.env.REDIS_HOST || '127.0.0.1',
redisAuth = process.env.REDIS_AUTH || null,
redis = require('redis');
// Since we are waiting for the error event, we don't have to check for errors
// individually after each Redis command.
let onError = (error) => {
You can’t perform that action at this time.