Blog

Priorities

Update (August 2, 2017): Good news, everyone! I started writing on Medium. Here's the first post. Like and follow me and all that.

This announcement is mostly for myself, so I stop feeling bad about not blogging on this here blog as much as I'd like...

Read on

Simple and Powerful - the Alexa Flash Briefing Skill API

I have had a Amazon Echo for a few months now and I really love it! I agree that it will likely become the operating system of the home - there are just so many services that are easily controllable through voice (at least for the most common use cases) and having them readily available in your home without the need to search for your phone or open your laptop will surely change how people use these services in the years and decades to come.

Since I bought the Echo, I wanted to write a Skill for Alexa myself. Then I stumbled upon the news that the Alexa Flash Briefing Skill API became available in the UK and Germany on March 28, 2017. Flash Briefing Skills are a group of Skills that can be activated by Alexa users for their Flash Briefing, a customizable news update that Alexa reads to you when you ask her "Alexa, what's new?" (and it has some other triggers as well of course).

Read on

Updating Middleman extensions to work with Middleman v4

I created and maintain a two Middleman extensions and always planned on upgrading them to work with Middleman v4 (which was released more than a year ago!). Since I hadn't upgraded any of my Middleman powered websites to v4, there was never an urgend need though, but I finally found the time.

There's a great guide on how to create an extension with the new v4 syntax, but unfortunately no official guide (yet!) on how to upgrade an extension to work with Middleman v4. So I simply looked at a few other extensions that had been upgraded already and also checked the Middleman source code for what had actually changed.

If you have more tips or experienced other difficulties in upgrading an extension, please leave a comment below! I'd be happy to extend this post to make it more comprehensive, and maybe it can become the source for an Extension Upgrade Guide in the official Middleman docs.

Read on

Autospace Bootstrap columns on small screens

A little trick I have been using in pretty much every design I worked on that was based on Bootstrap is to automatically add a margin between grid columns when they break/collapse, i.e. are displayed vertically instead of horizontally.

Read on

Spiegel Fotostrecken Awesomizer - Verleih den Spiegel.de Fotostrecken die nötige Portion "Awesome"!

Update (September 2016): Die Extension wurde für das neue Spiegel.de-Design angepasst!

Manchmal besucht man eine Webseite fast tagtäglich und bemerkt irgendwann, nach Jahren, dass sie sich einfach nicht weiterentwickelt oder benutzerfreundlicher wird. So habe ich letzte Woche gemerkt, dass die Fotostrecken auf Spiegel.de von der Usability her immer noch im letzten Jahrtausend feststecken - für jedes Bild wird die komplette Seite (mit allen Trackern und Werbebannern) neu geladen, die Pfeile zum Vor- und Zurückblättern sind winzig (12px breit und hoch!), es gibt keine Übersicht der gesamten Fotostrecke in der Form von Thumbnails, und das Weiterblättern mit den → und ← Tasten oder dem "Swipen" auf dem Trackpad ist auch nicht möglich. Alles Features, die man von Bildergalerien eigentlich seit Jahren gewöhnt ist!

Zufällig bin ich kurz danach über das Plugin Fotorama gestolpert, mit dem man sehr einfach aus ein paar Fotos eine hübsche Bildergalerie erstellen kann. Anstatt Fotorama auf meine Liste von interessanten Projekten zu setzen, in der Hoffnung, dass ich es dann auch wiederfinde, wenn ich es mal wirklich brauche, habe ich mir ein paar Stunden Zeit genommen und es in einer Chrome Extension verpackt, die die Spiegel.de Fotostrecken damit anzeigt.

Read on

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

Testing async ActionMailer jobs with ActiveJob in Minitest

One of the fantastic new libraries that came with Rails 4.2 is ActiveJob - a standard interface to background queues like Sidekiq, Resque or Delayed Job. It lets you write your jobs using the ActiveJob syntax and decide on a background queue later. And if - a year from now - you are not happy with your choice of background queue anymore, you can switch it out without having to rewrite any of the worker code.

But the real power of ActiveJob is that it abstracts the implementation details of the different queuing backends and lets you develop additional tools and libraries around that central API. Any gem can now safely enqueue background jobs for example, without having to know what queue backend the application uses.

An important aspect of background jobs is the ability to test them of course. You want to make sure that a certain piece of code really enqueues a job, and that its the right job with the right parameters!

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

How to validate the uniqueness of an attribute across multiple models in Rails

I recently ran into the situation where I had multiple models that each had a identifier field, and each object of each model had to have a unique value for this field.

Now, in my specific situation, I could have used UUIDs, because I was using Postgres and the identifier didn't have any other requirements apart from being unique, but there is a nice generic way to implement uniqueness checks across models in Rails, which is what I chose to use.

Read on