Jon Arrien


Interesting talk about how to handle ETL processes in Ruby with ActiveWarehouse.

Ruby objects to XML and back

In case you need to populate your database with some fake data from a XML file or you are creating some ETL processes where you want to map XML to RubyObjects, xml-mapping gem can help you achieving this task.

class Product
  include XML::Mapping

  text_node :ref, "@reference"
  text_node :desc, "Description"
  numeric_node :quantity, "Quantity"
  numeric_node :unit_price, "UnitPrice"

  def total_price



Cropping with ImageMagick & PaperClip

As described in the options below, PaperClip gives you a lot of features by appending special characters after the image dimensions:

  • Ignore Aspect Ratio (‘!’)
  • Only Shrink Larger (‘>’)
  • Only Enlarge Smaller (‘<‘)
  • Fill Given Area (‘^’)
  • Percentage Resize (‘%’)
  • Pixel Count Limit (‘@’)

But sometimes, this options are not enough, and you may prefer cropping the image with exact coordinates before saving it.

I’ve recently used JCrop, a small JS library that allows you to choose a region of an image and send x, y, weight and height to serverside. Afterwards, I needed to process the uploaded images with paperclip and for that situations I created a paperclip processor based on the default “thumbnail” processor and overriding transformation_command as shown below:


module Paperclip
  class Cropper < Thumbnail

    def initialize(file, options = {}, attachment = nil)
      @current_geometry.width = target.crop_w
      @current_geometry.height = target.crop_h

    def target

    def transformation_command
      crop_command = [ "-crop",
      crop_command + super



Redis Desktop

Redis Desktop Manager is a cross-platform open source Redis DB management tool. It is an early beta version, but looks promising.


Redis Desktop Manager

« Older posts

Copyright © 2018 Jon Arrien

Theme by Anders NorenUp ↑