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
#!/bin/sh | |
# create self-signed server certificate: | |
read -p "Enter your domain [www.example.com]: " DOMAIN | |
echo "Create server key..." | |
openssl genrsa -des3 -out $DOMAIN.key 1024 |
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 tinyAjax = function tinyAjax(config) { | |
return new Promise((resolve, reject) => { | |
let request = new XMLHttpRequest() | |
request.open(config.method.toUpperCase(), config.url, true) | |
request.timeout = config.timeout || 60000 | |
// Listen for ready state | |
request.onreadystatechange = function handleLoad() { | |
if (!request || (request.readyState !== 4)) { | |
return; | |
} |
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
class Middleware { | |
constructor() { | |
this._middleware = [] | |
} | |
use(...fns) { | |
fns.forEach(fn => { | |
if (typeof fn !== 'function') { | |
throw new TypeError('Middleware must be function!') | |
} |
OlderNewer