- 安裝 Homebrew (透過下載安裝 | MAC 套件管理)
- 安裝RVM(需透過brew安裝前置環境)
- 安裝 Ruby (透過RVM安裝)
- 安裝 RubeGems (透過下載安裝 | Ruby 套件管理程式,指令簡稱 gem)
- 安裝 Rails (透過 RubyGems 安裝 | Ruby網頁開發框架)
- 安裝 Bundler(透過 RubyGems 安裝 | Gems 套件管理)
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 reportMouseCoordinates (evt) { | |
const offsetXY = document.getElementById('offsetXY') | |
const clientXY = document.getElementById('clientXY') | |
const svgXY = document.getElementById('svgXY') | |
const svgElement = document.getElementById('svgElement') | |
offsetXY.textContent = `Offset:(${evt.offsetX}, ${evt.offsetY})` | |
clientXY.textContent = `Client(screen): (${evt.clientX}, ${evt.clientY})` |
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
{ | |
"key": "<apikey>" | |
} |
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
var router = require('./router.js') | |
// 問題:我們希望能夠用瀏覽器的方式查詢使用者在 treehouse 的點數 | |
// 解決:使用 NodeJS 來展現檔案 | |
// 1. 建立一個網路伺服器 | |
const http = require('http') | |
const hostname = '127.0.0.1' | |
const port = 3000 |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>03-01-registerComponent</title> | |
<link rel="stylesheet" type="text/css" href="css/normalize.css"> | |
<link rel="stylesheet" type="text/css" href="css/layout.css"> | |
<style type="text/css"> | |
[v-cloak]{ | |
display: none; |
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 express = require('express') | |
const app = express() | |
const routes = require('./routes') | |
const jsonParser = require('body-parser').json | |
const logger = require('morgan') | |
app.use(jsonParser()) | |
app.use(logger('common')) // 給我們 prettify 後的 logger | |
app.use('/questions', routes) // 這個 middleware 只處理來自 '/questions' |
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
// 1-1.載入需要的模組 | |
const express = require('express') | |
const routes = require('./routes') | |
const jsonParser = require('body-parser').json | |
const logger = require('morgan') | |
const mongoose = require('mongoose') | |
const app = express() | |
// 2.使用和 Parser 有關的 middleware |
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 express = require('express') | |
const bodyParser = require('body-parser') | |
const cookieParser = require('cookie-parser') | |
const path = require('path') | |
const logger = require('morgan') | |
const mongoose = require('mongoose') | |
const session = require('express-session') | |
const passport = require('./middleware/passport') | |
const MongoStore = require('connect-mongo')(session) // 直接執行並將 session 存進去,logout 後會自動刪除該 document |
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 arr = [1, 2, 3] | |
// 原生的 array iterator | |
let nativeIterator = arr[Symbol.iterator]() | |
nativeIterator.next() // {value: 1, done: false} | |
nativeIterator.next() // {value: 2, done: false} | |
nativeIterator.next() // {value: 3, done: false} | |
nativeIterator.next() // {value: undefined, done: true} |
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
Show hidden characters
{ | |
"presets": [ | |
["latest", { | |
"es2015": { "modules": false } | |
}], | |
"stage-2" | |
] | |
} |
OlderNewer