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.

jsbin.com

If you try to listen to events on elements that are nested inside a , Firefox will stop event propagation once...

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

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

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

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

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

PostgreSQL uses the C library's locale facilities for sorting strings: First, all the letters are compared, ignoring spaces and...

github.com

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

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

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

From Exploring ES6: Module imports are hoisted (internally moved to the beginning of the current scope). Therefore, it doesn’t matter where you mention them in a module and the...

Recent rails security updates have shown that people make incorrect assumptions about the possible contents of the params hash.

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

Understanding your type of cronjob Some cronjobs must only run on a single server. E.g. when you run nightly batch...

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

...Gemfile.lock carefully when submitting a commit. Note that the approach in this card works best, if you use bundle outdated together with bundle update some_gem --convervative for major updates...

edgeapi.rubyonrails.org

The linked article suggests an interesting way to speed up tests of Rails + Postgres apps: PostgreSQL allows the creation of...

...methods for calculating times and dates, like Duration#ago or Duration#from_now. But beware when using those, because they wont give you Dates or Times but ActiveSupport::TimeWithZone instances...

...your local timezone, but Rails.application.config.time_zone, which has UTC as default value. The mitigation Best case, you have already defined Rails.application.config.time_zone, as we recommend anyway. In this case you...

Working with a self-signed certificate is much easier, when the browser accepts it. Google Chrome Warnings from chrome might...

makandra dev

Today I got a better understanding of how git works, in particular what git checkout and git reset do. Git basics A commit holds a certain state of a directory...

github.com

Setting array columns When using PostgreSQL array columns, you can set an array attribute to a value with square brackets...

georgemauer.net

If your application exports CSV, be advised that Excel and other spreadsheet applications treat certain cells (those starting with =, +, - or...

By default, Devise sends all emails synchronously with deliver_now. To change that, Devise's readme suggests overwriting the send...