Jonas Brusman

I like to do high fives, take photographs and make cool things with Ruby.

Deploy to Heroku from Github

Automatically deployment of your app to Heroku when it has been pushed to Github with github-heroku-pusher by ajlai on Github.

I found this little Sinatra app a couple of days ago and have now set up it to automatically deploy this Jekyll site to Heroku when I push the repository to my Github account. It receives a post from Github via the post-receive service hook, fetches the updates and push them to Heroku.

I have made some changes to the app, so use my fork until the pull requests has been merged. My fork adds support for private repositories and makes it run smoothly on just one free Heroku Dyno.

Just follow the instructions in the README and you’re done in less than 5 minutes.

Update 2014-06-10

I’ve have switch to a more competent solution for my continuous deployment to Heroku.

Update 2015-02-01

Heroku has released their own Github integration.


DSCF0522 - Version 2

I’m in the middle of my four-week summer vacation and it has been awesome so far. Took this photo of Eva a couple of days ago when we were visiting my mother, who lives right next to Göta Kanal.

Jekyll + Heroku + Unicorn = Blazing fast blogging

Deploy your Jekyll site on Heroku with 6 workers ready to take on your massive traffic without first having to generate the Jekyll site locally and there’s no need for a third-party buildpack. And the best of all, it runs on a single and free Heroku Dyno.


I have previously used jekyll --serverin my Procfile on Heroku which in turn generated the jekyll site and booted up a webrick server. But I wanted to run my site with Unicorn and it’s support for multiple workers on a single Dyno. And to do so my Jekyll site must be a Rack app.

Rack-Jekyll to the rescue! It was exactly what I was looking for, it turned a Jekyll site into a Rack app. I had some issues with it on Heroku and made a pull request with the fixes. At this moment it has been merge with the master but there is not a new version released of the gem.

Jekyll + Unicorn + Heroku

Jekyll-Heroku-Unicorn is a sample app of a simple Jykyll site with 6 Unicorn workers ready to be deployed to a free Heroku Dyno:

  1. git clone
  2. cd jekyll-heroku-unicorn and run bundle install
  3. heroku create followed of git push heroku master
  4. heroku open and you’re done!


IMG_3229 - Version 2

Took this photograph last year’s spring at Roxen outside Linköping while we were out looking for a Geocache.


DSCF0398 - Version 2 DSCF0420 - Version 2 DSCF0447 - Version 2 DSCF0451

Anders and Angelina came up from Malmö to celebrate midsummer with me and Eva here in Stockholm. On Midsummer’s Eve we went to Björkviks brygga, Värmdö and spent a day on the rocks by the sea. We ate great food and drank ice cold beers, and had a wonderful day together.

Björkvis brygga is a new favorite place in the Stockholm area, a real highlight that I really can recommend a visit.


DSCF0230 - Version 2

Spent the weekend in Linköping. PS. it’s only 5 days left until me and Eva are moving to our new apartment!

A Flickr plugin to Jekyll

This blog is driven by Jekyll and i have written a simple plugin to Jekyll that makes it easy to embed photographs from Flickr directly into your posts.

If you have a Gemfile, start by adding the fleakr gem to your Gemfile and run bundle install. If you don’t have a Gemfile, install the gem with gem install fleakr.

source :rubygems

gem 'RedCloth'
gem 'jekyll'
gem 'fleakr'

Then add the flickr plugin to your _plugins folder:

require 'liquid'
require 'fleakr'

Fleakr.api_key       = "XXX"
Fleakr.shared_secret = "YYY"
Fleakr.auth_token    = "ZZZ"


module Flickr
  def flickr_image(url)
    "<img alt='#{image_object(url).title}' src='#{image_object(url).large.url}'>"

  def flickr_medium_image(url)
    "<img alt='#{image_object(url).title}' src='#{image_object(url).medium.url}'>"


  def image_object(url)
    CACHED_IMAGES[url] ||= Fleakr.resource_from_url(url)


Read the readme for the fleakr gem on how to obtain your flickr api tokens. Then add them to the top of the flickr.rb file.

Loop over your photos in your post layout, for example like this:

  <h1>{{ post.title }}</h1>

  {% for flickr_url in %}
    <a href="{{ flickr_url }}">{{ flickr_url | flickr_image }}</a>
  {% endfor %}

  {{ post.content }}

    {{ || date:"%Y-%m-%d" }}</br>

Finally, the last step is to add one or more photos to your post:

layout: post
title: A blog post with photos from flickr
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

I have also published all these examples as a gist.