A collection of snippets to generate random number under certain conditions, as: gaussian with a specified distribution triangular distribution
Geoffrey Grosenbach has created Gruff for easily plotting graphs. It is written in pure Ruby and integrates with Rails applications...
If you need a gem for a certain purpose, be sure to check this site. The rankings are determined by...
Consider the following HTML & CSS: ^ img { background-color: red; } div { border: 1px solid black; } This will leave a margin of...
Localizing a non-trivial application can be a huge undertaking. This card will give you an overview over the many...
You will find this useful when creating responsive designs that work well on small screens. The attached Javascript gives a...
If your project uses another version than your default Ruby, RubyMine will give you incorrect inspections, for example.\
There is a conflict between current capistrano versions and the 2.5.1 net-ssh gem. Make sure you upgrade to 2.5.2...
When requests arrive at the application servers simultaneously, weird things can happen. Sometimes, this can also happen if a user...
Say you want to vertically align a div box inside a div container. This is how you do it:
Using beginning_of_day or end_of_day on Date or DateTime objects in Rails 2.x applications will never...
Removing duplication from the code is a seemingly easy task. In many cases it is pretty straight-forward – you look...
Slides presenting ways to integrate the ideas of Aspect-Oriented Programming in Ruby. Outline Why Aspect-Oriented Programming?
If you get an error like this ... can’t find executable rails for rails-3.2.3 (Gem::Exception) ... one of several...
OCRA (One-Click Ruby Application) builds Windows executables from Ruby source code. The executable is a self-extracting, self-running...
Every time I started RubyMine, it opened the main window on the left monitor -- when moving it to the center...
All our projects have enum-like requirements like this: An attribute value must be included in a given set of...
Controller responses often include Javascript code that contains values from Ruby variables. E.g. you want to call a Javascript function...
An association defined with has_many :through will return the same record multiple times if multiple join models for the...
This is for you if Passenger gives you the following useless error message. Passenger encountered the following error:\ The application...
How to get a backtrace from a running Ruby process: Ruby 2.6 # First, find out the PID of your Ruby...
TL;DR {} binds stronger than do … end (as always in Ruby, special characters bind stronger than words) Demo
This card needs to be updated for Rails 3+. Since there is no --debugger flag you need to run:
The following two hints are taken from Github's Ruby style guide: If your regular expression mentions a lot of...