Skip to content

Instantly share code, notes, and snippets.

View sayuj1's full-sized avatar
:octocat:
Development

Sayuj Sehgal sayuj1

:octocat:
Development
  • Infosys
  • Dabra
View GitHub Profile
// 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) => {
@sayuj1
sayuj1 / redis server connecting through redis-cli.txt
Last active June 30, 2020 11:14
Commands to connect redis server both locally/cloud hosted using redis-cli
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:
@sayuj1
sayuj1 / css media queries.css
Last active June 30, 2020 11:12
CSS media queries template
/* 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 / send-email.js
Created July 1, 2020 06:57
Send email in node js app using nodemailer
// 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 / JsDocInstructions.txt
Created November 2, 2021 02:49
JS Doc Configuration
To generate HTML from our comments, we need to use jsdoc npm package
We can install it using
$ npm i jsdoc
We'll also need to install better-docs plugin for jsdocs.
$ npm i better-docs
Then we need to create a config file
@sayuj1
sayuj1 / JsDocInstructions.txt
Created November 2, 2021 02:49
JS Doc Configuration
To generate HTML from our comments, we need to use jsdoc npm package
We can install it using
$ npm i jsdoc
We'll also need to install better-docs plugin for jsdocs.
$ npm i better-docs
Then we need to create a config file