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

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

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

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

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

github.com

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

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

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

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

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

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

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

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

...ms have passed!') }, function(reason) { console.error('Something went wrong: %o', reason) } ) This will become more important when we talk about async/await later. Exceptions are converted within then() handlers function fetchUsers...

} If f1() and f2() have an async API, our control flow must become async: function f1() { return Promise.resolve(2) } function f2(x) { return Promise.resolve(x * x) }

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

makandra dev
ruby-doc.org

...used for case-equality. In general it tells if the object on the right "belongs to" or "is a member of" the object on the left: String === "hello" # true

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

github.com

...that you can also make your matcher chainable, so a test can modifier its behavior. Using chaining you can write a matcher like this: expect(x).to be_a_multiple...

...as the video is free for end users." (MDN) H.265 / HEVC see H.264 (successor, better compression as H.264) VP8 royalty free VP9 royalty free (sucessor, better bit rate as VP8...

royalty free (planned successor of VP9 with better compression rates) Further reading: MDN: Web video codec guide Audio Codec Format Matrix A broader comparison of many audio codecs can...

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

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