Storing trees in databases

Posted About 7 years ago by Henning Koch.

This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the...

ruby-sass: Do not use comments between selector definitions

Posted About 7 years ago by Dominik Schöler.

Sass lets you easily specify multiple selectors at once like this: .some-block &.has-hover, &:hover outline: 1px solid red...

Generating barcodes with the Barby gem

Posted About 7 years ago by Arne Hartherz.
github.com

Barby is a great Ruby gem to generate barcodes of all different sorts. It includes support for QR codes via...

ActiveRuby

Posted About 7 years ago by Henning Koch.
activestate.com

Looks like ActiveState is trying to market a new Ruby distribution for Enterprises: ActiveRuby Enterprise Edition is designed for businesses...

Running external commands with Open3

Posted About 7 years ago by Tobias Kraze.

There are various ways to run external commands from within Ruby, but the most powerful ones are Open3.capture3 and Open3.popen3...

Ruby: Return boolean for regex comparison

Posted Over 7 years ago by Emanuel.
stackoverflow.com

A collection of code snippets which return a boolean value for a regex comparison. regexp.match?(string) # Recommended for Ruby >= 2.4...

Choosing the right gems for your project

Posted Over 7 years ago by Emanuel.
evilmartians.com

Adding a gem means you take over the liability towards the external code. Checklist Based on "To gem, or not...

rbenv: A basic introduction

Posted Over 7 years ago by Tobias Kraze.

We have projects that have been developed using many different versions of Ruby. Since we do not want to...

When upgrading/downgrading RubyGems and Bundler on a server, you must clear bundled gems

Posted Over 7 years ago by Dominik Schöler.

On application servers, gems are usually bundled into the project directory, at a location shared across deployments. This is usually...

Ruby 1.8.7: Bundler crashes with "deadlock" and core dump

Posted Over 7 years ago by Dominik Schöler.

deadlock 0x7f8a4160a360: sleep:- (main) - /home/me/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/bundler-1.14.3/lib/bundler/worker.rb:43 deadlock 0x7f8a38c03b08: sleep:- - /home/me/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/bundler-1.14.3/lib/bundler/worker.rb:56 *** longjmp causes uninitialized stack frame ***: /home/me/.rbenv/versions/1.8.7-p375/bin/ruby terminated

How to install guard-livereload 2.5.2 on Ruby < 2.2.5

Posted Over 7 years ago by Dominik Schöler.
github.com

There are some inconvenient Gem dependencies. Resolve them by adding/modifying these lines in your Gemfile: gem 'guard-livereload', '>= 2.5.2', require...

[jruby] TruffleRuby Status, start of 2017

Posted Over 7 years ago by Henning Koch.
lists.ruby-lang.org

TruffleRuby is an experimental Ruby implementation that tries to achieve ~10x performance over MRI. This has been on our radar...

How to tackle complex refactorings in big projects

Posted Over 7 years ago.

Sometimes huge refactorings or refactoring of core concepts of your application are necessary for being able to meet new requirements...

Enabling ** in your bash

Posted Over 7 years ago by Arne Hartherz.

You may know the double asterisk operator from Ruby snippets like Dir['spec/**/*_spec.rb'] where it expands to an arbitrary...

Ruby: String representations of regular expressions

Posted Over 7 years ago by Arne Hartherz.

Ruby's regular expressions can be represented differently. When serializing them, you probably want to use inspect instead of to...

Fix Rubygems binary error: undefined method `activate_bin_path' for Gem:Module (NoMethodError)

Posted Over 7 years ago by Henning Koch.

So you're getting an error like this: undefined method `activate_bin_path' for Gem:Module (NoMethodError)

Net::SSH::Exception: could not settle on encryption_client algorithm

Posted Over 7 years ago by Thomas Eisenbarth.

TL;DR: Update the 'net-ssh' gem by adding to your Gemfile: gem 'net-ssh', '=2.9.1' Now run bundle update...

Bundler: Gemfile.lock is corrupt & gems are missing from the DEPENDENCIES section

Posted Over 7 years ago by Henning Koch.

So you're getting this failure when running bundle install on an older project: Your Gemfile.lock is corrupt. The following...

A collection of graph and diagram tools

Posted Over 7 years ago by Emanuel.

Plot graphs in Ruby WebGraphviz renders in your browser via JavaScript (to store the rendered graph, extract the SVG using...

Summarizing heredoc in Ruby and Rails

Posted Over 7 years ago by Emanuel.

This card tries to summarize by example the different uses of heredoc. In Ruby << vs. <<- vs. <<~ In Rails strip_heredoc...

Linux: Using grep with a regular expression

Posted Over 7 years ago by Andreas Robecke.

You can use three different versions of the regular expression syntax in grep: basic: -G extended: -E(POSIX)

Ruby: Writing specs for (partially) memoized code

Posted Over 7 years ago by Dominik Schöler.

When you're writing specs for ActiveRecord models that use memoization, a simple #reload will not do: it 'updates on...

Subclassing module

Posted Over 7 years ago by Andreas Robecke.
solnic.eu

Yesterday I stumbled across a talk in which the guy mentioned module sub-classing. I was curious what you can...