Skip to content

Instantly share code, notes, and snippets.

View kevin-shu's full-sized avatar

Kevin Shu kevin-shu

  • Apple Buds, Inc.
  • Taiwan
View GitHub Profile
bundle exec unicorn -E production -c ./config/unicorn.rb -D
# sudo ln -s ~/nginx.conf unicorn.conf
upstream app_server {
server unix:/tmp/unicorn_padrino.sock fail_timeout=0;
}
server {
listen 80;
charset utf-8;
server_name db.innshine.com;
app_root = "/root/path/of/app"
app_name = "demoapp"
listen "/tmp/app.sock", :backlog => 2048 #這邊要跟nginx虛擬主機檔中upstream內定義的務必一樣
worker_processes 4 #看情況開
preload_app false
timeout 30
module Rails
class <<self
def root

The Problem

If you have installed the standalone Command Line Tools for XCode on your Mac (i.e. without having XCode.app installed), some of these tools can get a bit confused due to a couple of oversights on Apple's part in finalising the setup.

Note: all commands below will need to be run from an Administrator account, or by an account with appropriate permission in /etc/sudoers.

The Solution

1. Failing to Find Frameworks

Sometime when compiling against the preinstalled Frameworks (e.g. Ruby or Python), various tools will inexplicable fail to find header files that are quite clearly there. This is caused by the fact that no XCode has been selected for the command-line tools. Wait, I hear you cry, I don't have XCode installed! Indeed, but you nonetheless need to select one, and point it somewhere where the command line tools exist, like so

  1. 30 秒認識 vagrant:

Vagrant 是一個 ruby 寫的工具,它是一個 DSL 讓開發者可以輕易控制 VirtualBox 的 VM 。用它可以輕鬆管理和制作我們理想中的開發環境。

  $ gem install vagrant #安裝 vagrant
  $ vagrant box add ubuntu http://cloud-images.ubuntu.com/vagrant/quantal/current/quantal-server-cloudimg-i386-vagrant-disk1.box #安裝新的 Vagrant Package。這裡的 ubuntu 是一個預先做好的空的 ubuntu 12.10 (intel-based) 
  $ vagrant init ubuntu  
  $ vagrant up  

此時就可以使用 vangrant ssh 連到vm了,預設使用者/密碼為 vangrant/vangrant

rbenv install 1.9.3-p194
rbenv rehash # for paranoia's sake
rbenv global 1.9.3-p194
gem env # to check that everything was pointing at 1.9 and not the system
gem install --no-ri --no-rdoc bundler
rbenv rehash # necessary to load up the bundle executable
bundle --path=vendor/bundle

團隊照片

束凱文 Kevin

束凱文

劉軒銘 Shane

劉軒銘

劉大智 Phelps

劉大智

(1..10).each do |i|
puts member["id_#{i}"]
end
select carts.`order_number`, products.`shipping_itemsize`, count(products.`shipping_itemsize`)
from carts inner join products on carts.`product_id` = products.`id`
group by carts.order_number, products.`shipping_itemsize`;
carts = Arel::Table.new(:carts)
products = Arel::Table.new(:products)
orders = Arel::Table.new(:orders)
subquery = carts.join(products).project("carts.order_number, products.shipping_itemsize as size, count(products.shipping_itemsize) as size_count").group("carts.order_number, products.shipping_itemsize")