Ubuntu+Nginx+Unicorn+Rails+Capistrano — Gist
この記事から設定を例として抽出
定義更新する
| 首页 | |
| http://www.growcn.com/dhhx/api/homepage.json?page=1 | |
| 公告 | |
| http://www.growcn.com/dhhx/api/adtopic.json | |
| 详细 | |
| http://www.growcn.com/dhhx/api/detail.json?id=102126 | |
| 总细页 | |
| http://www.growcn.com/dhhx/api/funtop.json?page=1 |
| # -*- encoding: utf-8 -*- | |
| require 'mini_magick' | |
| require 'rtesseract' | |
| require 'nokogiri' | |
| require 'nestful' | |
| require 'csv' | |
| require 'pp' | |
| class Buy360 | |
| def initialize(url='') |
Ubuntu+Nginx+Unicorn+Rails+Capistrano — Gist
この記事から設定を例として抽出
定義更新する
| /** | |
| * The first commented line is your dabblet’s title | |
| */ | |
| background: #f06; | |
| background: linear-gradient(45deg, #f06, yellow); | |
| min-height: 100%; |
| #!/bin/bash | |
| rm -rf api.rubyonrails.org/ | |
| wget -r -k -p http://api.rubyonrails.org/ | |
| rm rails_api.rar | |
| rar a -r rails_api.rar api.rubyonrails.org/ |
http://www.zhlwish.com/2012/07/23/rails-activesupport-concern/
# autoload concerns
module YourApp
class Application < Rails::Application
# config.autoload_paths += %W(
# #{config.root}/app/controllers/concerns/
# #{config.root}/app/models/concerns/
# )| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| end | |
| end |
| # 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度 | |
| # 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装 | |
| # 做这个起什么作用? | |
| # rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。 | |
| # 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外 | |
| proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m | |
| inactive=24h max_size=1g; | |
| server { | |
| listen 80; |
| See question on stack overflow: http://stackoverflow.com/questions/28595636/rails-4-how-to-give-alias-names-to-includes-and-joins-in-active-record-que | |
| - Model Student and model Teacher are both STI models with super class model User | |
| - Model Story is a STI model with super class model Task | |
| - includes() and joins(), both fails | |
| Rails alias naming convention (includes() and joins()) | |
| - One model as parameter | |
| - is base model (includes(:users)) |
| #!/usr/bin/env bash | |
| # Check for Homebrew, install if we don't have it | |
| if test ! $(which brew); then | |
| echo "Installing homebrew..." | |
| ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| fi | |
| # Update homebrew recipes | |
| # brew update |