makandra dev

...need a library for it. With ActiveRecord you could implement it with a single belongs_to association: class Node < ActiveRecord::Base belongs_to :parent, class: 'Node' end Any modification of...

...Cumulative Layout Shift score should be good' do # Cumulative Layout Shift seems to be better in tests than in reality, so # we use a lower value than the official "good...

...JavaScript every day, even when our backend code uses another language. While we've become quite adept with JavaScript at a basic level, I think many of us lack a...

Every function may use this, even if the function does not belong to the object. The default value of this is the global object (window in browsers...

Before any technical considerations, you need to understand the old system as best as possible. If feasible, do not only look at its API, or database, or frontend...

...may feel odd that the SQL statement says "UPDATE new_table". If your migration becomes too complex, you could put your logic into multiple reversible blocks (so they contain only...

end end A word of advice: Depending on your migration, you might be better off just defining 2 separate up and down methods instead of using change...

...data is guaranteed. There are however cases where you want to improve the user behavior (Rails error box) or reduce the number of exceptions e-mailed to your / collected by...

...Compliance Level; Asset file size could be reduced 2 New slider library has a better API Add capybara_lockstep 2 0 - 5 Reduce flaky integration tests

Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...

...selectively for your current need of change. For a more detailed example on this behavior compared to the --worktree option you can have a look on the example within the...

...git restore with --source for the usage --staged compared to --worktree To get a better idea, why this behavior might be useful I will add an example for both commands...

...dumps can be created in multiple formats (see option -F in pg_dump documentation. Benefits of the custom format are more configurable restores (for e.g. you can omit setting permissions...

...speeds up restores). The custom dump is compressed by default too. To get a better idea check the parameters in the mentioned documentation. You can use a custom format dump...

...if .second-item could be rendered smaller without problems or has because you defined behavior for it. +---------+--------------------------------------+ | | - 1000 characters looooooooooooong | | +---------+--------------------------------------+ Try it on CodePen. There are two ways to fix...

...may just set overflow: hidden or maybe on .second-item and/or add some overflow behavior and you're done. In some cases, this might not be the solution because the...

relishapp.com

Sometimes you have a test expectation but actually want a better error message in case of a failure. Here is how to do that. Background Consider this test: expect(User.last...

Why is this cool? One might argue why we would want to have better error messages for test expectations when our tests are supposed to be always passing. Well...

This card existed before, but was outdated due to browser implementation changes. The information below is validated for the current...

github.com

For Sidekiq to be able to retry your jobs it has to be able to catch errors that occur while...

When an event listener on a DOM element throws an error, that error will be silenced and not interrupt your...

...scope like Post.active and use that. Learn Resources Active Record Query Interface Rails Database Best Practices ActiveRecord: Specifying conditions on an associated table Preload, Eagerload, Includes and Joins

...multiple but simple queries. This can be easier to understand and may even perform better. Exercises Cards query (makandra only) Ask someone for a dump of the staging target and...

So you have a heading that is just barely wider than the container it should fit into, and it wraps...

makandra dev
gist.github.com

...byebug commands, it comes in handy with it's features for many use cases beyond that to make your life easier. For this cheatsheat I tried to structure the most...

...instance_methods(false). method -- The same as running .methods. Commands to change (or add) behavior at breakpoints display / undisplay [ ] - display or undisplays an expression at stopped breakpoint enable / disable [id...

api.rubyonrails.org

...issues, where you want to have a specific order of after_commit actions. Documented behavior Taken from the API documentation Registers a block to be called after all the current...

...would hand you UTC objects whose to_s(:db) may not convert properly. Legacy behavior in Rails 2.3 It's been briefly mentioned in the random list of ActiveSupport goodies...

You can chain multiple Capybara matchers on the page or any element: expect(page) .to have_content('Example Course')

developer.mozilla.org

...I've seen examples using directory but there are no indications this attribute will become standard soon. Feel free to use to feel future-proof. On JavaScript file objects, webkitRelativePath...

makandra dev

...named main, add a file app/webpack/packs/main.js. This will be your entry point. All assets belonging to that pack need to be imported here. Since webpack is configured to use Babel...

...its own import statements to load any dependencies it might have. Since this quickly becomes cumbersome, we usually add the following to simply import all our JavaScript files at once...

...first get a general overview of the most popular solutions. To chose a single "best" of those, ask yourself questions such as: Is the library still maintained? When was the...

...level of our own standards. Does it have a ton of dependencies? Fewer is better, in this case. Sites like the Ruby Toolbox (only for gems) or npm compare may...