Vagrant 可以配置本地開發環境(虛擬機),同時管理遠端主機(Digital Ocean),在一個專案目錄下、只用一個 Vagrantfile。
首先安裝外掛:
vagrant plugin install vagrant-digitalocean
var http = require('http'), | |
fs = require('fs'); | |
function serveStaticFile(res, path, contentType, responseCode) { | |
if(!responseCode) responseCode = 200; | |
fs.readFile(__dirname + path, function(err, data){ | |
if(err) { | |
res.writeHead(500, {'Content-Type': 'text/plain'}); | |
res.end('500 - Internal Error'); | |
} else { |
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi | |
function git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return; | |
echo "("${ref#refs/heads/}") "; | |
} | |
function git_since_last_commit { |
Vagrant 可以配置本地開發環境(虛擬機),同時管理遠端主機(Digital Ocean),在一個專案目錄下、只用一個 Vagrantfile。
首先安裝外掛:
vagrant plugin install vagrant-digitalocean
#!/bin/bash | |
# install xcode command tool | |
xcode-select --install | |
# check | |
xcode-select -p | |
# install brew | |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" |
#!/bin/bash | |
echo -e "\n移除不需要的預設套件" | |
meteor remove autopublish insecure | |
echo -e "\n安裝基礎會員帳戶套件" | |
meteor add accounts-password alanning:roles | |
echo -e "\n安裝 Flow 路由套件" | |
meteor add kadira:flow-router kadira:blaze-layout |
官方調教的是 Raspbian,Debian 的分支,目前代號Wheezy,也就是 Debian 7。
可手動升級到 Debian 8 Jessie。
首先將官方映像燒到 SD 卡,Mac 上推薦使用 ApplePi-Baker 程式。
在最簡模式,插入 Raspbian SD 卡、接上實體網路線、接上 USB 電源,系統會自動從區網 DHCP 取得網路 ip,從遠端 Mac 上以終端機 ssh 登入,執行 ssh [email protected]
預設密碼是 raspberry。
登入後先執行 sudo raspi-config
,使用文字選取介面完成幾項初始工作:
#!/bin/bash | |
set -o errexit | |
# IP or URL of the server you want to deploy to | |
APP_HOST=example.com | |
# Uncomment this if your host is an EC2 instance | |
# EC2_PEM_FILE=path/to/your/file.pem | |
# You usually don't need to change anything below this line |
var JOURNAL = require('./journal'); | |
//陣列的 indexOf(name) 回傳索引或 -1(不存在) | |
//這個 hasEvent 用來檢測某事件是否存在 | |
function hasEvent(event, entry) { | |
return entry.events.indexOf(event) != -1; | |
} | |
//將某事件與變松鼠的關係寫成 [n00, n01, n10, n11] 陣列 | |
function tableFor(event, journal) { | |
var table = [0, 0, 0, 0]; |
## 資源 | |
- [入門資源連結](https://cnodejs.org/getstart) | |
- [七天學會NodeJS](http://nqdeng.github.io/7-days-nodejs/) | |
- [Node.js 包膠不包會](https://github.com/alsotang/node-lessons) | |
- [使用 Express + MongoDB 搭建多人博客](https://github.com/nswbmw/N-blog/wiki/第1章--一个简单的博客) |
context: HTML, CSS, JavaScript | |
只為了測試前端: | |
``` | |
python -mSimpleHTTPServer | |
``` |