RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p247
This file contains 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 -*- | |
# gem 'pry-rails' | |
# gem 'pry-debugger' | |
# gem 'pry-exception_explorer' | |
# gem 'pry-coolline' | |
# gem 'hirb-unicode' | |
begin |
$ sudo yum -y --enablerepo epel install s3cmd
$ s3cmd --configure
/var/log/messages {
This file contains 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 -*- | |
require 'aws-sdk' | |
set :elb_name, "{ELBの名前}" | |
# 踏み台経由の場合はgatewayを設定する | |
# set :gateway, "{踏み台サーバーIP or Host}" | |
set :user, '{ユーザー名}' | |
ssh_options[:keys] = %w(/home/username/.ssh/id_rsa) | |
set :use_sudo, false |
This file contains 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
(("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a).shuffle[0...32].join |
This file contains 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 recursive_symbolize_keys! hash | |
if hash.is_a? Hash | |
hash.symbolize_keys! | |
hash.values.each {|h| recursive_symbolize_keys! h} | |
elsif hash.is_a? Array | |
hash.map {|v| recursive_symbolize_keys! v} | |
end | |
hash | |
end |
This file contains 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
// pcでユーザーエージェントを偽装されてアクセスされていても、これである程度判定できるはず | |
function isTouchDevice() { | |
return ($.browser.mobile && (('createTouch' in document) || ('ontouchstart' in document)) && ('orientation' in window)); | |
} |
This file contains 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
# rails3.2からrails newでプロジェクトを作成するときのオプションを書いておくことができる | |
# 実際にプロジェクトを作成するときは`rails new myproject`で下記オプションが勝手に適用される | |
-T -d mysql --skip-bundle |
モデルに以下のように、クラス変数を用意し、mattr_accessorでアクセスできるようにしておく
ポイントは、self.setupメソッドのyield self
# app/models/user.rb
class User < ActiveRecord::Base
mattr_accessor :hoge_setting
# デフォルト値を設定しておく
OlderNewer