// composer.phar是二进制文件
// 它是一个PHAR (PHP archive),PHP的归档格式,也可以像其他命令一样在命令行上运行。
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
The normal controller/view flow is to display a view template corresponding to the current controller action, but sometimes we want to change that. We use render
in a controller when we want to respond within the current request, and redirect_to
when we want to spawn a new request.
The render
method is very overloaded in Rails. Most developers encounter it within the view template, using render :partial => 'form'
or render @post.comments
, but here we'll focus on usage within the controller.
httping -g URL -C "key=value" -s -c 5 |
# 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; |
// 提高性能 | |
// 让rails server只处理动态请求,不必浪费资源处理静态文件请求 | |
// rails server处理静态文件的性能完全不能和nginx,apache之类的比。 | |
location ~* ^/(images|javascripts|stylesheets|img)/ { | |
access_log off; | |
log_not_found off; | |
expires max; | |
break; | |
} |
💯 👍 👎 🔢 🎱
#!/bin/bash | |
PKG_MANGER="sudo apt-get install" | |
HOME="/home/simlegate" | |
echo $PKG_MANGER | |
echo "正在安装Git......." | |
nohup $PKG_MANGER git |
(ns logger.core) | |
(defn print-logger | |
[writer] | |
#(binding [*out* writer] | |
(println %))) | |
;; 将消息打印到一个内存buffer | |
(def writer (java.io.StringWriter.)) |
分为三
步:
-
同步gems mirror
安装rubygems-mirror 原来的rubygems-mirror好像有问题,所以使用@huacnlee改过的gem
按照README.md说明配置.mirrorrc# 国内最好用taobao的源,rubygems经常被墙 --- - from: http://ruby.taobao.org to: /data/rubygems
# $ gem mirror | |
# ERROR: Install the rubygems-mirror gem for the mirror command | |
# From: http://qiita.com/yoshiori/items/463de8be446cda6d67ca | |
require 'rubygems/mirror/command' | |
Gem::Commands::MirrorCommand.new.execute |