...Repeat Yourself (or DRY). In Ruby on Rails we keep our code DRY by sharing behavior by using inheritance, modules, traits or partials. When you reuse behavior you want to...

...writing integration tests with Cucumber, where you need to express yourself with Gherkin and step definitions instead of Ruby classes and methods. But don't dispair! Below you will find...

...issues, depending on the exact version, and depending on your app. However, it is still possible to give some generic advice on how you want to tackle the update in...

...really confident about upgrading Rails, have a look at Rails LTS. How many update steps? Besides the Rails upgrade itself, you might also want to upgrade your other gems and...

highscalability.com

Awesome battle report from Pinterest trying to scale their setup using different approaches. When you push something to the limit all technologies fail in their own special way. This lead...

...evaluate tool choices with a preference for tools that are: mature; really good and simple; well known and liked; well supported; consistently good performers; failure free as possible; free. Using...

Icon fonts like Font Awesome are infinitely scalable, look great on high-DPI displays and will give your app a modern look. However, icon fonts can be very awkward to...

...use compared to raster icons. Elements are given icons by giving them a special class like icon-plus or icon-home: Create The icon font's stylesheet will then recognize...

...latest commits are not ready for production? Then use git merge master~n to skip the n-last commits. Tip A big advantage of merging vs. cherry-picking is that...

SVG is an acronym for "scalable vector graphics". SVGs should be used whenever an image can be described with vector instructions like "draw a line there" or "fill that space...

...they're not suited for photographs and the like). Benefits are the MUCH smaller file size and the crisp and sharp rendering at any scale. It's a simple, old...

YourClass.reflect_on_all_associations.map(&:name) Get the class name by calling class_name, or the type of the association (belongs_to, has_many...

makandra dev

...least one external REST API, machine-to-machine communication via GraphQL is less commonly seen. In this card, I'd like to give a quick intro on how to query...

Interacting with GraphQL feels a bit like querying a local database. You are submitting queries to fetch data in a given structure (like SELECT in SQL) or mutations to...

makandra dev

When browsing a repository, pressing "t" allows you to quickly search for file names. Very awesome! Go here to try it out...

masilotti.com

Slow test suites are a major pain point in projects, often due to RSpec and FactoryBot. Although minitest and fixtures are sometimes viewed as outdated, they can greatly improve test...

We adopted a project using minitest and fixtures, and while it required some initial refactoring and establishing good practices, the faster test suite was well worth it! Stick with...

...exception of the currently running kernel, the kernel version that was installed on the system before that and, of course, the latest updated version of the kernel. However, it will...

...This could lead to unexpected removal of packages. So please check the output of sudo apt-get autoremove closely. One-shot, manual method sudo apt-get autoremove Automatically remove unused...

makandra dev

...or position: fixed display: inline-block display: table-cell overflow: (not "visible") and more, see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context Example: A fluid main area with a right sidebar

...you don't want either column to clear content of the other. Float the sidebar to the right and you're set: its content now renders in the sidebar's...

To set the hostname of your Mac, run the following command in Terminal: sudo scutil --set HostName my-new-hostname.local Check it by typing:

github.com

Phusion Passenger changed the way how it gets restarted several times. Through the project's history, these all were valid: touch tmp/restart.txt sudo passenger-config restart-app /path/to/app passenger-config...

gem 'capistrano-passenger', require: false Add to your Capfile: require 'capistrano/passenger' Declare which server role should be restarted (optional). Usually passenger tries to restart all servers with the app...

...exception, Rails will look at the exception's class and choose an appropriate HTTP status code and error page for the response. For instance, an ActiveRecord::RecordNotFound will cause Rails...

...render a red "The page you were looking for doesn't exist" with a status code of "404" (not found). The mapping from exception classes to error types is a...

Why secure-only cookies used to be necessary Cookies have an optional secure flag. It tells the browser to not send the cookie for a non-https request.

...users from http:// to https://. The reason was that most users will only enter a scheme-less domain like makandra.de into their location bar, which will default to http://makandra.de...

CarrierWave comes with a set of default configuration options which make sense in most cases. However, you should review these defaults and adjust for your project wherever necessary.

...also find suggestions on what to change below. Understanding the default configuration Here is the current default config for version 2: config.permissions = 0644 config.directory_permissions = 0755 config.storage_engines = { :file => "CarrierWave...

The following two hints are taken from Github's Ruby style guide: If your regular expression mentions a lot of forward slashes, you can use the alternative delimiters %r(...), %r...

...complex, you can use the /x modifier to ignore whitespace and comments: regexp = %r{ start # some text \s # white space char (group) # first group (?:alt1|alt2) # some alternation end

yehudakatz.com

...there was a blog post entitled “What the Hell is Happening to Rails” that stayed at the number one spot on Hacker News for quite a while. The post and...

...many (but not most) the comments on the post reflect deep-seated concern about the recent direction of Rails. Others have addressed the core question about change in the framework...

...much faster than the configured up.form.config.watchInputDelay. Therefore, it may happen that you already entered something into the next field before Unpoly updates that field with a server response, discarding your...

The steps I wait for active ajax requests to complete (if configured) and capybara-lockstep can catch some of these cases, but not all. Both of these only wait...

weblog.rubyonrails.org

Rails 3.0 has been underway for a good two years, so it’s with immense pleasure that we can declare...

github.com

Hanna is an RDoc template that scales. It's implemented in Haml, making the sources clean and readable. It's built with simplicity, beauty and ease of browsing in mind...

artima.com

Martin Odersky talks with Frank Sommers and Bill Venners about the compromises and most important goals in Scala's design, its object-oriented innovations, and what's in it for...

...can reset the min-width. Say you have a simple grid layout: .container .first-item .second-item .third-item .container display: grid grid-template-columns: 100px 1fr 100px Your expectation...

...correct as the grid layout will try to do that: +---------+----------------------------+---------+ | | - 10 characters long | | +---------+----------------------------+---------+ However, if .second-item's content is too large to fit into the reserved space, it will...