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
const maybe = (params: RequestInit) => ({ ...params }); | |
const reduce = (acc: RequestInit, curr: RequestInit) => ({ ...acc, ...curr }); | |
const set = (...params: RequestInit[]) => params.reduce(reduce, {}); | |
const headers = (data: HeadersInit): RequestInit => ({ headers: data }); | |
const json = (fn: Promise<Response>) => fn.then(res => res.json()); | |
const post = (): RequestInit => ({ method: 'post' }); | |
const body = (data: string): RequestInit => ({ body: data }); | |
const content = (type: string) => ({ 'Content-Type': type }); |
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
# Notice: app port should be correct, ex. 587 | |
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out tls_cert.crt -keyout tls_key.key | |
openssl rsa -in tls_key.key -text > tls_key.pem | |
openssl x509 -inform PEM -in tls_cert.crt > tls_cert.pem | |
# and dont forget about chmod | |
# chmod 400 /root/certs/tls_key.key |
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
export default class Colourz { | |
constructor() { | |
} | |
//TODO async/await | |
getAverageColorRGB(url, callback) { | |
try { | |
this.getImageBase64(url, (err, imgBase64) => { | |
if(err) return callback(err); | |
//new image |