Skip to content

Instantly share code, notes, and snippets.

@fffx
fffx / deploy.rb
Created February 27, 2016 08:30
Deply Rails App with Puma and Nginx via Mina
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
set :domain, 'esdb.cn'
set :identity_file, '/User/somebody/.ssh/somebody.pem'
set :deploy_to, '/home/ubuntu/apps/xxx.com'
set :repository, 'ssh://git@bitbucket.org/somebody/xxx.com.git'
set :branch, 'master'
@fffx
fffx / NERDTree.mkd
Last active July 19, 2016 14:58 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@fffx
fffx / README.md
Created August 4, 2016 14:08 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@fffx
fffx / tmux-cheatsheet.markdown
Created December 20, 2016 01:21 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fffx
fffx / ssl.md
Created January 30, 2017 08:37 — forked from clowwindy/ssl.md
为什么不应该用 SSL 翻墙

SSL 设计目标:

  1. 防内容篡改
  2. 防冒充服务器身份
  3. 加密通信内容

而翻墙的目标:

  1. 不被检测出客户端在访问什么网站
  2. 不被检测出服务器在提供翻墙服务
@fffx
fffx / migration_integer_limit_option
Created March 15, 2017 07:53 — forked from stream7/migration_integer_limit_option
Rails migrations integer :limit option
literally always have to look up the meaning of :limit in migrations when it comes to integer values. Here's an overview. Now let's memorise it (oh, this works for MySQL, other databases may work differently):
:limit Numeric Type Column Size Max value
1 tinyint 1 byte 127
2 smallint 2 bytes 32767
3 mediumint 3 byte 8388607
nil, 4, 11 int(11) 4 byte 2147483647
5..8 bigint 8 byte 9223372036854775807
Note: by default MySQL uses signed integers and Rails has no way (that I know of) to change this behaviour. Subsequently, the max. values noted are for signed integers.
@fffx
fffx / index.md
Created March 16, 2017 03:33 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@fffx
fffx / solution.md
Last active March 31, 2017 05:31
webpack-dev-server detect file changes and auto compile in ubuntu 16.04

$ webpack-dev-server --content-base ./ --port <port> --hot

#检测文件改动webpack 是否察觉 webpack --watch --progress

#如果改动文件(并保存), webpack没有察觉 , 则执行

$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

@fffx
fffx / .pryrc
Created March 31, 2017 07:40 — forked from bespokoid/.pryrc
# === EDITOR ===
Pry.editor = 'vim'
# == Pry-Nav - Using pry as a debugger ==
Pry.commands.alias_command 'c', 'continue' rescue nil
Pry.commands.alias_command 's', 'step' rescue nil
Pry.commands.alias_command 'n', 'next' rescue nil
Pry.commands.alias_command 'r!', 'reload!' rescue nil
Pry.config.color = true
@fffx
fffx / permissions.txt
Last active April 5, 2017 00:55
cancan permissions
+------------+
|permissions |
+-----+------+
|
has_many through +----+ permission_id
| +--------------------+
+-----^+-> | role_permissions |
| +--------------------+
has_many through +----+ role_id
+