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

If you parse this Yaml ... yes: 'Totally' no: 'Nope' ... you get this Ruby hash: { true: 'Totally', false: 'Nope' }

You are probably using Ruby 1.8.7 with a too recent versions of Rubygems. Downgrade your Rubygems to the latest version...

makandra dev
tldp.org

There are 3 built-in file descriptors: stdin, stdout and stderr (std=standard). (You can define your own, see the...

stackoverflow.com

Create, or edit your ~/.irbrc file to include: require 'irb/ext/eval_history' # was 'irb/ext/save-history' for versions prior to Ruby 3.3 IRB.conf[:SAVE...

makandra dev

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

docopt.org

docopt helps you define interface for your command-line app, and automatically generate parser for it. docopt is based on...

If you want to label things with a color but don't actually care which cholor, you can use the...

If you want to do JavaScript-style camelization, ActiveSupport's String#camelize method can actually help you out. Simply pass...

wiki.macromates.com

When using TextMate2 with the cucumber bundle, it does not recognize step definitions (e.g. custom_steps.rb) as such but believes they...

blog.codeclimate.com

Splitting a long method into sub methods is easier in instances since it is in classes. Since...

lucaguidi.com

Ruby’s model for concurrency is based on threads. It was typical approach for object oriented languages, designed in the...

requiremind.com

Batman is an alternative Javascript MVC with a similar flavor as AngularJS, but a lot less features and geared towards...

makandra dev

When you call a method on an object, Ruby looks for the implementation of that method. It looks in the...

makandra dev

To print a colored full-width bar on the bash, use this bash script expression: echo -e '\033[37;44m...

makandra dev

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

String#indent is not a standard Ruby method. When you use it, be sure to know where this method comes...

Wondering how a specific method on an object is exactly named? You can use Enumerable#grep to detect it in...

When you are working with Backbone models and inheritance, at some point you want to overwrite inherited methods but call...

Warning: Because of (unclear) rounding issues and missing decimal places (see examples below), do NOT use this when dealing with...

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

makandra dev
github.com

Publish/subscribe for Ruby classes. Bonus: You do not have to declare events before using them.

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

coderwall.com

There seems to be no way to use therubyracer -v '0.11.4' and libv8 -v '3.11.8.17' on OS X Mavericks.