This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Because some developers don't want to use Turbolinks from the Rails 4 default, here's how you do it. | |
In your Gemfile: Remove the line gem 'turbolinks' | |
In your app/views/layouts/application.html.erb: Remove "data-turbolinks-track" => true in stylesheet_link_tag and javascript_include_tag | |
In your app/assets/javascripts/application.js: Remove //= require turbolinks | |
That's it. Prost! :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start on runlevel [2345] or net-device-up IFACE!=lo | |
stop on runlevel [06] | |
env PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/rvm/bin | |
chdir "/data/sites/festival" | |
script | |
rvm 2.0.0 exec bundle exec puma -C "/data/sites/festival/config/puma.conf" | |
end script | |
respawn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream festival { | |
server unix://tmp/festival.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name festival; | |
root /data/sites/festival/public; | |
access_log /var/log/nginx/festival_access.log; | |
error_log /var/log/nginx/festival_error.log; | |
location /logos/ { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pid /var/run/nginx.pid; | |
#user nginx nginx; | |
user nobody nogroup; | |
worker_processes 2; | |
events { | |
use epoll; | |
worker_connections 1024; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
生成命令,/home/howl/.rvm/bin/bootup_puma: | |
rvm wrapper ruby-1.9.3-p125-perf bootup puma | |
创建Puma的配置文件,/etc/puma/puma.rb: | |
bind 'unix:///tmp/puma.sock' | |
pidfile '/tmp/puma.pid' | |
rackup '/home/howl/one/config.ru' | |
创建服务,/etc/init.d/puma: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
set nu | |
set autoindent | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set smarttab | |
set expandtab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
set nu | |
set autoindent | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set smarttab | |
set expandtab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
gem: --no-ri --no-rdoc | |
:backtrace: false | |
:benchmark: false | |
:bulk_threshold: 1000 | |
:sources: | |
- http://ruby.taobao.org/ | |
:update_sources: true | |
:verbose: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function cleans up messy HTML that was pasted by a user to a WYSIWYG editor. | |
# Specifically it also handles messy Word\Outlook generated HTML while keeping its original formattings. | |
require 'rubygems' | |
require 'sanitize' | |
def clean_up_document(html) | |
elements = %w[p b h1 h2 h3 h4 h5 h6 strong li ul ol i br div pre p] | |
attributes = { | |
'a' => ['href', 'title'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
Dbpath = "/data/db" # database path | |
Backpath = "/backup/db" # backup directory | |
Host = "" # mongo host to connect,empty is for local | |
Database = "" # database to use. empty is for all | |
Collection = "" # collection to use | |
User = "" | |
Passwd = "" | |
Now = Time.now | |
DATE = Now.strftime("%Y-%m-%d") |