All posts by Jeppe Liisberg

Hacked By GeNErAL

Hacked By GeNErAL

Frit, neutralt, demokratisk Internet, tak!

Kære Jens Rohde,

Dette er blot en af sikkert rigtigt mange opfordringer, til at tage fri adgang til Internettet alvorligt. I sidste uge modtog EU parlamentet over 1 million underskrifter for at bevare og styrke et frit og åbent Internet. Jeg er en af disse stemmer.

Nu siger rygtet, at selvom der egentlig var enighed om en løsning der ville redde internettet, så støtter du tilføjelser, som alligevel vil tillade store, pengestærke firmaer og tilsvarende at få bedre internet adgang end resten af befolkningen.

For mig er Internet en resource i det moderne samfund, som for demokrati, vækst, innovation og alle mulige andre punkter, kan sammenlignes med andre, helt grundlæggende elementer i et sundt samfund, som f.eks. vand.

Derfor er det helt og aldeles essentielt, at vores internet forbliver frit, med lige adgang og lige rettigheder for alle.

Jeg ved at mange, der ikke gør som jeg og siger det højt, mener det samme.

Så vær venlig at tænke dig om en ekstra gang.

I18n power tool: stylesheet_flipper for rails’ asset pipeline

Spice up your localization toolbox with stylesheet_flipper: Make you left-to-right (LTR) designed css stylesheets support right-to-left (RTL) locales with a snap (and vice versa).

For the impatient: All this ended up as a gem, that you can find on rubygems and on github.

In my most recent startup, monibuds, we recently saw an opertunity to enter the Israeli market after having built our app for english and danish locales. But maintaining two sets of stylesheets, one for LTR and one for RTL seemed like a mess, so I started looking for better solutions. I wanted, using rails’ asset pipeline (sprockets), to enable right-to-left locales as well as left-to-right, but I only wanted to maintain a single set of stylesheets.

By building a railtie that registers a sprockets bundle_processor, you can hook into the asset pipeline and process any asset both on-the-fly (development) and during assets:precompile (production). Like this:

module StylesheetFlipper
  class Railtie < Rails::Railtie
    initializer "stylesheet_flipper.initialize_rails", :group => :assets do |app|
      app.assets.register_bundle_processor 'text/css', :stylesheet_flipper do |context, data|
        if context.logical_path.include?('-flipped')
          R2.r2 data

Then you only need to serve the stylesheet with the ‘-flipped’ postfix when you want to flip it. To do that takes a few steps:


 *= require application


def stylesheet_flipper
  if [:ar, :he].include? I18n.locale


<%= stylesheet_link_tag stylesheet_flipper %>


# for flipped versions to work, we need to bundle
# the stylesheet in dev mode as well
config.assets.debug = false


config.assets.precompile += %w( application-flipped.css )

Oh, and dont forget to add a direction to you body tag if you don’t have one

body {
  direction: ltr;

Et voila. Happy flipping!

Compiling assets during slug compilation on heroku cedar stack with rails 3.1

Trying to deploy a rails 3.1 app to heroku, I got the following error during slug compilation:

path/to/image.png isn’t precompiled

Precompiling assets failed, enabling runtime asset compilation

Turns out it is a rails 3.1.0 bug and upgrading rails to 3.1.1 (3.1.1.rc1 as of the time of this writing) solves the problem.

Don’t use windows for Ruby on Rails development

Starting a new task at a major company, I was given a PC running windows 7 (believe it or not, they never bothered to ask me for preferences) for developing an internal rails app.

I took the challenge – here’s my story.
Continue Reading →

Prototyping: Axure vs. Rails

In my quest to conquer the prototyping arena, I’ve met a tool called Axure a couple of times now. Since I want to do prototypes using my favorite tool, Ruby on Rails, I thought I’d better check out Axure to see what the competition is. Continue Reading →

Rails + jQuery request datatypes condensed

Recently I’ve noticed that the default behaviour for the jQuery UJS adapter has changed a couple of times.

This is my condensed take on getting ajax working smooth with jQuery UJS and Rails 3
Continue Reading →

Validate presence of at least one associated record

I’ve previously had the need to validate, that at least on record in a has_many association existed. For that I used a custom validator. But today i realized that the presence validator in rails 3 will do exactly that:
Continue Reading →

Bridging the gap: from prototype to development

Every project owner dreams of an approach with users and goals first. An approach where technology, requirements specifications and contracts are tools to support your business, not constrain it.

But too often, the opposite is the case. Users and goals are constrained by technology, specifications, and contracts. This is depressingly true. But it doesn’t have to be this way. Just choose the right prototyping technique and gain benefits in the entire value chain. Continue Reading →

New York Bikers

While visiting New York last week, I managed to shoot a couple of the wonderful people riding bikes in the city…

View the full photo-set on flickr