Blog · Articles tagged with "ruby" · show all articles »

How to run Ruby scripts on AWS Lambda using Ansible

AWS Lambda is definitely one of the most fascinating services I have come across in the last years. As a web developer, the prospect of not having to deal with servers and scaling at all anymore, not even in the abstract sense of Heroku's dynos, is exhilarating.

And I'm not even that averse to doing ops stuff like many other developers. For example, I picked up Ansible about two years ago and have been using it to manage my own (DigitalOcean) servers ever since and even replaced Capistrano with a custom Ansible playbook to deploy my Rails apps.

Lambda really reminds me of how Elon Musk talks about reasoning from first principles rather than by analogy. AWS already offered a "traditional" cloud hosting service with EC2, and a managed one with Elastic Beanstalk, but with Lambda they really sat down and said "OK, let's start from scratch. A developers writes some code and wants to run it. We at AWS have all these regions, servers, databases and whatnot. What would be the easiest way we could let developers run their code without caring about any of it?" And the result is Lambda - upload your code in small chunks (functions) and run it, without thinking about servers or scaling at all.

Read on

Ruby's built-in databases - meet PStore and YAML::Store

Ruby keeps amazing me! Did you know it has not one, but two databases built right into its standard library? Okay, the two are basically the same under the hood, but still!

When you write a Ruby script, it's not unusual that you come to the point where you want to persist some data, so that when you run the script the next time, it can access that data from the previous run. Examples are the result of an API call you don't need to execute every single time the script runs, configuration values that rarely change, or a timestamp of the last time a certain action was performed.

Read on

How to use Basic Authentication with the Ruby Rest-Client gem

I hope this will save someone the hour that it just took me to google, try out several StackOverflow answers and finally finding the solution in the source code (note to self: move "check the source code" to the top of the list of things to try next time).

Read on

Extract your common Ruby gems for increased maintainability

After six years of writing Rails apps, for clients as well as side projects (and not-so-side projects), I started seeing a clear pattern in my Gemfiles, namely a bunch of gems I used over and over again.

Well, actually I probably started seeing those patterns already on the third or fourth Rails app, but by now I can be fairly certain that there are some gems that I will want to use in every project I work on.

Read on

Bringing Bootstrap and Ruby together

I've always been a huge fan of Bootstrap, the front-end framework started by two former Twitter employees. For me as a design-impaired programmer, it meant I could build front-ends for my projects all by myself, and they wouldn't look absolutely horrible.

Since I create all of my projects in Ruby (web apps as well as web sites), over the years I have searched for, found, and used (or not found and created myself) my fair share of Ruby wrappers for the different components Bootstrap offers. Often, when I found yet another Bootstrap related Ruby project on Github that did the same as another one, I have wished for a curated collection of those tools, which is exactly what I want to introduce in this post.

Read on

Introducing RubyDocs - Fast and searchable Ruby and Rails docs

Update June 1 2014: RubyDocs is now mentioned as reference documentation on the official Ruby website (look for "Ruby & Rails Searchable API Docs")!

Update May 25 2014: The source code for RubyDocs is now open source under the MIT license and available on Github. If you have any ideas for new features or run into any bugs while using RubyDocs, please open an issue!

RubyDocs was already launched at the end of 2013 but a few days ago I added the most-asked-for missing feature (being able to generate docs for just Ruby or Rails) and noticed that I have never officially introduced the project in a blog post, so here we go.


  • RubyDocs allows to you to generate sdoc docs for any version of Ruby or Rails (or both combined).
  • sdoc is awesome! (it also powers the official Rails API docs)
  •, which used to let you create sdoc docs, has been defunkt for a long time now, which is why I set out to build a replacement.
  • Does anyone know Vladimir Kolesnikov? He owns and I tried to get in touch with him to ask him to forward to but didn't get an answer.
Read on

How to migrate your websites from UptimeRobot to StatusCake with Ruby

UptimeRobot, which I have been a happy user of since 2010, has been failing me in the last months, reporting hundreds of false downtime alerts for my 34 websites monitored by them. Since beginning of March it has been particularly bad with 20-30 false alerts per day.

I tried to get in touch via Twitter and email a couple of times but received no response so it was time to say goodbye.

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

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