Bjorn Tipling

Software Engineer at @floobits

Read this first

If programming languages were weapons

m1.png

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

numchucks.png

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.

molotov.png

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

240G.png

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.

manual.png

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

sword.png

JavaScript is a sword without a hilt.

starterpistol.png

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.

3dprintedgun.png

Rust is a 3d printed...

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} */ this.prefix_...

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 </script> 

jsfiddle

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(this.foo); //logs "bar" console.log(window.foo); //logs...

Continue reading →


aging

age1_small.png

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...

Continue reading →


A new home

Hey I have a site again, so my bjorn.tipling.com 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 →

Get updated when Bjorn Tipling publishes

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

0obbK04LYREL9i0ib5l