A common pattern in Ruby is to to require all files in a specific diretory, using something like Dir.glob(Rails.root.join...
Checking if a JavaScript value is of a given type can be very confusing: There are two operators typeof and...
If you already selected an element and want to get its parent, you can call find(:xpath, '..') on it.
An end-to-end test (E2E test) is a script that remote-controls a web browser with tools like Selenium...
Slides for Henning's talk on Sep 21st 2017. Understanding sync vs. async control flow Talking to synchronous (or "blocking...
Download the dictionary from http://www.winedt.org/dict.html, e.g. http://www.winedt.org/dict/de_neu.zip unzip de_neu.zip mkdir ~/Documents/dic iconv -f UTF-16 -t...
RSpec allows defining methods inside describe/context blocks which will only exist inside them. However, classes (or any constants, for that...
There are several gems that make it easy to read and process xlsx files. Parsing the entire file at once...
Use return to return from a method. return accepts a value that will be the return value of the...
I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method...
Scope is all about where something is visible. It’s all about what (variables, constants, methods) is available to you...
You can use local copies of gems in your Gemfile like this: gem 'spreewald', path: '~/gems/spreewald' As soon as you...
In the ruby shell (IRB) and rails console the return value of the previous command is saved in _ (underscore). This...
I often see the use of || to set a default value for a variable that might be nil, null or...
ActiveRecord::RecordNotFound errors provide quite meaningful error messages that can provide some insight on application details. Consider the following:
This card will show you a cool way to define a class using Struct.new. A common usecase for Structs are...
Rails supports time zones, but there are several pitfalls. Most importantly because Time.now and Time.current are completely different things and...
Ruby's standard library is in the process of being gemified. It will soon - Ruby 2.5 - consist of RubyGems, which...
Dump this method into your Ruby console to quickly print data in columns. This is helpful for e.g. comparing attributes...
In case you want to require a gem, that is not in the Gemfile of you bundle and therefore not...
This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the...
Sass lets you easily specify multiple selectors at once like this: .some-block &.has-hover, &:hover outline: 1px solid red...
Barby is a great Ruby gem to generate barcodes of all different sorts. It includes support for QR codes via...
Looks like ActiveState is trying to market a new Ruby distribution for Enterprises: ActiveRuby Enterprise Edition is designed for businesses...