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
$ npm install browser-env eslint | |
npm notice created a lockfile as package-lock.json. You should commit this file. | |
npm WARN acorn-jsx@5.0.1 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself. | |
npm WARN c@1.0.0 No description | |
npm WARN c@1.0.0 No repository field. | |
+ eslint@5.10.0 | |
+ browser-env@3.2.5 | |
added 194 packages from 252 contributors and audited 316 packages in 14.331s | |
found 0 vulnerabilities |
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
{ | |
"Working Directory" : "\/Users\/watilde", | |
"Prompt Before Closing 2" : 0, | |
"Selected Text Color" : { | |
"Green Component" : 1, | |
"Red Component" : 1, | |
"Blue Component" : 1 | |
}, | |
"Rows" : 25, | |
"Ansi 11 Color" : { |
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 promise1 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 100, 'one') | |
}) | |
const promise2 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 200, 'two') | |
}) | |
const promise3 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 300, 'three') |
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
$ ls | |
package-lock.json package.json | |
$ cat package.json | |
{ | |
"name": "test", | |
"version": "1.0.0", | |
"dependencies": { | |
"express": "^4.16.2" | |
} |
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
process.stdin.resume(); | |
process.stdin.setEncoding('ascii'); | |
var input_stdin = ""; | |
var input_stdin_array = ""; | |
var input_currentline = 0; | |
process.stdin.on('data', function (data) { | |
input_stdin += data; | |
}); |
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 input = '1 4 5 6 7 8' | |
const arr = input.split(' ').map(Number) | |
console.log(`\ninput:\n ${input}\n\noutput:`) | |
for (let i = 1; arr.length > i; i++) { | |
compare(arr.slice(0, i), arr.slice(i)) | |
} | |
function compare(left, right) { |
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 https = require('https') | |
const pkgJSON = require('./package.json') | |
const deps = Object.assign({}, pkgJSON.dependencies, pkgJSON.devDependencies) | |
const list = Object.keys(deps).map((key) => { | |
return new Promise((resolve, reject) => { | |
const pkg = encodeURIComponent(key) | |
https.get(`https://registry.npmjs.com/${pkg}/latest`, (res) => { | |
const { statusCode } = res | |
const contentType = res.headers['content-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
const asde = require('asde') | |
const fs = require('fs') | |
const stat = asde(fs.stat) | |
async function main () { | |
const [errStat, config] = await stat('./config') | |
if (errStat) { | |
return console.error(errStat) |
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
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
},{}],2:[function(require,module,exports){ | |
// shim for using process in browser | |
var process = module.exports = {}; | |
// cached from whatever global is present so that test runners that stub it | |
// don't break things. But we need to wrap it in a try catch in case it is | |
// wrapped in strict mode code which doesn't define any globals. It's inside a | |
// function because try/catches deoptimize in certain engines. |
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 cluster = require('cluster'); | |
const numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
for (let i = 0; i < numCPUs; i++) cluster.fork() | |
for (const id in cluster.workers) { | |
cluster.workers[id].on('message', (data) => { | |
console.log(data) | |
cluster.workers[id].send({cmd: 'from master'}) | |
}) |