Pass rspec options from rake on command line

To pass rspec options from a rake task on command line,  use the env variable SPEC_OPTS. For example, to enable backtrace logging when running all spec tests:

rake SPEC_OPTS=-b

References: http://rspec.rubyforge.org/rspec/1.1.12/classes/Spec/Rake/SpecTask.html

 

Git through SSH port forwarding (SSH tunneling)

Scenario:

A.  you are on a firewalled network, from where you can’t access github (remote port:9418 is not allowed)

or

B. you want to access a securized git server from home, but your IP is not on the git server’s whitelist.

and, of course, you have ssh access on a server that can do this.

 

A. Make a ssh tunnel to the git server

Me –> ServerWithSSHAccess –> GitServer

Continue reading

Advice on using Ruby, RVM, Passenger, Rails, Bundler, … in development (via Jérémy Lecour)

This article is the english version of “Conseils pour utiliser Ruby, RVM, Passenger, Rails, Bundler, … en développement”, originaly written in French. If you have a better translation, I’d be happy to use it (full or parts) and credit you. Introduction : Why this advice The dev team I’m working in is composed of 3 people who use Ruby. Besides me, who’s is spending the most part of my time on Ruby and became “the one who knows” about this stuff, m … Read More

via Jérémy Lecour

Ruby/Rails: Parse large XMLs (SAX parsers, Pull parsers) + example of Pull parser

When you have to parse huge XML files (hundreds of MB-like), loading the whole XML in memory is not an option.

Continue reading

Ruby on Rails interview questions – RoR test from PeopleCentric

One of the recruiting companies that I have collaborated with in the past decided to publish many of theirs IT tests . You can find, among others, a Ruby on Rails test. Enjoy :)

Free IATA + ICAO airport codes database

Parsed from: Wikipedia.

Available on YAML or JSON format.

Data example:

- :airport_name: Charles de Gaulle International Airport (Roissy Airport)
  :complete_location: Paris, France
  :city: Paris
  :country: "France"
  :iata_code: CDG
  :icao_code: LFPG

Continue reading

Fetch data from heterogenous tables(Rails SQL views, SQL Union)

Let’s say you have a ‘cars’ table and a ‘bikes’ table, and the schema can not be changed. Some fields are the same, and you want to display ( paginate, search etc) a list with products that are both cars and bikes (from both the car and the bike models), sorted by their creation date.

This post is about how this can be accomplished using sql views.

Continue reading

Follow

Get every new post delivered to your Inbox.