- Add https://github.com/SamSaffron/memory_profiler to development gems
- Update the bundle
- Add
require "memory_profiler"
toconfig/environments/development.rb
- Where you want to do a memory report, use an inline
start/stop
andRails.logger.debug
the report
def join(strings, delimiter) | |
raise ArgumentError, "Invalid delimiter \"\\\"" if delimiter == "\\" | |
strings.map do |s| | |
s.gsub(/(\\|#{Regexp.escape(delimiter)})/, '\\\\\1') | |
end.join(delimiter) | |
end |
# Assuming Rails AR is available | |
# This should let us pluck stuff from a big collection in batches | |
# We add the load: true option if we want to load the relaion beforehand. | |
# Because we are plucking anyway, we don't need to preload | |
# See: https://github.com/rails/rails/issues/47462 | |
Model.where(some_id: 15).in_batches do |relation| | |
relation.pluck(:attr1, :attr2).each do |row| | |
# stuff | |
end |
Session Format: Talk
White-boarding is not nice. An unpaid take home project is not nice. We decided to apply the Ruby community motto "Matz is nice and so we are nice," to our enterprise technical interview process. Come learn what changes we made, how we enlisted support of other rubyists and non-rubyists alike, and how you can too.
The current state of interviewing is not nice
FWIW: I (@Rondy) am not the author of the content presented here, which is an outline from Edmond Lau's book. I've just copy-pasted it from somewhere and saved as a personal gist, before it got popular on newsnews.ycombinator.com. I don't remember where exactly the original source is from and neither could find the author's name, so I cannot give him/her the proper credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- Documentation: http://www.nextbus.com/xmlFeedDocs/NextBusXMLFeed.pdf
- XML Feed: https://retro.umoiq.com/service/publicXMLFeed
- JSON Feed: https://retro.umoiq.com/service/publicJSONFeed
The documentation is for the XML feed, but changing to the JSON feed returns JSON instead.