- deeeki (でーき) といいます
- プログラミング経験はPHPがおおいです
- Web: http://deeeki.com/
- Blog: http://d.hatena.ne.jp/deeeki/
{{>toc}}
This file contains 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
#create ctags file | |
ctags -f tags --totals -R `pwd` | |
#grep under spaced filename | |
find . -print0 | xargs -0 grep searchword | |
#show hidden files on Mac. via: http://d.hatena.ne.jp/shunsuk/20090714/1247567640 | |
defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder | |
#hide hidden files on Mac | |
defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder | |
#urlencode | |
echo '' | nkf -MQ | tr = % |
This file contains 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
source "http://rubygems.org" | |
gem 'mechanize' |
This file contains 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
class wp_atnd_widget extends WP_Widget { | |
//クラスメソッド | |
static public function register() { | |
register_widget('wp_atnd_widget'); | |
} | |
//... | |
} | |
//クラスメソッドでフック | |
add_action('widgets_init', array('wp_atnd_widget', 'register')); |
This file contains 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
/Users/deeeki/dev/src/myapp/vendor/bundle/ruby/1.9.1/gems/rails_best_practices-1.6.0/lib/rails_best_practices/core/routes.rb:27:in `controller_name_with_namespaces': undefined method `camelize' for nil:NilClass (NoMethodError) | |
from /Users/deeeki/dev/src/myapp/vendor/bundle/ruby/1.9.1/gems/rails_best_practices-1.6.0/lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb:82:in `block in after_review' | |
from /Users/deeeki/dev/src/myapp/vendor/bundle/ruby/1.9.1/gems/rails_best_practices-1.6.0/lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb:80:in `each' | |
from /Users/deeeki/dev/src/myapp/vendor/bundle/ruby/1.9.1/gems/rails_best_practices-1.6.0/lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb:80:in `after_review' | |
from /Users/deeeki/dev/src/myapp/vendor/bundle/ruby/1.9.1/gems/rails_best_practices-1.6.0/lib/rails_best_practices/core/check.rb:224:in `block (2 levels) in included' | |
from /Users/deeeki/dev/src/myapp/vendor/bundle/ruby |
This file contains 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
require 'mechanize' | |
SITE_URL = 'http://www.hituji.jp' | |
INFO_URL = "#{SITE_URL}/comret/info" | |
a = Mechanize.new | |
links = a.get(INFO_URL).search('.searchAreaElement').at('td').search('a').map do |city| | |
city['href'] | |
end |
-
legacy wild controller route ':controller(/:action(/:id))(.:format)' は使わない派
-
利用するURLを明示しておきたい
-
named_route使えないとリンクの記述が冗長になるのでは
-
namespaceなど少し複雑なことをやろうとすると何かしらルーティングを書くことになり、統一感がなくなる
-
確認画面
- confirmアクションの追加
- 各アクションがすっきりする
- 新規と編集で挙動が変わる場合 (edit_confirmアクション?)
- confirmアクションの追加
-
パラメータ(mode=confirm)またはモデルの確認用プロパティ(http://bit.ly/mRQ8I5)
OlderNewer