Skip to content

Instantly share code, notes, and snippets.

View liwh's full-sized avatar
🎯
Focusing

robie lee liwh

🎯
Focusing
View GitHub Profile
/Users/Apple/.rvm/gems/ruby-1.9.2-p180@shopqi/gems/mail-2.2.18/lib/mail/core_extensions/smtp.rb:14: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
-- control frame ----------
c:0041 p:---- s:0165 b:0165 l:000164 d:000164 CFUNC :connect
c:0040 p:0069 s:0162 b:0162 l:000161 d:000161 METHOD /Users/Apple/.rvm/gems/ruby-1.9.2-p180@shopqi/gems/mail-2.2.18/lib/mail/core_extensions/smtp.rb:14
c:0039 p:0255 s:0157 b:0156 l:0026b0 d:0026b0 METHOD /Users/Apple/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/smtp.rb:566
c:0038 p:0047 s:0148 b:0148 l:000147 d:000147 METHOD /Users/Apple/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/smtp.rb:525
c:0037 p:0496 s:0141 b:0141 l:000140 d:000140 METHOD /Users/Apple/.rvm/gems/ruby-1.9.2-p180@shopqi/gems/mail-2.2.18/lib/mail/network/delivery_methods/smtp.rb:128
c:0036 p:0031 s:0130 b:0130 l:000129 d:000129 METHOD /Users/Apple/.rvm/gems/ruby-1.9.2-p180@shopqi/gems/mail-2.2.18/lib/mail/message.rb:1989
@liwh
liwh / gist:998952
Created May 30, 2011 14:10
unix command
统计文件行数:
find path -name "*.format" -print | xargs wc -l
干掉进程: pidof| brew install pidof
kill `pidof NAME`
@liwh
liwh / rails_3_1_beta_1_changes.md
Created May 6, 2011 05:27 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 Beta 1

  • The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]

  • jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]

  • Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]

  • The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]

Make sure that you don't allow attributes to be mass assigned from Backbone saves -- always whitelist and validate your incoming attributes. We use a helper function like this:
def pick(hash, *keys)
filtered = {}
hash.each do |key, value|
filtered[key.to_sym] = value if keys.include?(key.to_sym)
end
filtered
end
@liwh
liwh / gist:921442
Created April 15, 2011 09:17
got rails g jquery:install open ssl error
when we using above generate cli ,got the
`connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
we can add this in our rails application.rb file . after we install the juqery ,we can delete it
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
@liwh
liwh / gist:903569
Created April 5, 2011 13:21
AbstractController::ActionNotFound
当使用devise test的时候,出现上面的错误的时候。 我们得加入:
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
end
@liwh
liwh / gist:900175
Created April 3, 2011 04:17
这里记录mongo class的常见错误
class Aa
include Mongoid::Document
embedded_in :Bb,:inverse_of => Aas
end
这是,我们不能直接调用Aa.first了,会报Exception: Mongoid::Errors::InvalidCollection,因为,我们不能直接调用一个embedded document的
Started POST "/products/upload" for 10.0.2.2 at 2011-04-02 09:32:59 -0700
Processing by ProductsController#upload as HTML
Parameters: {"authenticity_token"=>"BzEqlVKPZdsgez1zKBBlFa6sF/TVrQGq+wWIlv5XASI=", "id"=>"4d974f7f5585d322a1000004", "photo"=>{"file"=>#<ActionDispatch::Http::UploadedFile:0xb157434 @original_filename="252320434a6.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"photo[file]\"; filename=\"252320434a6.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20110402-8865-71g0vl>>}}
MONGODB shopqi_development['users'].find({:_id=>BSON::ObjectId('4d974c8e5585d34c3c000001')})
MONGODB shopqi_development['stores'].find({:_id=>BSON::ObjectId('4d974c8e5585d34c3c000002')})
MONGODB shopqi_development['products'].find({"store_id"=>BSON::ObjectId('4d974c8e5585d34c3c000002'), :_id=>BSON::ObjectId('4d974f7f5585d322a1000004')})
qi_development['products'].update({"_id"=>BSON::ObjectId('4d974f7f5585d322a1000004')}, {"$pushAll"=>{"photos"=>[{"_id"=>BSON
[default] [Wed, 30 Mar 2011 23:07:25 -0700] DEBUG: ---- Begin output of /etc/init.d/nginx status ----
[Wed, 30 Mar 2011 23:07:25 -0700] DEBUG: STDOUT: run: nginx: (pid 2914) 1662s; run: log: (pid 648) 1812s
[Wed, 30 Mar 2011 23:07:25 -0700] DEBUG: STDERR:
[Wed, 30 Mar 2011 23:07:25 -0700] DEBUG: ---- End output of /etc/init.d/nginx status ----
[Wed, 30 Mar 2011 23:07:25 -0700] DEBUG: Ran /etc/init.d/nginx status returned 0
[default] /usr/local/rvm/gems/ruby-1.9.2-p180/gems/chef-0.9.12/lib/chef/provider/service.rb:91:in `action_reload': stderr
[default] : : stderr
[default] #<Chef::Provider::Service::Debian:0xa9bfb40> does not support :reload: stderr
[default] (: stderr
[default] Chef::Exceptions::UnsupportedAction: stderr
@liwh
liwh / gist:894109
Created March 30, 2011 09:13
reload functon for zsh completion
#when we create new function or install new bin , the default zsh cant get the new completion for us,so we
#can add a new function for this problem,you can add the blow content in your .zshrc file
function reload() {
if [[ "$#*" -eq 0 ]]; then
test -r /etc/zsh/zsh-oli && . /etc/zsh/zsh-oli
test -r ~/.zshrc && . ~/.zshrc
return 0
else
local fn
for fn in $*; do