Skip to content

Instantly share code, notes, and snippets.

View lanrion's full-sized avatar
🎯
Focusing

lanrion lanrion

🎯
Focusing
  • guǎng zhōu
View GitHub Profile
@lanrion
lanrion / gist:f9590b7b9c0419365fbf
Created September 18, 2014 00:57
change Linux Terminal default EDITOR

修改默认编辑器命令:

echo export EDITOR=/usr/bin/vim
@lanrion
lanrion / gist:02004e0108db405b1c72
Created September 15, 2014 08:04
svn2git usage

使用的插件如下:https://github.com/nirvdrum/svn2git

检查项目SVN中有没有使用 trunk, branches, tags ,如果都没有所以在fetch时指定 "--notrunk --notags --nobranches " 即可。

下面命令是转换 weixin_test的使用命令:

svn2git svn://denght@192.168.0.30/lanrion/website/weixin_test --username denght --notrunk --no-minimize-url --notags --nobranches --verbose
@lanrion
lanrion / gist:9ad77c25b827b6744b07
Created September 2, 2014 03:06
JavaScript 中2个等号与3个等号的区别
一直挺纠结这个问题的。
首先,== equality 等同,=== identity 恒等。
==, 两边值类型不同的时候,要先进行类型转换,再比较。
===,不做类型转换,类型不同的一定不等。
@lanrion
lanrion / gist:65c4ea3190fee8271880
Created August 20, 2014 18:44
Iterating Through Time With Rails

循环时间:

Range.new(Time.now.to_i, 5.days.from_now.to_i).step(1.day) do |seconds_since_epoch|
  time = Time.at(seconds_since_epoch)
  puts time
end
@lanrion
lanrion / gist:7ab76f5f40f5e6adba32
Created August 18, 2014 06:15
UnderscoreAttributeNameConcern
module UnderscoreAttributeNameConcern
  extend ActiveSupport::Concern
  included do |included_class|
    included_class.column_names.each do |attr_name|
      method_name = attr_name.underscore
      define_method(method_name) do
        read_attribute(attr_name)
 end
@lanrion
lanrion / gist:ca7903b2a17b4cb1ce37
Created August 15, 2014 14:47
nginx 允许自定义header头通过
nginx 允许自定义header头通过:
ignore_invalid_headers off;
underscores_in_headers off;
@lanrion
lanrion / gist:f054b643c38b5e299b5c
Created August 14, 2014 15:57
rails composed_of
http://devdocs.io/rails/activerecord/aggregations/classmethods#method-i-composed_of
http://www.cnblogs.com/orez88/articles/1707653.html
@lanrion
lanrion / gist:8fe168a07fcd86553be2
Last active August 29, 2015 14:05
ruby mssql server gem

在 Mac上 使用 mssql server的gem:

brew update  # always a good idea to update homebrew before installing anything!
brew install freetds
gem install tiny_tds -- --with-freetds-dir=/usr/local/freetds

Ubuntu上可能(未试验)是:

@lanrion
lanrion / gist:64095dd94150520ff9ac
Created August 11, 2014 03:51
git sync remote tags

git fetch --prune --tags