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
# coding: utf-8 | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :identity, fields: [:name, :email], | |
on_failed_registration: lambda{|env| IdentitiesController.action(:new).call(env)} | |
end | |
# "/auth/identity/register"をroutesで上書き出来るようにする | |
module OmniAuth | |
module Strategies | |
class Identity |
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 | |
# coding: utf-8 | |
require 'logger' | |
logger = Logger.new(STDOUT) | |
# 予期しない例外等での終了を補足してログ出力を行う | |
Signal.trap(:EXIT) { logger.fatal($!) if $! && !($!.is_a?(SystemExit) && $!.success?) } |
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/lib/jenkins/.rvm/bin/rvm-shell ruby-1.9.2 | |
BUNDLE_GEMFILE=$WORKSPACE/Gemfile | |
RAILS_ENV=test | |
bundle install --path vendor/bundle | |
LD_LIBRARY_PATH=/usr/local/lib | |
rake db:migrate | |
rake spec |
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
# coding: utf-8 | |
# Loads action_mailer settings from email.yml | |
# and turns deliveries on if configuration file is found | |
filename = File.join(File.dirname(__FILE__), '..', 'email.yml') | |
if File.file?(filename) | |
mailconfig = YAML::load_file(filename) | |
if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env) | |
mailconfig[Rails.env].each do |k, v| | |
v.symbolize_keys! if v.respond_to?(:symbolize_keys!) |
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 Integer | |
def rand_s(char_set=('0'..'z')) | |
c=char_set.to_a | |
self.times.inject([]){|a|a<<c[rand(c.size)]}.join | |
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
# | |
# config/initializers配下におく | |
# | |
if defined?(Jpmobile) | |
class ActionDispatch::Request | |
def reset_session | |
session.destroy if session && session.respond_to?(:destroy) | |
@env['action_dispatch.request.flash_hash'] = nil | |
# session.inspect を挟むと session_options[:id] で | |
# セッションIDが取得できるようになる? |
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
:vimgrep /pattern/j path/to/**/*.txt | cwin |
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
ActiveRecord::Base.logger = Logger.new(STDOUT) |
NewerOlder