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
Add these lines into ~/.gitconfig file. | |
--------------------------------------------------------------------- | |
[alias] | |
st = status | |
sh = show | |
ft = fetch | |
ci = commit | |
cm = commit -m |
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
function color_my_prompt { | |
local __user_and_host="\[\033[01;32m\]\u@\h" | |
local __cur_location="\[\033[01;34m\]\w" | |
local __git_branch_color="\[\033[31m\]" | |
local __ruby_color="\[\033[35m\]" | |
local __ruby_version='`ruby -v | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`' | |
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`' | |
local __prompt_tail="\[\033[01;34m\]$" | |
local __last_color="\[\033[00m\]" | |
#export PS1="$__user_and_host $__cur_location $__ruby_color$__ruby_version $__prompt_tail$__last_color " |
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
module UserCommonLogic | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
#Class methods | |
module ClassMethods | |
def authenticate(username, password) | |
u = find :first, :conditions => ['username = ?', username] |
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
ActiveRecord::Base.class_eval do | |
def self.validates_date(*attr_names) | |
# Set the default configuration | |
new_options = attr_names.extract_options! | |
if new_options[:compare_time] | |
configuration = { :after => Time.now.utc} | |
else | |
configuration = { :after => Date.today } |