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

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

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

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

...doing something like the following. @user = User.something(123) rescue User.new # DON'T or @user = begin User.something(123) rescue # DON'T User.new end This is bad. Do not do that.

...to be raised, you can always rescue for its class. Do that instead. @user = begin User.something(123) rescue ActiveRecord::RecordNotFound User.new end Any unexpected errors will then still be raising...

makandra dev

There are two ways a logout in SAML can happen: Service Provider (SP) initiated and Identity Provider (IDP) initiated logout...

github.com

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

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

ignore_rules << (pattern || block) end def mute(&block) @muted = true if block begin block.call ensure unmute end end end def unmute @muted = false end def self.current @current ||= new...

makandra Operations

If you want to perform a failover on another haproxy backend server this is the way you should do it...

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

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

...values, which map to one context, e. g. mail components, in order to provide better readability of your tests or to even make clear a tests fail reason due to...

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

...Haml maintainer, this negatively impacted rendering performance. So in Haml 6, they kept this behavior only for a few attributes, which they called "boolean". All other attributes will just render...

...their value as it is given. Behavior of "boolean attributes" remains unchanged No Haml value => no HTML value Boolean Haml value => attribute is rendered depending on that value

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

...database (ActiveRecord) What is a model? How are records retrieved and saved? Validations Migrations belongs_to, has_many, has_many :through Gain an understanding of the structure of a basic...

...in the database. Don't get confused by the use of text_field below. Beautiful controller pattern Refactor your MovieDB controllers to the pattern of our default controller implementation (without...

web.archive.org

This note shows how to merge an ugly feature branch with multiple dirty WIP commits back into the master as...

makandra dev

...can be useful to model a period without an actual end or an actual beginning. Imagine someone taking holidays and booking a holiday without knowing the end yet. Or providing...

It happens from time to time that a job in a GitLab pipeline fails. Sometimes, however, the error message is...

...notification service: Use @Input() id: number with component input binding; Update notification.service.ts: Define notification$: BehaviorSubject: Store the last fetched notification; Update notification$ when a new notification is fetched; Using Efficient...

...keywords in your prompts. LLMs excel at pattern recognition, and specific terminology reduces ambiguity. Beyond that giving examples for high level APIs of your imagened class design or using an...

TL;DR When using Cache-Control on a Rails application, make sure the Vary: Accept header is set.

makandra Operations

How can I configure virtual IP's? There are two parameter to set up virtual ips in Keepalived: virtual_ipaddress...

You may remember to use the || operator with caution to set defaults. We'll see that && and other conditionals come...