This is the reference point. All the other options are based off this.
|-- app
| |-- controllers
| | |-- admin
| //ES6 Class inherit example | |
| class Person{ | |
| sayName(){ | |
| console.log(this.name); | |
| } | |
| } | |
| class Classmate extends Person { | |
| constructor(name){ | |
| super() | |
| this.name = name; |
| function server(req, res){ | |
| let next = () => { | |
| //deal with ending job | |
| } | |
| middlewares.reduceRight((next, middleware) => { | |
| return () => { | |
| middleware(req, res, next) | |
| } | |
| }, next)(); | |
| } |
| if (localStorage && !localStorage.getItem('size')) { | |
| var i = 0; | |
| try { | |
| // Test up to 10 MB | |
| for (i = 250; i <= 10000; i += 250) { | |
| localStorage.setItem('test', new Array((i * 1024) + 1).join('a')); | |
| } | |
| } catch (e) { | |
| localStorage.removeItem('test'); | |
| localStorage.setItem('size', i - 250); |
| function checkDirectorySync(directory) { | |
| try { | |
| fs.statSync(directory); | |
| } catch(e) { | |
| fs.mkdirSync(directory); | |
| } | |
| } |
| // | |
| // _oo0oo_ | |
| // o8888888o | |
| // 88" . "88 | |
| // (| -_- |) | |
| // 0\ = /0 | |
| // ___/`---'\___ | |
| // .' \\| |// '. | |
| // / \\||| : |||// \ | |
| // / _||||| -:- |||||- \ |
| # Intel | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse | |
| deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse | |
| deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse |
| //mock a fs Object | |
| let fs = { | |
| readFile: function(filename, cb){ | |
| let randomTime = 100+Math.random()*1000>>0; | |
| setTimeout(()=>{ | |
| cb(`hello ${filename}`) | |
| }, randomTime) | |
| } | |
| } |
| const obj1 = {name:"xiaoming", age: 23} | |
| const obj2 = {age: 33} | |
| const obj3 = {...obj1, ...obj2} | |
| //obj3 ==> {"name":"xiaoming","age":33} |
| let fs = { | |
| readFile: function(filename, cb){ | |
| setTimeout(()=>{ | |
| cb('hello') | |
| }, 100) | |
| } | |
| } | |
| let readFilePro = function(filename){ | |
| return new Promise(function(resolve, reject) { | |
| fs.readFile(filename, (data, err) => { |