Skip to content

Instantly share code, notes, and snippets.

@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 / controller_macros.rb
Created August 24, 2013 04:25
Rspec spec/support files.
module ControllerMacros
def login_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
user = FactoryGirl.create(:user)
user.confirm!
sign_in user
end
end
end
@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

Untitled Slide

Welcome to Glide.

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

Publishing

@saboyutaka
saboyutaka / turbolinks_note.md
Last active October 5, 2022 08:45
Turbolinksを調べてみた