»

Laravel with Gmail

Coding — Tags: , — Posted by Starck on June 6, 2013

修改 app/config/mail.php:

  • host 為 smtp.gmail.com
  • port 為 465
  • encryption 為 ssl

Test:

Upgrade Ubuntu

Log — Tags: — Posted by Starck on May 26, 2013

  1. install the update-manager-core package if it is not already installed:

    $ sudo apt-get install update-manager-core

  2. Edit /etc/update-manager/release-upgrades and set Prompt=normal;

  3. Launch the upgrade tool with the command:

    $ sudo do-release-upgrade -d


List installed packages:

$ sudo dpkg --get-selections

使用不同版本的 Foundation

Log — Tags: , — Posted by Starck on May 24, 2013

切換 ruby

rvm use <version>

rvm list

切換與建立 gemset

你可以使用不同的 gem 設定

rvm gemset create <name>

rvm gemset use <name>

Using Foundation 4

Using Foundation 3

Single Web Page Design

Design — Tags: , — Posted by Starck on May 17, 2013

  • jquery
  • bootstrap javascript
  • modernizr
  • plugins.js
    • FancyBox
    • jQuery.ScrollTo
    • array.reverse
  • SMINT

app.js

Media Query for different Device or Screen

Coding — Tags: , — Posted by Starck on May 17, 2013

from Media Query Builder

Viewing Chrome Cache

Coding — Tags: , — Posted by Starck on May 14, 2013

  1. In Chrome chrome://cache/

  2. Click on whichever file you want to view

  3. Settings > Tools > JavaScript Console

  4. Paste code below:

The Beauty of Data Visualization

Design — Tags: , — Posted by Starck on April 18, 2013

數據分析不是去尋找某個答案, 而是讓我們透過數據去想像, 將數字融入內容當中, 成為故事的一部分。

MySQL error

Log — Tags: , — Posted by Starck on April 11, 2013

今天 Mac mini 工作機的 MySQL 又出問題了, 所以想把它重新安裝一下…

到官網下載 mysql-5.5.16-osx10.6-x86_64.dmg

安裝前先備份 databases:

安裝 MySQL

安裝後 MySQL 會把程式分別放在以下三個地方:

  • /usr/local/mysql-5.5.16-osx10.6-x86_64 (主程式)
  • /Library/StartupItems/MySQLCOM (用來放置系統啟動時自動執行的 plist 配置檔)
  • /Users/Zmax/Library/PreferencePanes/MySQL.prefPane (系統偏好設定的界面)

因為我的 sql 資料有點大, 所以到 /etc/my.cnf:

max_allowed_packet 設大一點避免資料過大而斷線

把舊的 sql 還原:

完工!

V8 Javascript Engine for PHP on Mac

Log — Tags: , , — Posted by Starck on April 8, 2013

This is a PHP extension embeds the Google V8 Javascript Engine.

V8js extension on Github

Installation

Usage

check samples and tests folder

Problems

如果你經由 PECL 安裝 v8js:

sudo pecl install v8js

你可能會遇到一些編譯上的錯誤, 造成這個問題的原因是因為在 PECL 上的版本 0.1.3 使用了一個已經被最新版 V8 engine 所廢除的函式, 如果想要使用這個版本的話必須要使用 V8 3.15.11 的版本, 降版的方式如下:

brew install v8-3.15.11

如果之後想要切換回新版:

Git Deployment Solution

Coding, Log — Tags: , , , , — Posted by Starck on April 2, 2013

Why we need a Git Deployment Solution ?

In our past website develop workflow, we may often update files to production server by FTP, but it maybe causes some problems due to human factors, and it can’t be controlled and tracked for file version. As we increasingly need to maintain our projects by Git, if we are able to update server files while we do Git push, it sounds like a good idea, right? so we dont need to check which files want to upload any more. even we can push our project to development server and production server according to our needs.

在以往網站建置的工作流程中, 我們可能常常是用 FTP 的方式來更新 production server 的檔案. 這之中, 常會發生一些人為因素的失誤造成混亂, 而且也沒有一個紀錄來追蹤檔案的版本情況. 現在的工作愈來愈需要 Git 來維護專案, 而如果我們在每次 Git push 的時候, 也更動 server 的檔案, 似乎是個不錯的 idea? (我們不再需要用 FTP 自已判斷要上傳哪些有被異動過的檔案了!) 甚至我們可以先在本機測完, Git push 到 development server, 沒問題後, 再正式發佈到 production server 上線.

聽起來好像不錯? 那該怎麼作?

需要的工具

  • Git
  • 一台已經設好 SSH-Server 的主機 ex: production.com

設定流程

假設我們現在是這個情況:

  • 伺服器的 domain name 叫 production.com
  • 伺服器網站的根目錄設在 /var/www/production.com
本機端 (local)
mkdir "your project folder"
cd "your project folder"
# 建立 git 檔案庫
git init
# create release branch
git branch master
git checkout master
git remote add prod-server [email protected]:/var/www/production.com
伺服器端 (production server)
cd /var/www/production.com
git init
git config receive.denyCurrentBranch ignore
git branch master
git checkout master

我們需要用到 Git post-receive hook 來實現當收到 push 資料之後更新到最後版本:

vim .git/hooks/post-receive

將以下 script 內容加上去

別忘了讓 post-receive 是可被執行的:

chmod +x .git/hooks/post-receive

實作流程

本機端 (local)

我們先建立一個 README.md, 然後用 Git push 看看是否伺服器上也會同步:

Git 會用 SSH 的方式連線, 所以請先確認是否能用該 user 連線登入 production server.

如果想要之後只打 git push 就佈署到主機, 請加上 -u 參數 git push -u prod-server master

伺服器端 (production server)

確認 README.md 存在, 成功!

現在, 我們現在有一個比 FTP 上傳更聰明的佈署方式了.

2013-04-03 update: 今天在找資料的時候發現 Stack Overflow 有人在討論這個方式.

Stack Overflow: Deploying a Project using Git Push

.

« Previous PageNext Page »
(c) 2024 Starck Lin | powered by WordPress