View Gemfile
source "https://rubygems.org"
gem "google-api-client", "0.8.6"
gem "pry"
gem "oauth2"
View application.rb
# これを 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
View grep.rb
require 'formula'
class Grep < Formula
url 'http://ftp.gnu.org/gnu/grep/grep-2.18.tar.xz'
sha1 'fdb12580714966745635da7d9db55060f88db28b'
version '2.18'
depends_on 'pcre'
def install
View 00.md

Better Java としての Scala

Hello World

  • src/main/scala/Main.scala
object Main {
  def main(args: Array[String]): Unit = {
    println("hello scala!")
View boolianize.rb
require 'active_support/core_ext'
require 'minitest/unit'
String.instance_eval do
define_method :method_missing do |method, *args|
ActiveSupport::StringInquirer.new(self).send(method)
end
end
Symbol.instance_eval do
View user.rb
class User < ActiveRecord::Base
include ValidationContext
with_context :first do |context|
context.validates_presence_of :name
end
with_context :second do |context|
context.validates_presence_of :email
end
View java7.yml
---
- name: ensure required packages are installed for Java 7
apt: name=$item state=latest update_cache=yes
with_items:
- python-software-properties
- name: Add Java repository to sources
action: apt_repository repo='ppa:webupd8team/java'
View omni.rb
OmniAuth.config.full_host = ->(env) {
scheme = if env['HTTPS'] == 'on' or env['HTTP_X_FORWARDED_SSL'] == 'on'
'https'
elsif env['HTTP_X_FORWARDED_PROTO'].present?
env['HTTP_X_FORWARDED_PROTO'].split(',').first.strip
else
env['rack.url_scheme']
end
hostname = env['HTTP_X_FORWARDED_HOST'].present? ? env['HTTP_X_FORWARDED_HOST'] : env['HTTP_HOST']
View gist:5798113

31年、人生で生きてきて一人暮らし歴が長く、避けたほうが良い物件は以下の形になる

  • 台所が部屋と同じ
    • ウォーターハンマー音との戦いになりがち
  • 分譲賃貸じゃない
    • 作りがやばい
  • 大通り沿い
    • これは条件によるかもしれないが、あんま便利じゃない
  • 地下鉄の真上
View user.rb
class User < ActiveRecord::Base
has_secure_password validations: false
validates :password,
presence: {if: :password_required?, on: :create},
confirmation: {if: :password_required?}
validates :password_confirmation,
presence: {if: :password_present?}