Specify a version before running commands
rvm use ruby-2.6
export RAILS_VERSION='~>6.0'
rm -f Gemfile.lock && bundle install --standalone binstubs
bundle exec rake smokeTo execute one cucumber test
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle' | |
| }); |
Specify a version before running commands
rvm use ruby-2.6
export RAILS_VERSION='~>6.0'
rm -f Gemfile.lock && bundle install --standalone binstubs
bundle exec rake smokeTo execute one cucumber test
| # the script from the book was not working | |
| import pcbnew | |
| pcb = pcbnew.GetBoard() | |
| for module in pcb.GetModules(): | |
| print "ref: %s, pos: %s" %(module.GetReference(), module.GetPosition(),) |
| # From Juani Villarejo on Rails Speed Slack | |
| class QueryReport | |
| PRETTY_PRINT = <<-PRETTY_PRINT_TEMPLATE.freeze | |
| Total queries executed: %s | |
| Total execution time: %s | |
| Queries executed | |
| ----------------------- | |
| %s |
| # frozen_string_literal: true | |
| RSpec::Matchers.define :have_data_count_of do |expected| | |
| match do |actual| | |
| if actual.is_a?(Hash) | |
| @json_api_payload = actual | |
| elsif actual.is_a?(String) | |
| @json_api_payload = JSON.parse(actual) | |
| else | |
| @invalid_payload_type_error = 'Please provide a Hash or JSON string' |
| require 'rspec/core/formatters/console_codes' | |
| require 'rspec/core/formatters/documentation_formatter' | |
| # Display "it" in RSpec doc format output | |
| # $ rspec spec/foo/bar_spec.rb --format DocIt | |
| class DocIt < RSpec::Core::Formatters::DocumentationFormatter | |
| RSpec::Core::Formatters.register self, | |
| :example_passed, | |
| :example_pending, |
I have a custom https://github.com/rails/rails/blob/v5.2.1/activerecord/lib/active_record/associations/collection_association.rb#L278-L283 like this
def add_to_target(record, skip_callbacks = false, &block)
puts "#" * 60
puts
p association_scope
p association_scope.class
puts
TracePoint.new(:call, :c_call){ |tp|When processing thousands of CSV lines of user that need to be or not added to a group (and produce a very detailed report). We are seiing we huge increase in memory. Often the 2X Heroku dyno cannot manage it.
We use stackprof, memory_profiler. We look at tool like speedscope for stackprof results and always it point at heavy use of ActiveRecord. Also we notice in strings retained in memory_profiler report on string very present.
| child_pid = spawn "psrecord #{Process.pid} --plot plot_#{Time.now.strftime('%H_%M_%S')}.png" | |
| a = [] | |
| 10_000_000.times { |i| a << i.to_s } | |
| puts Process.kill('SIGINT', child_pid) | |
| puts "continue scripting" |
| # frozen_string_literal: true | |
| Rails.application.configure do | |
| config.lograge.enabled = true | |
| config.lograge.formatter = Lograge::Formatters::Logstash.new | |
| config.lograge.custom_options = lambda do |event| | |
| exceptions = %w[controller action format password] | |
| { | |
| uuid: event.payload[:uuid], | |
| host: event.payload[:host], |