...Project.find_each do |project| project.recalculate_statistics! end Both find_in_batches and find_each return records ordered by ID because they need to be able to iterate in batches. Modern...

...your browser window for 10 seconds. The reason is that evaluate_script will always return a result. The return value will be converted back to Ruby objects, which in case...

makandra dev

...offense for rule "space-before-blocks" [#180343876] Fix ESLint offense for rule "no-useless-return" [#180343876] Add ESLint without any offenses

...rescue ActionController::ParameterMissing {} end def note_scope # Restrict what the user may access by returning a scope with conditions. Note.all end def load_notes @notes ||= note_scope .strict_loading # Raise...

...preloaded will raise an ActiveRecord::StrictLoadingViolationError. There is a private method #note_params that returns a permitted attributes hash that can be set through the #update and #create actions.

...path(path, expires_at = 2.hours.from_now, allow_fuzzy_expiry: true, secret: Rails.application.secrets.url_signature_secret) return unless path uri = URI.parse(path) if allow_fuzzy_expiry expires_at = expires_at.end_of_hour...

stackoverflow.com

...never create a new object in an implicit conversion method. This method should either return self or not be implemented at all. Obviously, this is the reason behind this recent...

To return non-HTML responses (like XLS spreadsheets), we usually use the respond_to do |format| format.xls do # send spreadsheet end end This is often, but not always the same...

...than calling other step definitions. Because you are using plain ruby, you can use return values, structured arguments (e.g. hash options), etc. I often have files like the session_steps.rb (below...

digitalocean.com

...Yarn requires Node.js 4.0 or higher to be installed. Check if command -v "node" returns a path and you load NVM before Yarn. This could look like this:

...it will wait for any beforeunload to be handled before e.g. a page.refresh statement returns. That that this also applies to wrapped calls like accept_confirm { page.refresh }. Recommendation

...order of test-writing and implementation is up to you. When you're done, return to writing the code. The specced thing now exists, so you can continue making that...

makandra dev

config.before_send = lambda do |event, hint| log_sentry_event(event, hint) event # Return event so it can be processed by dummy DummyTransport end end Then add this helper...

unpoly.com

...planner.js, tooltips.js // Simple boolean flag up.compiler('[date-picker]', (element) => { const picker = flatpickr(element, { /* config */ }) return () => picker.destroy() }) // With configuration data (via up-data) up.compiler('[planner]', (container, { type, view, icons }) => { window.Planner = new...

'fish' => nil, 'birds' => '1' } ] end let(:csv) { generate_csv(csv_data) } # This will return a CSV with one header row and four data rows

...function escapeHighASCII(string) { let unicodeEscape = (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, '0') return string.replace(/[^\x00-\x7F]/g, unicodeEscape) } Escaping high ASCII in Ruby def escape_high_ascii(string...

...POST session/1230859ba100e7b2e5472cfb5bdf94c3/execute 2020-01-02 00:00:03 INFO Selenium >>> http://127.0.0.1:9538/session/1230859ba100e7b2e5472cfb5bdf94c3/execute | {"script":"return arguments[0].matches(':disabled, select:disabled *')","args":[{"ELEMENT...

...name is missing' end context 'when admin' do before { … } describe '#last_action' do it 'returns the last action performed by the user' it 'is nil for a new user'

...good habit to always end a composed matcher in true to ensure that it returns a truthy value. E.g. by using a condition as the last expression you may otherwise...

Note: In case a string does not match the pattern, .match will return nil. With Ruby 2.4 the result of .match can be transformed to a Hash with...

makandra dev
github.com

var key = keyValuePair[0]; var value = keyValuePair[1]; pdfInfo[key] = decodeURI(value); } } return pdfInfo; } If you want to place repeated content outside the header or footer area, I...

...hash_including( id: 1, thread: {id: 1} ) ) end end The example will fail and returns a not very helpful error message: expected {:id => 1, :name => "Foo", :thread => {:id => 1, :title...

...performance optimizations Removing an enum value that exists on records will make their getter return nil Neat features the generated instance methods, prefix/suffix options and scopes

timer = Capybara::Helpers.timer(expire_in: seconds) loop do prev_size = size sleep 0.025 return res if prev_size == size break if timer.expired? end raise Capybara::WindowError, "Window size not...

...to set the Sass options. Webpacker const sassLoaderConfig = environment.loaders.get('sass') const sassLoaderIndex = sassLoaderConfig.use.findIndex(config => { return config.loader === 'sass-loader' }) // Disable deprecation warnings inside dependencies sassLoaderConfig.use[sassLoaderIndex].options.sassOptions.quietDeps = true sassLoaderConfig.use[sassLoaderIndex].options.sassOptions.silenceDeprecations...