makandra dev
content-security-policy.com

tl;dr The strict-dynamic source list keyword allows you to simplify your CSP policy by favoring hashes and nonces...

...one to blame when the SEO folks complain about an empty . To avoid said behavior, use Nokogiri::XML instead of Nokogiri::HTML when parsing your HTML string. As long as...

...the input HTML contains a line break (somewhere inside the document, not at the beginning or end), the behavior of to_s magically changes to the above. >> Nokogiri::XML.fragment(" foo...

Running gem update --system will install the latest version of RubyGems. However the latest version might not be compatible with...

In general, you should not put a block element inside an inline element. So don't do this: text

postgresql.org

PostgreSQL offers a really handy field type: json. You can store any JSON there, in any structure. While its flexibility...

You can use local copies of gems in your Gemfile like this: gem 'spreewald', path: '~/gems/spreewald' As soon as you...

Sometimes we have to write code that behaves differently based on the version of a specific gem or the Ruby Version itself. The version comparison can often be seen with...

makandra dev

Besides their default styling properties, HTML elements have a semantic meaning. For example, an h1 tag is usually styled with a larger font and bold, while it denotes "the single...

...HTML elements corresponding to the meaning of their content has a few advantages: HTML becomes a little clearer Edge cases have already been considered and implemented: Keyboard support (tabbing, arrow...

...in development. Note that there are services like badssl.com to test against weird SSL behavior. Self-signed certificates Talking to a host using a self-signed certificate will fail because...

...connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed Best case scenario: the remote system's administrator understands and fixes this issue.

...page that you want to test for with its debug page. To turn this behaviour off you can use the code from Eliot Sykes' blog post I renamed the key...

...realistic_error_responses to true_404s for my projects. You can then activate the behaviour like this: describe "Admin Authorization", type: :request do describe "GET /admin_panel", :true_404s do

When using Rails credentials, you will edit the encrypted credentials for staging or production environments from time to time. To...

We generally use multiple application servers (at least two) and you have to search on all of them if you...

When debugging your application, you will come across objects created by some gem or framework. You don't have the...

relishapp.com

When you are using lambdas in RSpec to assert certain changes of a call, you know this syntax: expect { playlist.destroy...

makandra dev

...to cancel event propagation, each with different semantics. event.preventDefault() Only prevents the default browser behavior for the click, i.e. going to a different url or submitting a form.

...the class including the trait. While this may seem unproblematic at first glance, it becomes a problem when including traits in multiple classes, especially when using parameterized traits.

...you are actually defining ExampleTrait::HELLO. If you want to define a constant that belongs to a trait module, you can do that, and there a valid reasons to do...

makandra dev
github.com

...holds your bash prompt. You might want to change it to serve your needs best. Here is how to: General non-printing escape sequences in your prompt have to be...

makandra dev
impactahead.com

Also see the list of IRB commands. Switching the context Changes the "default receiver" of expressions. Can be used to...

You can share a state in Ruby with global variables. Even if you should avoid them whenever possible, for debugging...

In the past we validate and set default values for boolean attributes in Rails and not the database itself.

If you are using git submodules in Gitlab CI, you might run into a "The project you were looking for...

...an integer with a string without explicit casting. Related security issue In authentication, this behavior may be used to match rows without knowing a secret token: Potential Query Manipulation with...

When your controller action raises an unhandled exception, Rails will look at the exception's class and choose an appropriate...

github.com

Phusion Passenger changed the way how it gets restarted several times. Through the project's history, these all were valid...