...E.g. although an "address book contact" and a "user" are both human beings, it's rarely practical to have them share a model or inheritance hierarchy. Try to model everything...
...CRUD for stands Everything related to viewing and editing weekly reports Read Project management best practices: Issues on how we write user stories. Note that in practice we would do...
...no longer recommend this option. After a chrome update, the chromedriver package sometimes lags behind and is not compatible. Install via apt install chromium-chromedriver Option 3: Install via npm...
...no longer recommend this option. After a chrome update, the chromedriver package sometimes lags behind and is not compatible. There's a handy npm package. sudo npm -g install chromedriver...
...addresses = AddressBook.new addresses.add Contact.new(first_name: 'Frederik', last_name: 'Foo') addresses.add Contact.new(first_name: 'Berta', last_name: 'Beispiel', phone: '556677') addresses.add Contact.new(first_name: 'Anna', last_name: 'Muster', street: 'Foo...
...returns contacts that match all of the words in any property: results = addresses.search('77 berta') results.size # => 1 results[0].first_name # => "Berta" Errors Change the AddressBook class so the #add...
When selecting records in a date range, take care not to do it like this: start_date = Date.parse('2007-05...
...addition of both margins takes place but the maximum of both is applied. This behavior is called collapsing margins. Oftentimes it is a good behavior but collapsing margins can be...
...the previous sibling of the parent box. Nevertheless there are some exceptions where the behavior of vertical collapsing margins is not used. Exceptions when margins do not collapse
You want to use fields in your applications. However, your desktop users may encounter some weird quirks: Aside from allowing...
Sometimes you need to remove high Unicode characters from a string, so all characters have a code point between 0...
You can convert git commits into patch files. Those can be used to apply to a different repository [1] or...
This is a small example on how you can check if your Postgres index can be used by a specific...
How can I configure virtual IP's? There are two parameter to set up virtual ips in Keepalived: virtual_ipaddress...
For webpages to load fast it's recommended to optimize images. Ideally an image's file size should be as...
...for Structs are temporary data structures which just hold state and don't provide behaviour. In many cases you could use a simple hash as a data structure instead. However...
...are incredibly fast. If you have to handle lots of data it may be better to use hashes for performance reasons, even if the readability of the code suffers compared...
...feature of Bundler. It might be an unintended side effect of something else. I believe this command will try to update GEMNAME and GEMNAME only. If this leads to unmatched...
...or newer versions for these libraries before you start. Maybe you can upgrade them beforehand which makes the migration easier. Here are some libraries that I had come across:
...implement the navigation on your own. Tip: Add a feature for your navigation bar beforehand and test links and their highlighting (don't forget dropdown submenus!). After upgrading to Bootstrap...
We have now updated/created two gems that implement the requirements above using the best practices we know of: assignable_values: ActiveRecord macro to restrict the values that may be...
It's 2024 and we have tools like ffmpeg, imagemagick and GPT readily available. With them, it's easy to...
...move elements to the back (e.g. background images, gradients etc). They will be rendered behind all other elements within the context (e.g. text), but not behind elements outside the stacking...
Tempfiles get deleted automatically With the the ruby Tempfile class you can create temporary files. Those files only stick around...
Today I learned that you can animate HTML elements using the Web Animation API's method .animate(keyframes, options) (which...
...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...
...would possibly need in a clean way, I prefer to simply always use them. Behind the scenes, Open3 actually just uses Ruby's spawn command, but gives you a much...
Open3.capture3 Basic usage is require 'open3' stdout_str, error_str, status = Open3.capture3('/some/binary', 'with', 'some', 'args') if status.success? # okay else raise "did not work" end Open3 will raise...
...diam nonumy eirmod tempor. | | | | | | | | | | | | | | | | | | | +------------+-----------------------------------------+ | Footer | +------------------------------------------------------+ Here are some more details how the layout should behave: Give each element (header, sidebar, etc.) a distinct background color to see where boxes start...
...do not use them. Pay attention to the margins in your styles. Elements that belong together logically (e.g. two navigation sections) should be closer to each other than elements that...
TL;DR Append your locale keys with _html to have them marked as html_safe and translate them with = t...
This still relies on params[:id] existing, so your code should reflect that: # Better User.find(params.expect(:id)) # Or User.find(params.require(:id)) Avoiding issues with extra parameters Rails logs extra...
...should still use permit (or expect) to receive Strong Parameters, but strip extra parameters. # Better (option 1) redirect_to users_path(params.slice(:query, :encoding).permit(:query, :encoding)) # Better (option...