Skip to content

Instantly share code, notes, and snippets.

View pjchender's full-sized avatar

Aaron Chen pjchender

View GitHub Profile
@pjchender
pjchender / Rails.md
Last active February 19, 2017 10:42
The flow of installing Ruby on Rails by RVM

Ruby on Rails 建議安裝方式(for MAC) --- 透過 RVM

  1. 安裝 Homebrew (透過下載安裝 | MAC 套件管理)
  2. 安裝RVM(需透過brew安裝前置環境)
  3. 安裝 Ruby (透過RVM安裝)
  4. 安裝 RubeGems (透過下載安裝 | Ruby 套件管理程式,指令簡稱 gem)
  5. 安裝 Rails (透過 RubyGems 安裝 | Ruby網頁開發框架)
  6. 安裝 Bundler(透過 RubyGems 安裝 | Gems 套件管理)
@pjchender
pjchender / ZoomDragSVG.js
Last active March 17, 2017 08:45
function to Zoom and Drag SVG
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})`
@pjchender
pjchender / api.json
Last active April 13, 2017 02:13
Create a Command Line Weather Application @ Treehouse
{
"key": "<apikey>"
}
@pjchender
pjchender / app.js
Last active May 1, 2017 05:22
[Treehouse][Node]Build a Simple Dynamic Site with Node.js @ Treehouse
var router = require('./router.js')
// 問題:我們希望能夠用瀏覽器的方式查詢使用者在 treehouse 的點數
// 解決:使用 NodeJS 來展現檔案
// 1. 建立一個網路伺服器
const http = require('http')
const hostname = '127.0.0.1'
const port = 3000
@pjchender
pjchender / 03-01-registerComponent.html
Last active May 1, 2017 04:48
[Flycan][Vue] CH3 - Part1(組件 component、轉場 transition、混合 mixin)
<!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;
@pjchender
pjchender / demo-app.js
Last active May 1, 2017 05:18
[Express] Some boilerplate for Express
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'
@pjchender
pjchender / app.js
Last active April 13, 2017 01:13
Build a REST API With Express @ Treehouse
// 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
@pjchender
pjchender / app.js
Last active October 23, 2019 03:47
Learn to Use Passport(Passport 學習筆記)
// 匯入需要的模組
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
@pjchender
pjchender / iterator.js
Last active April 18, 2017 08:46
[JavaScript][RxJS] 30 天精通 RxJS (04): 什麼是 Observable ?
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}
@pjchender
pjchender / .babelrc
Last active April 18, 2017 14:09
[Flycan] 20170418 Vue 筆記
{
"presets": [
["latest", {
"es2015": { "modules": false }
}],
"stage-2"
]
}