Skip to content

Instantly share code, notes, and snippets.

View takuyan's full-sized avatar
🎯
Focusing

Takuya Kato / katton takuyan

🎯
Focusing
View GitHub Profile

Rails v1.0 読書会

ORMまわりを中心に読む

  • findしたものをARにどうやって詰めるのか

読書メモ

@takuyan
takuyan / object_ancestors.rb
Last active December 13, 2017 04:40
Objectの子クラスとその子クラスがincludeしているModuleを階層的に表示するナニカ
def prefix(depth=1)
s = ' | '
s * depth
end
def included_modules(klass, hash)
modules = Object.const_get(klass).included_modules
modules.delete(Kernel)
if modules
modules.map do |c|
@takuyan
takuyan / rails_server.log
Created January 4, 2016 13:17
ruby error on rails s
$ r s
dyld: lazy symbol binding failed: Symbol not found: _rb_data_object_alloc
Referenced from: /Users/takuyan/dev/github/scrum/vendor/bundle/gems/nokogiri-1.6.6.2/lib/nokogiri/nokogiri.bundle
Expected in: flat namespace
dyld: Symbol not found: _rb_data_object_alloc
Referenced from: /Users/takuyan/dev/github/scrum/vendor/bundle/gems/nokogiri-1.6.6.2/lib/nokogiri/nokogiri.bundle
Expected in: flat namespace
[1] 30819 trace trap rails s
$ gem install therubyracer rbenv:2.2.4
Fetching: libv8-3.16.14.13.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/takuyan/.rbenv/versions/2.2.4/bin/ruby -r ./siteconf20160324-16905-11t0grf.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.8
@takuyan
takuyan / projections.json
Last active December 29, 2015 14:39 — forked from jsteiner/projections.json
rails.vim projection file for Backbone.Marionette.
{
"app/serializers/*_serializer.rb": {
"command": "serializer",
"related": "app/model/*.rb",
"alternate": "spec/serializers/%s_spec.rb"
},
"app/assets/javascripts/models/*.js.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.js.coffee",
"template": "class @AppName.Models.%S extends Backbone.Model"
group :development do
# ...
gem 'capistrano'
gem 'capistrano-rails'
gem 'capistrano-rbenv'
gem 'capistrano-bundler'
# ...
end
@takuyan
takuyan / beforeunload_turbolinks.js.coffee
Created October 4, 2013 14:40
for beforeunload event of turbolinks.
# # if Zero
# = switch_if(0) do
# h1
# ...
# # => <div class='zero' id='zero'><h1>...</h1></div>
#
# # if One
# = switch_if(1) do
# h1
# ...
@takuyan
takuyan / application_helper.rb
Created September 25, 2013 05:16
FontAwesomeを使うときは、ApplicationHelperにコレを登録しておくと便利。 どんどんwhen句を増やせば良い。データごとのアイコンを一元管理。 メリット:アイコン名をハードコーディングしなくて済む
module ApplicationHelper
def icon_name_for(name)
sym_name = name.to_sym
case sym_name
when :home
'icon-dashboard'
when :team
'icon-group'
when :content
'icon-pencil'
~ ‹1.9.3-p392› $ gem i capybara
Fetching: capybara-2.1.0.gem (100%)
IMPORTANT! Some of the defaults have changed in Capybara 2.1. If you're experiencing failures,
please revert to the old behaviour by setting:
Capybara.configure do |config|
config.match = :one
config.exact_options = true
config.ignore_hidden_elements = true
config.visible_text_only = true