Skip to content

Instantly share code, notes, and snippets.

@phattranky
phattranky / gist:df9b54bbf5dede1f2b9d2d50156cb59e
Last active July 26, 2021 16:47 — forked from kimyvgy/MANUAL.md
Deploy nodejs app with gitlab.com and pm2
Deploy nodejs app with gitlab.com and pm2
=========================================
This manual is about setting up an automatic deploy workflow using [nodejs](https://nodejs.org/en/),
[PM2](http://pm2.keymetrics.io/), [nginx](https://nginx.org/) and
[GitLab CI](https://about.gitlab.com/features/gitlab-ci-cd/). It is tested on:
* Target server: **Ubuntu 16.04 x64.** This is suitable for Ubuntu 14.x.
* **Windows 10** on my PC to work.
@phattranky
phattranky / fiddle.js
Created January 27, 2020 06:59 — forked from olafdietsche/fiddle.js
Javascript: get localStorage maximum size
if (!localStorage) {
console.log('unavailable');
} else {
var max = 'x', s;
var lower_bound = 1, upper_bound = 1, middle;
// determine lower and upper bound
try {
while (true) {
localStorage.setItem('test', max);
function formatN (n) {
var nn = n.toExponential(2).split(/e/);
var u = Math.floor(+nn[1] / 3);
return nn[0] * Math.pow(10, +nn[1] - u * 3) + ['p', 'n', 'u', 'm', '', 'k', 'M', 'G', 'T'][u+4];
}
var array = [1e7, 1e6, 2345, 100, 10, 1, 1e-2, 1e-3, 1e-5, 1e-6, 256e-9];
for (var i = 0, len = array.length; i < len; i++) {
var n = array[i];