makandra dev

CSS transitions are a simple animation framework that is built right into browsers. No need for Javascript here. They're...

github.com

fake_stripe spins up a local server that acts like Stripe’s and also serves a fake version of Stripe.js...

...helper in many views, but in the index view I hide the label to better fit the layout. Here is the helper: module IconHelper def icon(*args, &block) options = args.extract...

It is possible to access Rails config (for example secrets) from within your webpack bundles, thanks to rails-erb-loader...

It's not a good idea to leave data objects mutable. They should behave like integers. Ruby's Data would have already enforced that. Because I used a regular...

...attr}=" do |value| if @readonly raise 'Readonly' else super(value) end end end Weird behavior changes from composed_of The method composed_of accepts the option :mapping, which is required...

makandra dev

...globstar shell option, it is probably disabled: $ shopt globstar globstar off In that case, ** behaves just like * and will match exactly 1 directory level. $ ls spec/**/*_spec.rb spec/models/user_spec.rb

...clarify: This not only disables the memoization, but will also return wrong results! The best solution is to use the Memoizer gem instead...

While it might be tempting to set it per project (other devs might benefit from it), you need to do it each time for every project "pollute" a project...

...very nasty fails. Below are the basic changes you need to perform and some behavior you may eventually run into when upgrading your application. This aims to save you some...

...in your uploaders... def extension_white_list %w[jpg jpeg gif png] end must become def extension_allowlist %w[ jpg jpeg png gif ] end Also, every uploader must define allowlists...

When you find yourself constantly ignoring a RubyMine warning, you can simple disable that warning and de-clutter your editor...

end end def allowed_mime_types %w(image/jpeg image/png) end end This will behave like the solution before: User#portrait will get an expected error message and the User...

Most forms have a single submit button that will save the record when pressed. Sometimes a form needs additional submit...

Assert rmagick provision ... Gemfile gem 'rmagick', '2.13.2' # at this moment the latest stable version config/initializer/carrierwave.rb require 'carrierwave/processing/rmagick' ... and define a...

You will occasionally need to clean out your database while keeping the schema intact, e.g. when someone inserted data in...

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

...the "space" character class For matching whitespaces in a regular expression, the most common and best-known shorthand expression is probably \s. It matches the following whitespace characters: " " (space)

I've encountered a Ubuntu 16.04 today, where localhost resolved to ::1 instead of 127.0.0.1. This will not usually make...

masilotti.com

...from using fixtures over FactoryBot, as fixtures load essential test data upfront at the beginning of the testsuite. Finding peace with fixtures While setting up the database upfront challenges the...

...idea of maintaining a perfectly clean database state at the beginning of each test, with some disciplined practices, handling fixtures becomes quite manageable. Let’s dive into how this works...

...your commits are the changes. Never use merge. You've found some code that belongs to an earlier commit in your feature branch If you already have a "final" (i.e...

git rebase -i master Move the fixup directly below the commit it belongs to. Change the "pick" in front of the fixup commit to "f". Don't touch...

Getting an entire test suite green can be a tedious task which involves frequent switches between the CLI that is...

Here is a bash script that I use to auto-configure displays on Ubuntu 24.04 with Xorg. Background

stackoverflow.com

This StackOverflow question about nested function definitions in Ruby imparts a good understanding of Ruby's def.

Do not pass times to date attributes. Always convert times to dates when your application uses time zones. Background

After running bundler / gem install I could not load nokogiri lately. It died with cannot load such file -- nokogiri/nokogiri.