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
RSpec.configure do |config| | |
config.expect_with :rspec do |expectations| | |
expectations.include_chain_clauses_in_custom_matcher_descriptions = true | |
end | |
config.mock_with :rspec do |mocks| | |
mocks.verify_partial_doubles = true | |
end | |
config.filter_run :focus |
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 ApplicationController | |
before_action :set_locale | |
private | |
def set_locale | |
if authenticated? | |
I18n.locale = current_user.locale | |
else | |
langs = (request.headers['HTTP_ACCEPT_LANGUAGE'] || '').split(',').map { |l| l.split(';').first } |
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
.Trash | |
.cabal | |
.cpanm | |
.dropbox | |
.emacs.d | |
.gem | |
.gemrc | |
.ghc | |
.gitconfig | |
.gitignore |
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 'vc-git) | |
(require 'anything-config) | |
(defgroup anything-rails nil | |
"anything for rails" | |
:prefix "anything-rails:" | |
:group 'anything) | |
(defun anything-rails:root () | |
(vc-git-root default-directory)) |
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 'rinari) の下あたりにコペピ | |
(setq rinari-controller-keywords | |
(append rinari-controller-keywords | |
'("before_action" "append_before_action" "prepend_before_action" | |
"after_action" "append_after_action" "prepend_after_action" | |
"around_action" "append_around_action" "prepend_around_action" | |
"skip_before_action" "skip_after_action" "skip_around_action"))) |
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
# これを config/application.rb 内にコペピする | |
# 参考: http://guides.rubyonrails.org/generators.html#customizing-your-workflow-by-changing-generators-templates | |
config.generators do |g| | |
g.controller helper: false, assets: false | |
g.rspec view_specs: false, helper_specs: false | |
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
def tuyosa(id) | |
score = 50 | |
score -= (id.size - 1) | |
id.chars.each do |char| | |
score -= 1 if char =~ /_/ | |
score -= 1 if char =~ /[A-Z]/ | |
score -= 2 if char =~ /[0-9]/ | |
end | |
score * 2 | |
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
class ApplicationForm | |
include ActiveModel::Model | |
def submit(params = {}) | |
params.each do |key, value| | |
self.public_send("#{key}=", value) | |
end | |
self | |
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
/.bundle/ | |
/.yardoc | |
/Gemfile.lock | |
/_yardoc/ | |
/coverage/ | |
/doc/ | |
/pkg/ | |
/spec/reports/ | |
/tmp/ | |
*.bundle |
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 'parslet' | |
module Kansuji | |
NUMBERS = %w{一 二 三 四 五 六 七 八 九} | |
DIGITS = %w{十 百 千} | |
UNITS = %w{万 億 兆 京 垓 𥝱 穣 溝 澗 正 載 極 恒河沙 阿僧祇 那由他 不可思議 無量大数} | |
def self.parser | |
@parser ||= Parser.new | |
end |