Skip to content

Instantly share code, notes, and snippets.

View MarcWang's full-sized avatar

MarcWang MarcWang

  • 吾微而智
View GitHub Profile

ES6 - 字串樣板 (Template Strings)

NodeJS => ES6支援程度

  • shipping (開發完成並默認支持)
  • staged (開發完成,但必須使用--harmony參數)
  • in progress (開發中)

Multiline strings

ES6 - 解構 (Destructuring)

解構意思是指自動分析物件或陣列與目標物件或陣列值相對應的關係

NodeJS => ES6支援程度

  • shipping (開發完成並默認支持)
  • staged (開發完成,但必須使用--harmony參數)
  • in progress (開發中)

如果是使用nodejs,請查詢版本支援ES6的程度,本次使用版本為4.3,所以必須加參數

ES6 - (Default + Rest + Spread)

NodeJS => ES6支援程度

  • shipping (開發完成並默認支持)
  • staged (開發完成,但必須使用--harmony參數)
  • in progress (開發中)

Default

function es5DefaultFunc() {

ES6 - (Let + Const)

NodeJS => ES6支援程度

  • shipping (開發完成並默認支持)
  • staged (開發完成,但必須使用--harmony參數)
  • in progress (開發中)

let

If you ever find yourself gazing at falling snow,

如果你曾經看著白雪飄落並想著

why not catch a few snowflakes on your glove and examine their shapes

何不抓住一些雪花放在手套上看看它們是什麼形狀?

You might notice that they look symmetrical, and if you look closely,

ES6 - (Iterators + For...Of)

for...of

一般對ARRAY取值分為下列幾種方法,各有優缺點,但ES6提供一個新的方法for...of,可支援多種結構取值。

var array = ['a', 5, { key: "value" }];
var set = new Set().add('b').add(2).add({ key: "value" });
var map = new Map().set('c', 1).set('d', 2);

ES6 - 生成器 (Generators)

Generator的幾個重要規則

  • 函數執行到yield時會先暫停,並返回呼叫函數處繼續執行
  • 要呼叫暫停以下的程式時,需要呼叫next方法
  • 函數宣告方式必須加星號*function()
function* gen(firstValue) {
    console.log('call first');

Install Sublime Text3

$ sudo add-apt-repository ppa:webupd8team/sublime-text-3
$ sudo apt-get update
$ sudo apt-get install sublime-text-installer

Uninstall Sublime Text3

$ sudo apt-get autoremove --purge sublime-text-installer 

How to install OpenCV 3.1 on Ubuntu 14.04 64bits

Update latest packages and installed

$ sudo apt-get update
$ sudo apt-get upgrade

apt-get update - 更新最新的套件資訊 apt-get upgrade - 更新套件