...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...

...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...

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...

...request and model using implicit and convoluted protocols. We prefer a different approach. We believe that among all the classes in a Rails project, controllers are some of the hardest...

...to test and understand and should receive special care. It is our belief that: Controllers should be short and tidy Controllers should receive the same amount of programming discipline as...

blog.bigbinary.com

...joined tables or multiple queries? If you don't like the cleverness of this behavior, you can explicitely tell ActiveRecord how to preload associations with either JOINs or separate queries...

...includes usually works nicely, but Rails will apply some magic, as mentioned at the beginning of this card. This is subject to issues with polymorphic associations, too...

CSS variables are very different from preprocessor variables. While preprocessors use variables to compile a static piece of CSS, CSS...

...form disables the submit button while working. // bad (how we used to do it) beforeEach(() => { this.form = setupMyForm() this.submitButton = findTheSubmitButton() }) it('disables the submit button while working', (done) => { expect(this.submitButton.disabled).toBe...

...our specs to simply return a Promise, so we could rewrite this as // slightly better it('disables the submit button while working', () => { expect(this.submitButton.disabled).toBe(false) let submitPromise = this.form.onSubmit()