For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
This file contains hidden or 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
// Async function to send mail to a list of users. | |
const sendMailForUsers = async (users) => { | |
const usersLength = users.length | |
for (let i = 0; i < usersLength; i += 100) { | |
const requests = users.slice(i, i + 100).map((user) => { // The batch size is 100. We are processing in a set of 100 users. | |
return triggerMailForUser(user) // Async function to send the mail. | |
.catch(e => console.log(`Error in sending email for ${user} - ${e}`)) // Catch the error if something goes wrong. So that it won't block the loop. | |
}) | |
This file contains hidden or 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
const durations = [1000, 2000, 3000] | |
promises = durations.map((duration) => { | |
return timeOut(duration).catch(e => e) // Handling the error for each promise. | |
}) | |
Promise.all(promises) | |
.then(response => console.log(response)) // ["Completed in 1000", "Rejected in 2000", "Completed in 3000"] | |
.catch(error => console.log(`Error in executing ${error}`)) |
This file contains hidden or 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
const fs = require('fs'); | |
const jwt = require('jsonwebtoken'); | |
// http://travistidwell.com/blog/2013/09/06/an-online-rsa-public-and-private-key-generator/ | |
// use 'utf8' to get string instead of byte array (1024 bit key) | |
var privateKEY = fs.readFileSync('./private.key', 'utf8'); // to sign JWT | |
var publicKEY = fs.readFileSync('./public.key', 'utf8'); // to verify JWT | |
module.exports = { | |
sign: (payload, $Options) => { | |
/* |
JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;