Blog

How to drop your Postgres database with Rails 4

Update September 28 2016: There is now a gem that you can include in your app to use the technique detailed below.

When you use Postgres as your database with Rails and try to drop your database using rake db:drop, you might run into this annoying error:

PG::ObjectInUse: ERROR:  database "myapp_development" is being accessed by other users
DETAIL:  There is 1 other session using the database.
: DROP DATABASE IF EXISTS "myapp_development"
Read on

How to access your Google Drive files with Ruby

I use Google Drive excessively for documents and spreadsheets, and recently I created a IFTT recipe to store all attachments I receive to my Google Mail email address on Google Drive. No more downloading from Gmail, looking for the downloaded file, opening Google Drive, uploading etc., everything is right there in its own folder. (funnily enough, Gmail added the possibility to open documents right in Google Drive shortly thereafter).

Now, a couple of days ago I had to access some files on my Google Drive from a Rails app, and after some trial and error I found a easy way to do so, which I want to detail in this post.

Read on

How to set up automatic retweeting using a Google Apps Script, Yahoo Pipes, and TwitterFeed

Update (June 2015): several people have pointed out in the comments that there seems to be a authorization problem somewhere in the Google Apps script. Unfortunately I don't have time to dig in and look for the issue. If you find the problem, please let me know so I can update this post!

When Twitter released their API v1.1 in September 2012, they removed the possibility to create RSS feeds from timelines, lists or search results, and thus rendered many retweeting services and manually set up workflows disfunctional. One can rant all about Twitter moving away from their roots of providing an open communication ecosystem and how those restrictions clearly serve the main purpose of getting people to twitter.com to show them ads, but here are the steps you need to take to get your retweeting back on track.

It has become a bit more complicated but no rocket surgery, as you will see.

Read on

The joy of Ruby and small incremental improvements

Yesterday I added a small new feature to the Tries gem I authored a while ago and was once again reminded what a wonderful language Ruby is and how deeply satisfying it is to be able to work on one's own projects, yet opensource as much as possible to see others benefit from it as well.

The feature isn't anything world-changing, but I needed it right then, so I took 2 hours and implemented it. A feature born out of a real need from a real user of the Tries library so to say.

Read on

Making PHP development bearable for Ruby developers using Coffeescript, Sass, and Haml

Preface: I don't want to bash PHP too much here, it is what it is, but I think it is clear that the Ruby community has put much more work into developing great tools to use while programming over the years, so any Ruby developer getting into PHP development should try and take some of those nice tools with her!

This week I had to start doing some PHP development, for the first time in about a year. Being a Ruby developer, I dreaded this moment, mostly because I am not so well-versed in PHP to avoid those little annoyances and inconsistencies that the language has accumulated over the years (or rather decades).

Read on

Bootstrap Navbar Helpers for Rails and Middleman

I'm in love with the Middleman static website generator and, after discovering it and falling in love with it, I immediately set out to rewrite all static websites I have up and running with Middleman. Since I'm also a heavy user of Bootstrap I ended up writing the HTML (or rather HAML) for the Bootstrap navbar many times as well. What's a Ruby developer to do? Gemify it!

Read on

GemConfig - A nifty way to make your gem configurable

This release is another case of "Jeez, this is the third time I'm doing X... let's see if there's a gem for that... nopes? Let's get started!" What follows immediately after that is, of course, putting the idea on my "idea list" (a Trello board) and letting it ripe there for a few months. But eventually I came around to it and present you with: GemConfig - A nifty way to make your gem configurable

Read on

CarFinder - Find your closest carsharing car

I am a big fan of the carsharing concept and I have been using the two largest providers DriveNow and car2go regularly here in Berlin since I discovered them a few months ago.

One thing I don't like about them is their websites. While the iOs and Android apps work quite well for finding a car, the websites were obviously designed not only for already registered users who want to quickly find a car, but also for prospective customers, press, investors etc. They contain a lot of clutter and the DriveNow website does not even make an attempt to determine your current location, so you have to zoom and swipe the map manually every time. Especially irritating since you want to reload the map repeatedly sometimes when on the hunt for the closest car.

After getting annoyed with their websites once too often I decided to do something about it.

Read on

Skimlinks - Access the Skimlinks product database from Ruby

The current project I'm working on, ProductWidgets, lets you add affiliate products to your website effortlessly. It is backed by the Skimlinks product database that lets you access 25 million products from over 4,000 merchants in 54 countries.

Skimlinks offers powerful APIs to access their huge database of products and merchants. I extracted the code I use to access these APIs to a Ruby gem for everyone to use. You can find the code and installation and usage instructions on Github.

Read on

Tries - Solidify your code and retry on petty exceptions

I am always watching out for chunks of code that I seem to reuse in every new project and the "tries" pattern is definitely one of them. So finally I found some time to wrap it up into a gem and even come up with a nifty tagline:

Solidify your code and retry on petty exceptions

Read on