In Ruby on Rails, all objects have a useful blank? method. It returns true for nil but also for empty...

I often see the use of || to set a default value for a variable that might be nil, null or...

docs.puppetlabs.com

The condition for an if statement has to resolve to a boolean true/false value. However, all facts are strings, and...

Haml 6 was a major rewrite with performance in mind. To achieve a performance improvement of 1.7x, some design...

In ruby you can easily read and write CSVs with the standard CSV library class. On top of this, you...

CONCAT('foo', 'bar', NULL) = NULL the NULL always wins in MySQL. If you would rather treat NULL as...

tl;dr With ES2021 you now can use str.replaceAll(), Promise.any(), logical assignment operators, numeric separators and WeakRef on all major...

We recently noticed issues with Chrome 75+ when having the w3c option enabled within the Selenium webdriver. It looks like...

You can use JavaScript to get or set cookie values on the client. Using the vanilla JavaScript API

URLs can transport key/value pairs ("parameters") using this syntax: /path?foo=bar If the value is blank, mind these subtle...

We've since created ActiveType which has a restricted subset of Virtus' features. It might be enough for your needs...

apidock.com

E.g. when you're using a tagging gem, you have seen virtual attributes that get and set a string array...

Note that this card is very old. You might want to use ActiveType for your auto-coerced virtual attributes instead...

The Angular 1.2 way: # By default, angular returns undefined for invalid attributes which removes # the value from the form field...

This will not work (it always passes): Then the "Title" field should contain "" The value is turned into a regular...

By default, Rails views escape HTML in any strings you insert. If you want to insert HTML verbatim, you need...

Nokogiri is great. It will even fix invalid HTML for you, like a browser would (e.g. move block elements out...

durdn.com

This article contains: Making ‘git diff’ wrap long lines Set a global proxy Clone only a specific branch

stackoverflow.com

This will give you the string that appears most often in an array: names = %w[ foo foo bar bar bar...

Note: For PostgreSQL you should use advisory locks. For MySQL we still recommend the solution in this card.

This card describes four variants, that add a more intuitive workflow when working with nested attributes in Rails + Unpoly:

Learn to create test data effectively using factories. Decouple tests by having each test start with an empty database...

When doing some meta-programming magic and you want to do something for all attributes of a class, you may...

RSpec 1, RSpec 2 To test whether two arrays have the same elements regardless of order, RSpec 1 and 2...