Skip to content

Instantly share code, notes, and snippets.

View takuyan's full-sized avatar
🎯
Focusing

Takuya Kato / katton takuyan

🎯
Focusing
View GitHub Profile
@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|

Rails v1.0 読書会

ORMまわりを中心に読む

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

読書メモ

$ 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 / 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
@takuyan
takuyan / 0_reuse_code.js
Created December 1, 2015 04:32
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
( 5/60): |vimshell| Error
/Users/takuyan/.vim/bundle/vimshell
/usr/local/Cellar/git/2.1.2/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory
(37/60): |unite.vim| Error
/Users/takuyan/.vim/bundle/unite.vim
/usr/local/Cellar/git/2.1.2/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory
# require https://github.com/ichord/Caret.js
$target = $('#post_body')
insertText = "Hello World"
text = $target.val()
position = $target.caret('pos')
newText = text.substring(0, position) + insertText + text.substring(position)
$target.val(newText)
@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.