with PM2 & Nginx
as a root, run below commands on server:
# adduser tomy
| export default function formDataToJSON(formData) { | |
| const data = {}; | |
| for (const key of formData.keys()) { | |
| data[key] = formData.get(key); | |
| } | |
| return data; | |
| } |
| html { | |
| font-size: calc(1vw + 1em) | |
| } |
| const http = require('http'); | |
| const time = 20; | |
| const interval = 1; | |
| const port = 8080; | |
| const server = http.createServer(function(req, res){ | |
| if (req.method === 'GET' && req.url !== '/favicon.ico') { | |
| console.log('********START timer***********'); | |
| const inttime = setInterval(() => { | |
| console.log('echo time = ', Date()); |
| const http = require('http'); | |
| var INTERVAL = process.argv[2] || 1000; | |
| var TIME = process.argv[3] || 10000; | |
| let clientId = 0; | |
| async function consoleDateAndTime (id) { | |
| let clock = setInterval(() => { | |
| console.log(`Client: ${id}, Clock: `, new Date()); |
| var getDirection = function (ev, obj) { | |
| var w = obj.offsetWidth, | |
| h = obj.offsetHeight, | |
| x = (ev.pageX - obj.offsetLeft - (w / 2) * (w > h ? (h / w) : 1)), | |
| y = (ev.pageY - obj.offsetTop - (h / 2) * (h > w ? (w / h) : 1)), | |
| d = Math.round( Math.atan2(y, x) / 1.57079633 + 5 ) % 4; | |
| return d; | |
| }; |
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.
Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| getJSON(url) // response.results - array of urls | |
| .then(response => Promise.all(response.results.map(getJSON))) | |
| .then(arrayOfPlanetData => arrayOfPlanetData.forEach(planet => createPlanetThumb(planet)) | |
| .catch(error => console.log(error)); |
| function delay(ms) { | |
| return () => { | |
| return new Promise(resolve => setTimeout(() => { | |
| resolve(); | |
| console.log('!!!'); | |
| }, ms)); | |
| } | |
| } | |
| function waterfall(list) { |