class Group < ActiveRecord::Base
attr_accessible :name
has_many :users, dependent: :destroy
end
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
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{HTTP_HOST} ^foo.bar.baz$ | |
| RewriteRule ^(.*)$ http://foo.bar/$1 [L,R=301] | |
| </IfModule> |
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
| <% if object.errors.any? %> | |
| <div id="error_explanation"> | |
| <div class="alert alert-error"> | |
| The form contains <%= pluralize(object.errors.count, "error") %>. | |
| </div> | |
| <ul> | |
| <% object.errors.full_messages.each do |msg| %> | |
| <li>* <%= msg %></li> | |
| <% end %> | |
| </ul> |
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
| rails new app --skip-test-unit | |
| cd app | |
| bundle update | |
| bundle install --without production | |
| rails generate rspec:install | |
| rails generate model User name:string | |
| rails generate controller Users new --no-test-framework | |
| rails generate integration_test user_pages |
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
| require 'spec_helper' | |
| describe User do | |
| before { @user = User.new(name: "Example User", email: "user@example.com", password: "foobar", password_confirmation: "foobar") } | |
| subject { @user } | |
| it { should respond_to(:name) } | |
| it { should respond_to(:email) } |
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
| <?php | |
| class Foo { | |
| var $bar; | |
| var $baz; | |
| function Foo($options = array()) { | |
| if (!empty($options)) { | |
| $this->setOptions($options); | |
| } | |
| } |
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
| <!--[if lt IE 7]> | |
| <p>IE 7 未満</p> | |
| <![endif]--> | |
| <![if gte IE 7 ]> | |
| <p>IE 7 以上 && IE 以外</p> | |
| <![endif]> |
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
| 置換 | |
| controll + V の ^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
| export SVN_EDITOR=vim | |
| export PATH=$HOME/bin:$HOME/.phpenv/bin:$HOME/.rbenv/shims:/usr/local/bin:/usr/local/mysql/bin/:/Users/Shared/android-sdk-macosx/platform-tools:/Users/Shared/android-ndk-r8:$PATH | |
| . ~/nvm/nvm.sh | |
| ### Titanium Mobile | |
| #alias androidbuilder='$HOME/Library/Application\ Support/Titanium/mobilesdk/osx/2.1.2.GA/android/builder.py' | |
| #alias iosbuilder='$HOME/Library/Application\ Support/Titanium/mobilesdk/osx/2.1.2.GA/iphone/builder.py' | |
| ##phpfarm | |
| #export PHP_HOME=$HOME/local/php/versions |
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
| <?php | |
| $hiraganaTable = array( | |
| 'a' => array('a' => 'あ', 'ka' => 'か', 'sa' => 'さ', 'ta' => 'た', 'na' => 'な', 'ha' => 'は', 'ma' => 'ま', 'ya' => 'や', 'ra' => 'ら', 'wa' => 'わ'), | |
| 'i' => array('i' => 'い', 'ki' => 'き', 'shi' => 'し', 'chi' => 'ち', 'ni' => 'に', 'hi' => 'ひ', 'mi' => 'み', 'yi' => '', 'ri' => 'り', 'wi' => ''), | |
| 'u' => array('u' => 'う', 'ku' => 'く', 'su' => 'す', 'tsu' => 'つ', 'nu' => 'ぬ', 'hu' => 'ふ', 'mu' => 'む', 'yu' => 'ゆ', 'ru' => 'る', 'wu' => ''), | |
| 'e' => array('e' => 'え', 'ke' => 'け', 'se' => 'せ', 'te' => 'て', 'ne' => 'ね', 'he' => 'へ', 'me' => 'め', 'ye' => '', 're' => 'れ', 'we' => ''), | |
| 'o' => array('o' => 'お', 'ko' => 'こ', 'so' => 'そ', 'to' => 'と', 'no' => 'の', 'ho' => 'ほ', 'mo' => 'も', 'yo' => 'よ', 'ro' => 'ろ', 'wo' => ''), | |
| ); |