git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bashrc
exec $SHELL
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
class ApplicationFinder | |
include ActiveModel::Model | |
include ActiveModel::Attributes | |
private_class_method :new | |
class_attribute :model | |
class_attribute :rules, default: [] | |
class << self |
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
class ApplicationForm | |
include ActiveModel::Model | |
include ActiveModel::Attributes | |
def self.copy_validations_from(model) | |
attribute_types.keys.each do |key| | |
model.validators_on(key).each do |validator| | |
validates(key, validator.kind => validator.options) | |
end | |
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
#!/usr/bin/env ruby | |
require 'pathname' | |
require 'fileutils' | |
include FileUtils | |
# path to your application root. | |
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) | |
def system!(*args) | |
system(*args) || abort("\n== Command #{args} failed ==") |
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
class ApplicationForm | |
include ActiveModel::Model | |
include ActiveModel::Attributes | |
def self.copy_validations_from(model) | |
attribute_types.keys.each do |key| | |
model.validators_on(key).each do |validator| | |
validates(key, validator.kind => validator.options) | |
end | |
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
# apps/web/config/routes.rb | |
get '/', to: 'home#index' | |
get '/show', to: 'home#show' |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
var Hoge; | |
(function() { | |
var instance; | |
Hoge = function Hoge(argument1, argument2) { | |
if (instance) { | |
return instance; | |
} | |
instance = this; |
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 "octokit" | |
before_rep = "name/repname" | |
after_rep = "other_name/other_repname" | |
client = Octokit::Client.new(access_token: ENV["GITHUB_API_TOKEN"]) | |
options = { | |
state: :all |
- http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html
- http://api.rubyonrails.org/classes/ActiveRecord/Base.html#class-ActiveRecord::Base-label-Single+table+inheritance
- Message
- GoodMessage(Messageを継承)
- BadMessage(Messageを継承)
NewerOlder