Skip to content

Instantly share code, notes, and snippets.

@saboyutaka
saboyutaka / Brewfile
Last active October 10, 2015 05:39
Brewfile
tap 'phinze/homebrew-cask'
tap 'homebrew/versions'
brew 'brew-cask'
brew 'ag'
brew 'automake'
brew 'ctags'
brew 'curl'
brew 'gcc'
@saboyutaka
saboyutaka / symbolic_link.sh
Last active October 10, 2015 05:40
symbolic_link.sh
@saboyutaka
saboyutaka / build_dev_env.sh
Created October 12, 2015 06:52
How build development environment for Mac
# Install Homebrew (skip if it's already installed)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# Install rbenv(if you use zsh, replace .bash_profile with .zprofile)
brew install rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
brew install ruby-build
brew install rbenv-gemset
@saboyutaka
saboyutaka / .rubocop.yml
Last active December 21, 2015 15:19
Rubocop settings for Rails
# See default settings https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
AllCops:
Includes:
- '**/Rakefile'
Excludes:
- 'vendor/bundle/**/*'
- 'db/schema.rb'
- 'config/initializers/secret_token.rb'
- 'spec/support/share_db_connection.rb'
@saboyutaka
saboyutaka / .gitignore
Last active December 21, 2015 15:19
.gitignore for Rails
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*.log
tmp/**/*
/tmp/*
/db/*.sqlite3*
@saboyutaka
saboyutaka / Gemfile
Last active December 21, 2015 15:19
Fundamental gems for Rails4.
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
# MySQL
# gem 'mysql2'
# Assets
gem 'slim'
@saboyutaka
saboyutaka / Guardfile
Created August 24, 2013 04:31
Guardfile for Rails.
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'active_support/inflector'
guard :rubocop, cli: ['--format', 'clang', '--silent'] do
watch(%r{.+\.rb$})
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
@saboyutaka
saboyutaka / pry-stack_explorer.rb
Last active December 21, 2015 20:39
Prevent outputting 'Frame number' when guard is executed. pry-stack_explorer が Guard 実行時に常に表示されるのを防ぐ。
# monkey-patch the whereami command to show some frame information,
# useful for navigating stack.
Pry.config.commands.before_command("whereami") do |num|
if PryStackExplorer.frame_manager(_pry_) && !internal_binding?(target)
bindings = PryStackExplorer.frame_manager(_pry_).bindings
binding_index = PryStackExplorer.frame_manager(_pry_).binding_index
# Add here
# Ignore outputs when Frame number: 0/0 or 0/1
unless binding_index == 0 && bindings.size <= 2
@saboyutaka
saboyutaka / application.html.slim
Last active December 25, 2015 22:29
application.html.slim
doctype html
html
head
title Title
= stylesheet_link_tag 'application', media: 'all', data: {turbolinks_track: true }
= javascript_include_tag 'application', data: {turbolinks_track: true }
= csrf_meta_tags
body
== yield
@saboyutaka
saboyutaka / gist:7905711
Created December 11, 2013 05:58
seeds file
%w(Seeds).each do |seed|
seed_file = "#{Rails.root}/db/seeds/fixtures/#{seed.pluralize.tableize}.rb"
if File.exists?(seed_file)
puts "Creating #{seed} seed data"
require seed_file
end
end