Bjorn Tipling

Software Engineer at imgur

Read this first

ramda’s functions can all be curried

Functions in ramda, a functional JavaScript library, can be curried.

To explain what I am talking about, I will use the assoc function available in ramda as an example.

Note: I created a jsbin you can play with to demonstrate the points I am making.

The assoc function is used to set or change properties on objects.

In the functional programming paradigm we avoid mutating values, so assoc returns a shallow cloned object with a property’s value changed. Here is an example:

const obj = {x: 'foo', y: 'lol'};

const newObj = R.assoc('x', 'bar', obj);
console.log(newObj); // logs `{x: 'bar', y: 'lol'};`

As you can see, the x property of obj was changed from 'foo' to 'bar' in the returned object.

obj remains unchanged:

console.log(obj); // logs `{x: 'foo', y: 'lol'};`

Now instead of passing in all arguments at once, you can pass in just the ones you want to curry, and the result

Continue reading →

Good-bye GitHub Stars, Setting Up Private gitweb Hosting on Ubuntu

I have installed gitweb on my Ubuntu 14.04 server to self-host my projects. I am using nginx to run the CGI script.

To set this up yourself is a simple enough process. Follow DigitalOcean’s instructions for setting up a private git server and then install gitweb and nginx:

sudo apt-get install gitweb fcgiwrap nginx

Make sure /usr/share/gitweb/ is readable. I just went ahead and made it globally readable:

sudo chmod -R +r /usr/share/gitweb/

If you followed the instructions linked to above edit your /etc/gitweb.conf so $projectroot = "/home/git";

Edit your nginx config:

sudo vim /etc/nginx/sites-enabled/default

I will access gitweb via, you might want to change /git/ to something relevant to you:

server {
    listen 80 default_server;

    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name localhost;
    location /git/static/ {

Continue reading →

If programming languages were weapons


C is an M1 Garand standard issue rifle, old but reliable.


C++ is a set of nunchuks, powerful and impressive when wielded but takes many years of pain to master and often you probably wish you were using something else.


Perl is a molotov cocktail, it was probably useful once, but few people use it now.


Java is a belt fed 240G automatic weapon where sometimes the belt has rounds, sometimes it doesn’t, and when it doesn’t during firing you get an NullPointerException, the gun explodes and you die.


Scala is a variant of the 240G Java, except the training manual is written in an incomprehensible dialect which many suspect is just gibberish.


JavaScript is a sword without a hilt.


Go is the custom made “if err != nil” starter pistol and after each shot you must check to make sure it actually shot. Also it shoots tabs instead of blanks.


Rust is a 3d printed gun. It may

Continue reading →

Advanced objects in JavaScript

This posts looks beyond everyday usage of JavaScript’s objects. The fundamentals of JavaScripts objects are for the most part about as simple as using JSON notation. However, JavaScript also provides sophisticated tools to create objects in interesting and useful ways, many of which are now available in the latest versions of modern browsers.

The last two topics I talk about, Proxy and Symbol, are based on the ECMAScript 6 specification and are only partially implemented and of limited availability across browsers.

 getters and setters

Getters and setters have been available in JavaScript for some time now but I have not found myself using them much. I often fallback to writing regular functions to get properties. I usually end up writing something like this:

 * @param {string} prefix
 * @constructor
function Product(prefix) {
   * @private
   * @type {string}

Continue reading →

Maps, Sets and Iterators in JavaScript

In my last JavaScript post I wrote about about how to make advanced usage of objects in JavaScript. Continuing in a similar direction, in this post I want look at some new kinds of objects in JavaScript. I will look at maps and sets, including their “weak” counterparts, weakmaps and weaksets, also the new for...of iterator and the new type Array Iterator.

As of September 2014, these new features are not fully implemented across all browsers yet, so most of these examples will only work in Firefox and Chrome Canary. I am using Firefox Nightly and Chrome Canary to create and test the jsfiddle examples. It may be the case that the examples also work in some of the beta versions, but I haven’t checked.

I am going to begin by looking at the new Map type in ECMAScript6.


Developers usually just use regular JavaScript objects when they want maps. Stuff is mapped in an object by

Continue reading →

What you should know about JavaScript regular expressions

Regular expressions in JavaScript may not always be intuitive. I aim to provide some clarity by providing examples about things I have found myself getting stuck on. This post covers a few topics including state in regular expressions, regular expression performance and various things that have tripped me up.

 regular expressions are stateful

Regular expression objects maintain state. For example, the exec method is not idempotent, successive calls may return different results. Calls to exec have this behavior because the regular expression object remembers the last position it searched from when the global flag is set to true.

As an example, examine the following code:

var res, text = "foo1 bar1 foo2 bar \n foo3 bar2",
    regexp = /foo\d (bar\d?)/g;

console.log("regexp.lastIndex:", regexp.lastIndex);
while (res = regexp.exec(text)) {

Continue reading →

all this

Coming from a sane language you might think that this in JavaScript is kind of like this in an object oriented language like Java, something that refers to values stored in instance properties. Not so. In JavaScript it is best to think of the this as a boggart carrying a bag of data with an undetectable extension charm.

What follows is what I would want my co-workers to know about using this in JavaScript. It’s a lot and much of it took me years to learn.

 global this

In a browser, at the global scope, this is the window object.

<script type="text/javascript">
console.log(this === window); //true


In a browser, using var at the global scope is the same as assigning to this or window.

<script type="text/javascript">
    var foo = "bar";
    console.log(; //logs "bar"
    console.log(; //logs "bar"


If you create a new

Continue reading →



Continue reading →

How to make an IntelliJ IDEA plugin in less than 30 minutes

Sometimes it is a nice thing to extend an editor to have it do some new stuff, like being able to revert an open file to its state on disk. In this post I’m going to quickly demonstrate how to start and finish a plugin to extend the IntelliJ IDEA editor from Jetbrains.
These instructions will work if you have the Ultimate or Community edition, and you can make the plugin available for all IntelliJ based editors including WebStorm, PyCharm, RubyMine and PHPStorm.

Whether you can finish these instructions under 30 minutes depends on your internet connection speed, because you have to do a git clone of the IntelliJ Community Edition source code, and that’s a lot of stuff to download.

At my current employer Floobits we are working on an IntelliJ plugin, and through that process I have learned most of this.

 System requirements

OS: I have developed plugins for IntelliJ on both Mac OS X

Continue reading →

A new home

Hey I have a site again, so my domain works again. Sorry for the downtime and that all the old links are broken. I used to use a tumblr but got rid of it like a year or so ago because of all the personal photos on it. I don’t really share photos anymore.

Also svbtle really wants you to write nice posts. This is just a short thing though. :/

Continue reading →

Subscribe to Bjorn Tipling

Don’t worry; we hate spam with a passion.
You can unsubscribe with one click.