^(\+98|0)?9\d{9}$
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
This file contains 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
// Find theoretical sum of the consecutive numbers using a variation of Gauss Sum. | |
// Formula: [(N * (N + 1)) / 2] - [(M * (M - 1)) / 2]; | |
// N is the upper bound and M is the lower bound | |
function missingNumber(n) { | |
let upperBound = 0; | |
let lowerBound = 99999999; | |
let sum = 0; | |
for (let i = 0; i < n.length; i++) { |
This file contains 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
/** | |
* Redux | |
* - getState() | |
* - subscribe() | |
* - dispatch() -> ui -> state | |
* - combineReducer | |
* | |
* | |
* - replaceReducer | |
* - injectReducer |
This file contains 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
function createPromise () { | |
let resolve, reject | |
// eslint-disable-next-line promise/param-names | |
const promise = new Promise((...args) => ([resolve, reject] = args)) | |
return { promise, resolve, reject } | |
} | |
const remove = (a, y) => ( |