Jonas Brusman

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

Forest

DSCF0623 - Version 2 DSCF0614 - Version 2

The last days of my summer vacation was spent at my fathers house, out in the countryside. Among other things we took a walk in the forrest to pick some chanterelles. Did not find that much mushrooms but it did not matter because I’m not so fond of it.

A web interface to Jekyll

Use Prose, a content editor for GitHub, optimized for managing websites, to get a web based interface for managing your Jekyll site (or other text-based content in your Github repositories). You can now write a new blog post or fix that typo without even leaving the browser. You can even specify metadata defaults for your posts.

This work really out of the box if you host your site on Github via Github pages but if you, like me, are using Heroku you need to set up some more automation. See my previous post on how to automatically deploy to Heroku when pushing to Github.

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.

Vacation

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.

Rack-Jekyll

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 git@github.com:himynameisjonas/jekyll-heroku-unicorn.git 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!

Roxen

IMG_3229 - Version 2

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

Midsummer

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.

Östergötland

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"

CACHED_IMAGES = {}

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

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

  private

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

Liquid::Template.register_filter(Flickr)

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:

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

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

  {{ post.content }}

  <footer>
    {{ post.date || date:"%Y-%m-%d" }}</br>
  </footer>
</article>

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

---
layout: post
title: A blog post with photos from flickr
flickr:
- http://www.flickr.com/photos/himynameisjonas/6167152072
- http://www.flickr.com/photos/himynameisjonas/6167152448
- http://www.flickr.com/photos/himynameisjonas/6167153574
---
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.

A night out

DSCF1829 - Version 2 DSCF1830 - Version 2 DSCF1869 - Version 2

A night out in July 2011. Emil and my brother David at Bröderna Olsson, Stockholm.