- Jim Weirich: The Building Blocks of Modularity – http://goo.gl/g4Nk
- Jim Weirich: SOLID Ruby – http://goo.gl/z3jd
- Sandi Metz: SOLID Object-Oriented Design – http://goo.gl/PDn6T
- Sandi Metz: Less – The Path to Better Design – http://goo.gl/VuTl4
- Demeter is for Encapsulation – http://is.gd/eeyLx
- Opinionated Modular Code – http://is.gd/eeyXm
- Scaling to Hundreds of Millions of Requests – http://vimeo.com/12814529
- Confident Code – http://goo.gl/VFLX
- Destroy All Software Screencasts – https://www.destroyallsoftware.com/screencasts
- Corey Haines: Fast Rails Tests – http://goo.gl/Va2gb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gemfile | |
gem 'debugger', group :development, :test | |
include 'debugger' where you want to debug | |
Commands: | |
- help | |
- list | |
- pp variable (print variable content) | |
- irb (enter in irb; well, rails console) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date.beginning_of_day | |
date.end_of_day |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
within "#id" do | |
expect(page).to have_content("hello") | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def yep | |
puts "method_name: #{__callee__}" | |
end | |
> yep | |
method_name: yep | |
Also: __method__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:e. (e-space-dot) gives a browsable current directory - then you can /-search for name fragments | |
# http://stackoverflow.com/questions/573039/any-shortcut-to-open-file-in-vim | |
Others: | |
:split | |
:vsplit | |
Ctrl+w+w / Ctrl+Shift+w | |
:res +10 # http://vim.wikia.com/wiki/Resize_splits_more_quickly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery._data( elem, "events" ); | |
// http://stackoverflow.com/questions/2518421/jquery-find-events-handlers-registered-with-an-object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to delete all lines containing "profile" (remove the /d to show the lines that the command will delete): | |
:g/profile/d | |
# to delete all lines that do not contain a pattern, use 'g!' (equivalent to 'v'), like this command to delete all lines that are not comment lines in a Vim script: | |
:g!/^\s*"/d | |
:v/^\s*"/d | |
# to delete all lines except those that contain "error" or "warn" or "fail" | |
:v/error\|warn\|fail/d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/7444522/is-it-possible-to-define-a-before-save-callback-in-a-module | |
class Model | |
include MyModule | |
#... | |
end | |
# lib/my_module.rb | |
module MyModule | |
extend ActiveSupport::Concern |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails | |
# DOs | |
2.hours.ago # => Fri, 02 Mar 2012 20:04:47 JST +09:00 | |
1.day.from_now # => Fri, 03 Mar 2012 22:04:47 JST +09:00 | |
Date.today.to_time_in_current_zone # => Fri, 02 Mar 2012 22:04:47 JST +09:00 | |
Date.current # => Fri, 02 Mar | |
Time.zone.parse("2012-03-02 16:05:37") # => Fri, 02 Mar 2012 16:05:37 JST +09:00 | |
Time.zone.now # => Fri, 02 Mar 2012 22:04:47 JST +09:00 | |
Time.current # Same thing but shorter. (Thank you Lukas Sarnacki pointing this out.) |