Having a unique selector for an element is useful to later select it from JavaScript or to update a fragment...

Haml lets you prefix a group of attributes by wrapping them in a hash. This is only possible with the...

makandra dev

Option 1: JSON dump In config/webpack/environment.js you can get inspect environment which includes all webpack config options set for the...

As a web developer, you know Google Analytics (GA). Probably you've dropped the GA snippet into more than one...

Why secure-only cookies used to be necessary Cookies have an optional secure flag. It tells the browser to not...

makandra dev

For webpages to load fast it's recommended to optimize images. Ideally an image's file size should be as...

Background information about session storage in Rails Rails has a default mechanism to store the session in the CookieStore. This...

If you want to fill in textareas with multiple lines of text (containing line breaks / new lines) you can use...

benmccormick.org

The linked article lists a number of techniques that were best practices with ES5, but have better alternatives in modern...

To make a local copy of an S3 bucket, I use the s3cmd command line tool. Configure access keys:

If possible your code should detect features, not browsers. But sometimes you just need to sniff the browser. And when...

Rails defines a #truncate helper as well as a method String#truncate. = truncate("my string", length: 5) = "my string".truncate...

makandra dev
litmus.com

The 90s are calling: they want their tables back. Unfortunately, you need them all for laying out your HTML emails...

stackoverflow.com

Ruby has this handy block shortcut map(&:to_i) for map { |x| x.to_i }. However, it is limited to argument...

Whenever is a Ruby gem that provides a nicer syntax for writing and deploying cron jobs. Leading zeros are important...

makandra dev
developer.mozilla.org

Here is how to model basic logic in media queries. AND With keyword and. # Target viewport widths between 500 and...

caniuse.com

Since late 2015, all major browsers (still excluding Firefox) support pointing device media queries. These can be used to distinguish...

The method cookies is defined in the ActionController and should never be overwritten. Bad example class StaticPagesController < ApplicationController

When you need to store structured data (like Ruby hashes) in a single database column with ActiveRecord, a simple way...

makandra dev

Authentication is a special part of web applications. On the one hand, it usually is a crucial security mechanism restrict...

rspec.info

RSpec let's you chain a matcher with .or. The expectation will then pass if at least one matcher matches...

developer.mozilla.org

Browsers' printing methods usually don't print background colors. In most cases this is the desired behavior, because you don...

Just like Ruby Gems tag their version releases to the corresponding Git commit, it can be helpful to track production...

makandracards.com

In medium-sized to large Rails applications, asset compilation can take several minutes. In order to speed up deployment, asset...