When you have a string containing umlauts which don't behave as expected (are not matched with a regexp, can...

So you want your Ruby script to install missing gems instead of dying? Take this method: def installing_missing_gems...

If you get this error when you try to resize an OpenStack instance: # nova resize example 23 --poll

code-experience.com

React.js is a relatively new Javascript templating engine that has two-way-bindings like AngularJS or Batman. The interesting idea...

makandra dev

Spring is a Rails application preloader. When debugging e.g. the rails gem, you'll be wondering why your raise, puts...

makandra dev

When you want the table headers to always stay around (e.g. because that table is huuuge), use the code below...

If you come across an (older) application that is using Prototype instead of jQuery, you may often see events bound...

robots.thoughtbot.com

Declare an enum attribute where the values map to integers in the database, but can be queried by name.

medium.com

When you, as a developer, look at the choices used to build a particular application, you’re blown away at...

By default, Rails' validates_uniqueness_of does not consider "username" and "USERNAME" to be a collision. If you use MySQL...

medium.com

Article about implementing authentication (current_user) and authorization (access rights) in AngularJS. Has an surprising amount of practical and understandable...

Development environment setup Rails Composer Basically a comprehensive Rails Template. Prepares your development environment and lets you select web server...

makandra dev

rake stats # => LOC per controllers, models, helpers; code ratios, and more rake notes # => collects TODO, FIXME and...

makandra dev

Just found out about a great feature in Rails that seems to be around since Rails 2. Start a console...

Like in any language, a FLOAT will eventually corrupt data due to rounding errors. Please use DECIMAL, which has well...

Ask before leaving an unsaved CKEditor Vanilla JavaScript way, but removes any other onbeforeunload handlers: $(function(){ document.body.onbeforeunload = function() { for(editorName...

If you want to switch to another ruby versions, you have several options, depending on what you want: Do you...

css-tricks.com

Crazy hack. Might be useful one day. The code required has since been extracted into a library.

extensions.libreoffice.org

Colorizes code in LibreOffice Writer. Note that you need to create a paragraph style _code for this to work.

If your terminal has many tabs, you'll want to keep them organized. To change their title from the prompt...

I had a huge MySQL dump that took forever (as in: days) to import, while I actually just wanted to...

dev.mysql.com

A MySQL DECIMAL column is used when it is important to preserve exact precision. It takes two parameters, where...

makandra dev

We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically...

When you do something like this in your code: def var_value @var ||= some_expensive_calculation end