Vincent Bakker

Rendering Markdown with RedCarpet in Rails

Go to app/Gemfile and add

gem 'redcarpet'

now in rails root directory

bundle install

Open app/helpers/application_helper.rb and add the following function:

def markdown(text)
    options = [:hard_wrap, :autolink, :no_intra_emphasis, :fenced_code_blocks]
    Markdown.new(text, *options).to_html.html_safe
end

Edit your view to include

markdown(@changelogs)

And done!

15 november 2021

Eva in a tub of milk

My version of 'Whoopi Goldberg in a tub of milk' with #pregnant Eva. We had a lot of fun in our old house with this vintage tub filled with powder milk. Time flies as the one in this belly is allready five years old now.

23 juli 2021

Hide flash messages using Stimulus

When converting some old code to stimulus I needed a way to hide the flash messages that Rails generates in native javascript.

(Flash messages are notifications to inform a user that a CRUD action has taken place. E.g. User updates successfully.)

import { Controller } from 'stimulus';

export default class extends Controller {
  static targets = ['message']

  connect() {
    this.timeout = setTimeout(this.closeFlash, 2500);
  }

  disconnect() {
    clearTimeout(this.timeout);
  }

  closeFlash = () => {
    this.element.style.display = 'none';
  }

  get flashBox() {
    return $(this.element);
  }
}
29 augustus 2020

Sun is shining, the weather is sweet

Day one of our #staycation in the dunes near Schoorl. Almost the same as France :)

29 juli 2020

Wandering Eye. Pretty much every phone booth in London is filled with these Tart Cards. They originated in the 1960s as handwritten postcards outside prostitutes’ flats or in the windows of newsagents. Apperently there’s a whole culture around these things.

28 april 2020

Every year in September we visit our parents in Portugal to catch some last summer sunshine. With the current corona epidemic chances are this trip (among others) will be canceled. We had great plans for 2020, but slowly this year is starting to fade away like it never happened.

05 april 2020

Inspired by Marc Lagrange’s - High priestess from the series And God Created Women I always admired how he walked the fine line between artistic and erotic nude.

29 februari 2020

Playing behind the curtains is one of those things every kid does. I captured this moment on our vacation. My son just stopped and stared. For me it represents growing up and the innocence of childhood.

26 februari 2020

Life is just better at the beach. Everything is better at the beach! With no where to go and no where to be, a day at the beach is just what you need.

24 februari 2020

Went to Venice a couple of weeks ago. The weather was cloudy in february but it was not so crowded as in the summer months. Took some great black and white pictures. It is one of those bucket list locations, but it's far from authentic. Great for a day or two.

22 februari 2020

I always like the way Helmut Newton uses mirrors as a recurring item in his photography. When I saw this big mirror in our hotel room in Venice I just new I had to take this picture. It was a good excuse to try out my new Fuji x100f camera.

20 februari 2020