基礎知識
読み物系
| # application_controller.rbに定義 | |
| def authenticate | |
| redirect_to :root unless current_user | |
| end | |
| # 認証の必要なコントローラーの最初の行にbefore_filterを定義 | |
| class HogeController | |
| before_filter authenticate # ←コレ |
| def authenticate | |
| redirect_to root_url unless current_user | |
| end |
基礎知識
読み物系
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.
原文:Scaling Isomorphic Javascript Code (This is just for study, please contact me at tily05 atmark gmail.com if any problem.)
考えてみれば Model-View-Controller とか MVC ってよく聞くよね。実際どんなものか知ってる? 抽象的に言うなら「オブジェクト情報の保持されるグラフィック・システム (つまり、ラスターではないグラフィック。ゲームとか) 上に構築された、表示系を中心としたアプリケーションにおいて、主要な機能どうしの関わりをうまく分離すること」とでも言おうか。もう少し深く考えを押し進めてみれば、これは当然、他のさまざまなアプリケーションにもあてはまる言葉 (bucket term ?) だ。
過去に多くの開発コミュニティが MVC による解決案を提供し、それによってよくあるユースケースにうまく対処し、地位を築くことができた。例をあげるなら、Ruby や Python コミュニティは Rails や Django を作り、MVC アーキテクチャを実現した。
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Ansi 0 Color</key> | |
| <dict> | |
| <key>Blue Component</key> | |
| <real>0.0</real> | |
| <key>Green Component</key> | |
| <real>0.0</real> |
| #!/opt/local/bin/ruby1.9 | |
| #-*-encoding: utf-8-*- | |
| class Env < Hash | |
| def initialize(parms=[], args=[], outer=nil) | |
| h = Hash[parms.zip(args)] | |
| self.merge!(h) | |
| @outer = outer | |
| end | |
| def find(key) |
| //based on the source of http://g.raphaeljs.com/linechart.html | |
| var options = { | |
| axis: "0 0 1 1", // Where to put the labels (trbl) | |
| axisxstep: 16 // How many x interval labels to render (axisystep does the same for the y axis) | |
| }; | |
| document.addEventListener('DOMContentLoaded', function () { | |
| // Make the raphael object |