- 浏览: 2077884 次
- 性别:
- 来自: NYC
最新评论
-
dadadada2x:
user模型里加上 protected def email ...
流行的权限管理 gem devise的定制 -
Sev7en_jun:
shrekting 写道var pattern = /^(0| ...
强悍的ip格式 正则表达式验证 -
jiasanshou:
好文章!!!
RPM包rpmbuild SPEC文件深度说明 -
寻得乐中乐:
link_to其实就是个a标签,使用css控制,添加一个参数: ...
Rails在link_to中加参数 -
aiafei0001:
完全看不懂,不知所然.能表达清楚一点?
"$ is not defined" 的问题怎么办
文章列表
rvm install 2.0.0
met problem about brew
引用brew unable to unlink old 'README.md' (Permission denied)
solve problem by:
sudo chmod 777 /usr/local
cd /usr/local
git remote add git://github.com/mxcl/homebrew.git
git reset --hard
git clean -f -d
git pull origin master
brew update
sudo chmo ...
Rails Helper
- 博客分类:
- Ruby On Rails
http://guides.rubyonrails.org/form_helpers.html
http://api.rubyonrails.org/classes/AbstractController/Helpers/ClassMethods.html#method-i-helper
Use view help at Controller
helper :foo # => requires 'foo_helper' and includes FooHelper
helper 'resources/foo' # => requires 'resou ...
https://github.com/chrisle/gattica
https://github.com/robmckinnon/rugalytics
https://www.ruby-toolbox.com/categories/Web_Analytics
Google api Doc
https://developers.google.com/analytics/devguides/reporting/core/v3/
# Include the gem
require 'gattica'
# Login
ga = Gattica.new({
:em ...
@page = double(:page)
%w(most_popular_content lead primary_tab_data recent_companies_data show_coroflot? coroflot).map do |method|
@page.stub!( method.to_sym )
end
@page.stub(:channel_name).and_return('technology')
view.stub(:admin?)
@channel_name = ...
ack uses Perl regular expressions, and those allow lookahead assertions:
^(?!.*bar).*foo.*$
will match a line that contains foo but doesn't contain bar.
I'm not familiar with the usage of ack, but something like this should work:
ack '^(?!.*bar).*foo.*$' myfile
#If method is POST method then
app.post'controller/action?parameter1=value1¶meter2=value2'
#[ here parameters will be as per your applicability ]
#else if it is GET method then
app.get'controller/action'
foo = ActionController::Base::ApplicationController.new
foo.some_method ...
git submodule
- 博客分类:
- git
# get the submodule initially
git submodule add ssh://bla submodule_dir
git submodule init
#git submodule update
# time passes, submodule upstream is updated
# and you now want to update
# change to the submodule directory
cd submodule_dir
# checkout desired branch
git checkout master
...
gem 'my_private_gem', :path => "vendor/gems/my_private_gem-VERSION"
gem list | awk '{print $1}' | xargs gem unpack --target vendor/gems
bundle install --deployment. This will install the gems, in their unpacked state, in vendor/bundle.
Package up all your .gem files in vendor/ca ...
du -sh `ls .`
for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11
dir | gvim -
#output to vim
#the - option tells vim to open stdin
dir | gvim -
#inside vim
:r !<cmd>
:r !dir
df -k .
Show size of current directory in
du -sh `ls .`
du -h | tail -n 1 ...
If you want to also remove directories, run git clean -f -d.
If you just want to remove ignored files, run git clean -f -X.
If you want to remove ignored as well as non-ignored files, run git clean -f -x.
reset remote branch
git fetch origin
git reset --hard origin/master
#git fetch uses:
refs/heads/<head>:refs/heads/<branch>
#git push uses:
HEAD:refs/heads/<head>
remote config
[remote "<name>"]
url = <url&g ...
git log -S<string> path/to/file
git log -SFoo -- path_containing_change
git log -SFoo -- path_containing_change --since=2009.1.1 --until=2010.1.1
To search for commit content (i.e., actual lines of source, as opposed to commit messages and the like), what you need to do is:
git grep <r ...
Problem:
Sign in
Sign out
Sign in (successful 201. However prints WARNING: Can't verify CSRF token authenticity in server logs)
Subsequent ajax request fails 401 unauthorised
Refresh the website (at this point, CSRF in the page header changes to something else)
I can sign in ...
Reference
update
only thing is about the format and there are set and add.
If, like me, you've recently discovered the wonderful speed of the ack search tool, you may be frustrated to find that it ignores some of your source code. Files that you know should be appearing in your search results just ...
#/.bashrc
export http_proxy=http://username:password@proxy_server:proxy_port/
#/etc/apt/apt.conf.d/30proxy
Acquire::http::Proxy "http://username:password@proxy_server:proxy_port/";
sudo apt-get update