Most of our applications use CarrierWave for file uploads. CarrierWave has an integrated processing mechanism for different file versions with...
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...
...send a merge request, please confirm that your code ... has been reviewed by yourself beforehand fulfills every requirement defined as an acceptance criterion does not have any log or debugging...
The puppet server caches custom functions. If you edit an existing function (e.g. while you’re developing it), you’ll...
Running gem update --system will install the latest version of RubyGems. However the latest version might not be compatible with...
...This is because your app only has a single page load when the user begins her session. After that only fragments are updated and the tag that sends the page view to Google Analytics is probably never evaluated again. Luckily you can fix this. Simple mode: You just want to track all the page views Embed your Google Analytics code as always. Now add the following code snippet: up.on('up:location:changed', function(event) { ga('set', 'page', location.pathname); ga('send', 'pageview'); }); Hard mode: You want more control over what's being tracked First, edit your Google Analytics code snippet and comment out the last line (ga('send', 'pageview')): (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-1234567', 'auto'); // ga('send', 'pageview'); // Don't send the pageview here Now add the following compiler...
Sometimes it is useful to define a named scope by implementing a static method with the scope's name on...
Most of the time it is a tedious task to apply a code style guide to an existing code...
...as root for even more information and optionally also make use of stress for benchmarking, those methods did not provide any additional useful information for the current problem.
To keep JavaScript sources small, it can sometimes make sense to split your webpack bundles. For example, if your website...
tl;dr The strict-dynamic source list keyword allows you to simplify your CSP policy by favoring hashes and nonces...
...it and just builds a framework for concrete implementations. This is were another gem becomes important: database_cleaner-active_record. It provides the default ActiveRecord cleaner instance and is also...
...second database just once by using DatabaseCleaner[:active_record, db: MigrationRecord], but it's better readable and more convenient in case you want to change a strategy in the future...
...PNG with a decent resolution (72 dpi). However, in my experience the result is better, if you set the density to a higher value and then resize to the desired...
...size. But you can just toy with those values and see what works best for you. convert -density 1200 -resize 96x96 input.svg output.png Transparency By default, your target image is...
We generally use multiple application servers (at least two) and you have to search on all of them if you...
...write <<EOT. If you do this, your terminating sequence must be at the very beginning of the line. It's less pretty and there is rarely a reason to use...
When debugging your application, you will come across objects created by some gem or framework. You don't have the...
New versions of wkhtmltopdf dissallow file:// URLs by default. You can allow them by passing --enable-local-file-access.
You can share a state in Ruby with global variables. Even if you should avoid them whenever possible, for debugging...
...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...
...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...
Authentication is all about being able to verify the identity of a user in the context of our application.
PostgreSQL uses the C library's locale facilities for sorting strings: First, all the letters are compared, ignoring spaces and...
Usually our code lives on GitLab, therefore our documentation for CI testing is extensive in this environment. If you are...
Bei Automatisierungsaufgaben kannst du dich nicht immer auf fertige Tools verlassen. Häufig musst du eine Schnittstelle zu einem bestehenden System selbst implementieren oder mit APIs sprechen, um eine Automatisierung einzubauen...
...Informationen aus einem System zu ziehen. Am häufigsten werden dir hier Systeme mit JSON begegnen. In diesem Kapitel schreibst du ein Programm um mit einer API zu sprechen und die...