...if you do not know. How are cookies transferred between your browser and the server? Open the development tools in your browser for this page. Can you find the cookies...

...your browser stores for makandracards? In the network tab, can you see how the cookies are transferred to or from the server? Can you log yourself out by manipulating a...

I recently noticed a new kind of flaky tests on the slow free tier GitHub Action runners: Integration tests were running on smaller screen sizes than specified in the device...

...metrics. The root cause was the use of Selenium's page.driver.resize_window_to methods, which by design does not block until the resizing process has settled: We discussed this issue...

...Learn to create test data effectively using factories. Decouple tests by having each test start with an empty database and create only the records needed for the test. Learn

...with every test. In our experience the use of fixtures can make a test suite hard to work with. In any non-trivial test suite there will be thousands of...

makandra Curriculum

...library => Google Drive) CLI tricks every developer should know Install the tldr tool using sudo apt install tldr. You can then get usage examples for every console command, e.g. tldr...

...ssh to get examples for the ssh command. (If there are no entries, run tldr -u and try again) Exercises Basic commands Experiment and do something useful with the following...

makandra dev

Static error pages To add a few basic styles to the default error pages in Rails, just edit the default templates in public, e.g. public/404.html. A limitation to these default...

...templates is that they're just static files. You cannot use Haml, Rails helpers or your application layout here. If you need Rails to render your error pages, you need...

Learn to treat files as an ActiveRecord attribute type, like :string or :integer Research Look at the README for the carrierwave gem Read about Common mistakes when storing file...

...the form where we can also fill in title, year, etc. On the movie show view, render a poster version that is 400 pixel wide, with a height that respects...

Is your application doing something expensive every few seconds? Maybe an animated slider that rotates images? Maybe you are updating data over the network every five minutes?

...this if the your document tab is not even visible to the user. This saves your user's battery and data plan. You can ask document.visibilityState whether this tab is...

...that matter) will not be affected by this. If you define them in your specs, they will exist globally. This is because of how RSpec works (short story: instance_eval...

# ... end let(:record) { TestRecord.new }

end # TestRecord will exist here, outside of the spec! Do not do this. It will bite you eventually. For example, when you try to...

makandra Curriculum

...in the context of our application. While you could roll out a custom authentication solution, this would likely expose you to the various risks of "homegrown crypto". In practice we...

...like clearance or devise for this task. Learn Read the article Rails Authentication from Scratch You don't need to do write any code, but you should be able to...

You have uncommited changes (you can always check by using git status), which you want to discard. Context Now there are several options to discard these depending on...

...your exact situation. The headlines will differentiate the cases whether the files are staged or unstaged. Staged and unstaged changes Staged changes Unstaged Changes Staged and unstaged changes

Are My Indexes Affected? If your database has been created on an operating system with glibc version < 2.28 and later upgraded to an operating system with glibc >= 2.28, you...

...affected. To find out which indexes in our database are affected, run the following slightly modified query from the PostgreSQL documentation: CREATE extension amcheck; SELECT bt_index_check(index => c.oid...

To make CSS rules dependent on the screen size, we use media queries: @media (max-width: 500px) { // rules for screen widths of 500px or smaller } Browsers will automatically enable and...

...disable the conditional rules as the screen width changes. To detect responsive breakpoints from JavaScript, you may use the global matchMedia() function. It is supported in all browsers:

linux.die.net

...files. Those can be used to apply to a different repository [1] or by someone else (e.g. sent when sent to them via e-mail). Creating a patch in git...

...changes and commit them. Run git format-patch COMMIT_REFERENCE to convert all commits since the referenced commit (not including it) into patch files. For example, let's say you...

I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method on Enumerable that combines the three: module Enumerable

group_by(&block) .transform_values(&:count) .sort_by(&:last) .to_h end end Just paste that snippet into a Rails console and use #count_by now! Usage examples...

Read the following material: World's shortest UI/UX design course Easiest Way to Pick UI Colors 7 Rules for Creating Gorgeous UI (Part 1) 7 Rules for Creating Gorgeous...

Visual design rules you can safely follow every time Bootstrapping Design (in our library) Steve Schoger's Refactoring UI book (in our library) and watch the following...

Intel CPUs receive updates, including security relevant upgrades, through 2 channels: Firmware/UEFI BIOS updates can also update the microcode in CPUs. This is the preferred and persistent way

How to install an microcode update? If one is available and deemed sufficiently stable from Debian's or Ubuntu's perspective, the intel-microcode package is updated and...

...tough challenge. To get more detailed insights consider using the rack-mini-profiler gem. Setup with Unpoly Add the following gems: group :development do gem 'memory_profiler' gem 'rack-mini...

If you have slow views (Haml/Partials can be slow), consider caching them. Remove code & sql-queries that are not needed to render the page. Calling to_a blindly on...

...good thing. It's possible to configure this requirement at the web- or proxy server level, where nginx or apache will just redirect every request on http to https. Some...

...if the URL they've been called with contains the http or the https scheme and issue their own redirect response (usually 301 or 302) to https. This card is...

If you want to switch to another ruby versions, you have several options, depending on what you want: Do you want to switch temporarily, per project, or globally?

Unlike RVM, rbenv does not offer a command like rvm use. By default, it respects your project's .ruby-version file. If you need to change manually...

...pretty_print method As an example, consider the following class. class MyClass # ... def inspect "#<#{self.class} attr1: #{attr1.inspect}, attr2: #{attr2.inspect}>" end end Instances of that class will inspect like #<MyClass attr1...

...Alice", attr2: "Bob">, but IRB will apply a single color (green) for everything. That is because MyClass implements only inspect. If it were to implement pretty_print, IRB would use...

When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc. It may be a good idea to wait for all in-flight...

...AJAX requests to finish before ending a scenario: You may have client-side JavaScript that freaks out when the tab closure kills their pending requests. If that JavaScript opens an...

makandra dev

min-width is known as a CSS property that can be set to define a least width for an element. Surprisingly, it can also be used to set something that...

...it is more like "auto". This can make block elements take up much more space than desired, even stretching their container beyond the screen edge on small screens.

Du weißt was copy-on-write ist und warum das in Zusammenhang mit Snapshots praktisch ist Du weißt was Fragmentierung ist und wann und wo es bedeutsam ist

Du weißt wie du einen Datenträger verschlüsselst Du weißt wie man ein Linux System verschlüsselt Du weißt wie man die Systeme jeweils wieder entschlüsselt Inhalte LinuxFilesystemsExplained (Achtung alt)

While it might seem trivial to implement an invoice that sums up items and shows net, gross and vat totals, it actually involves a lot of rules and caveats. It...

...examples in Ruby and MySQL, the concepts apply to all programming languages and data stores. When to round There are exactly two spots where your invoice logic should round money...