I really have to blog more!

It’s been a hell of a long time since I last published something here. The reason for this can be described with in words: MASTERS THESIS. This past semester was my last at NTNU and the past few months have been spent pounding some healthy combination of Red Bull, nuts, pizza and tacos (and possibly some Oreos too). Combined with the fact that I really wanted to watch the NBA Finals this year, I also got to turn my sleeping rythm around to become somewhat nocturnal.

After clawing my way through the past month to finish my thesis (in style, I hope), summer is finally here, which means time for me to do more blogging! During the past weeks, quite a few things have come to me as possible things to write about, possibly a result from my acts of procastination while finishing my thesis. :stuck_out_tongue_winking_eye:

Elm: What’s the hype all about?

Elm is a functional programming language created for the sole purpose of designing user interfaces for the browser. It basically takes the concepts introduced by React and Redux and make a programming language from it. I am going to look more into Elm during the summer, and hopefully put one or more posts out on what I think. I’ve been going through part of the docs and some tutorials already, and it all seems pretty exciting!

Work work work!

I’m starting my career as a full-time professional developer in August. I’m gonna have a ton of new experiences, which ought to give me tons of fun stuff to write about.

Open source stuff

Lately, I have been spending more and more time trying to contribute to some of the open-source projects I enjoy using. I think this is great fun, and all developers should do so. I am gonna put out some posts about some of the projects I have been contributed to, including one of my own, which has a little, tiny bit of traction.

At the time of writing, I am getting ready for my first customer interview as a consultant. If all goes well, I’ll get to work all day with all the fun, jazzy technologies, like React, Redux, Node, ES6 and WebSockets. Wish me luck!

Python poetry!

Long time, no blogging! To say I haven’t been blogging lately because I’ve been busy wouldn’t be entirely true, I just haven’t found anything fun to write about.

I lay awake the other night and thought, I gotta write SOMETHING!. Then it struck me: Python poetry. Billion dollar idea, right? Perhaps not, but I feel that I owe much of my self-proclaimed prowess as a developer to the Python language. Lately I’ve been using node.js more and more in cases I would have used Python, had you asked me some years ago. That’s why I wanted to write this poem as an homage to how much Python has helped me out. Here it goes:

I started out coding, some five years ago, the language was MATLAB, though I wish it was Go.

I don’t think Go existed when I started coding (at least I had no idea it existed), but hey, it rhymes!

I was really tired, of tough physics lore, I went to switch majors, to code even more.

For reference, during my first semester at NTNU, I was majoring in Applied Physics, before I switched to Communications Technology.

I first was astounded, how simple it was, when I first coded Python, I felt like a boss!

At first it was for-loops, and functions and such, And then there was Django, it assisted me much.

Django is really what taught me to develop web applications, which is what has become my bread and butter (in the future, hopefully, at least) as a career developer. However, it is important to expand one’s horizon as a developer:

While Python has helped me, to get good with code, lately I’ve tended to do more with node(.js)

The .js in node.js is silent, right?

That does it for this time. I hope you had fun reading this (it was fun to write, at least!). Until next time!

Productivity Chronicles: Use vim everywhere!

It feels like ages since my last post. I apologize for this. I have been pondering what to write about next, and I’ve decided to write another post on how I try to utilize small, useful perks that add up to increased productivity. One of these things is how I like to use vim-like keybindings whenever available. (If vim sounds completely Greek to you, have a quick glance here. This post is not an attempt to convince you to use vim, but rather embracing some of its features and aspects that applies to other applications.)

vim navigation to the people!

If you’ve ever used vim, you know that it may cause a great deal of confusion the first time you use it. The keybindings don’t exactly feel natural. This is a matter of practice and adaption to a different scheme than the one you may have previously encountered. Trying to use vim for the first time may end up looking like this:

View post on imgur.com

However, the initially confusing keybindings of vim are, in my opinion, its greatest strength and contribution! The point of using the h, j, k and l keys to navigate a file is to avoid moving your hands around the keyboard. Take a timeout and think about the following: Which combination of hand movements do I perform the most while using my computer?. For a great deal of you, the answer may be close to one of the following:

  • Move the cursor. Click a menu item or link. Repeat.
  • Type some text, type backspace n times and type some more.
  • Type text. Move the cursor, using the mouse. Type some more elsewhere in the file.

These actions, which I have to tried to make as generic as possible, all have one thing in common. They all involve having both hands on the keyboard, lifting one of them to move the mouse, click something, and repeating. If you work a job requiring you to work a computer around eight hours a day, you’re prone to developing some kind of repetitive strain injury. Sounds scary, right? It does to me, which is why I like to use vim-like keybindings whenever they are available (also I think it cools cool when I can navigate stuff without the mouse. Makes me feels somehwat like a Jedi, which should be the ulimate life goal for anyone. Search your feelings, and you’ll find it to be true). Specifically, I use them extensively while writing code, and while browsing the web. Those two activities constitute the majority of my keypresses and not having to using the mouse our touchpad the entire time, is indeed a huge weight of my shoulders.

Shut up and take my money!

But Jonas, what if I want to try this, too? Fear not, starting out with using vim-keys in the browser is as easy as installing another browser extension (You know, stuff like AdBlock). If you’re a Chrome or Vivaldi user, there is vimium, which is the one I’ve been using lately. It allows for page navigation, and adds a Vomnibar, which is a pop-up HUD display that allows for some nifty navigation tricks, such as fuzzy searching of your browsing history or bookmarks. It also provides a very importan feature: The ability of identifying a link on the page and navigating to it, only by a few keypresses. No mouse movements needed!

I haven’t used them as much, but for Firefox users, there are similar tools, including VimFx and vimperator.

Give it a try!

To summarize this post: Try using vim-keys for a few days, and I am confident that you will indeed enjoy the reduced number of mouse movements needed. What’s the worst thing that can happen? You go back to your old habits, which is by no means bad, but you won’t feel as badass!

Productivity Chronicles: zsh

In my first post on this blog, I wrote that I wanted to write about actions I’ve made in order to become more productive as a developer. I’m gonna call these types of posts The Productivity Chronicles. First out is a post on how I switched to using zsh instead of bash as my terminal prompt.

Type, mistype, correct

As a developer, one of the tools I use A LOT is the terminal prompt. Whether it is to start some Python interpreter, update the software on my system, or simply jot down things in Vim, a great deal of keypresses are dedicated to entering commands and cursing under my breath when I type something wrong, which tends to happen quite frequently. In this post I wanna share briefly how things went by as I made the switch from using bash to using zsh as my preferred prompt.

Bash: The only reality, or is it?

When I first started playing around with code in 2011, I was an OS X user. There was really no particular reason for this, I just wanted to see what all the fuzz seemed to be about. This is where I was first introduced to the world of terminal prompts.

Little did I know that although OS X ships with a bash interpreter, it is of an ANCIENT version. It is worth noting for the sake of this post that the first version of said prompt saw the light of day pretty much right after the last dinosaur decided to pack up and leave this world. That much said, the early version of bash on OS X is not necessarily a problem by itself. The problem, or at least a weakness, is how assuming the bash prompt is to its users. It does not offer any form of assistance to mortals like myself who tend to frequently enter commands in quite bogus and erroneous ways. This is no surprise, as bash is originally meant to be a scripting language, not a full-blown shell prompt. Although by doing ones research, one can indeed customize the prompt and add tons of completions and sugar to their setup, this tend to be somewhat hackish at times. This is where zsh comes in (as well as other alternative prompts, such as fish). These prompt providers are focused on being user-friendly, as their most frequent use will be humans typing commands.

zsh: Human-first. Customize at your own leisure!

As stated, the feature that stands out when discussing zsh as being superior to bash as a shell prompt, is the ability to customize and fine-tune its usage. This feature can also be quite intimidating to some users, including myself. I was therefore happy to discover that there exists a number of nice frameworks out there to help get the best of ones zsh use. I ended up using oh-my-zsh, for the simple reason that it was so incredibly easy to get up and running! I won’t go out on a limb to raise the framework to some sort of sainthood, but I recommend you check it out if you’re into completions and stuff. It comes bundles with a bunch of handy stuff, such as git completions, which I use on a daily basis.

That’s it for this post. If you’re interested in how to use oh-my-zsh, check out my dotfiles repository.

Laugh at your code!

This is a short post, a type of post I like to write whenever something comes to me (or most likely, rarer). Most times they’ll be some nice code snippet I came across somewhere I felt like sharing, or maybe something different altogether? Here at least, its about something I think about from time to time: how powerful it can be to write code that makes you laugh.

Ever since I started programming (sounds an awful long time ago, but it was really 2011, when I first started college), I’ve enjoyed using languages that encourage the writing of fun code. By fun, I mean employing techniques offered by the language to achieve something traitionally done in a slightly more laborous way. For example, as an avid Python programmer, I’ve come to love using list comprehensions, which is a handy way to simplify iterations. For example, the following snippet extracts all rotten eggs from a carton:

rotten_eggs = []

for egg in carton.eggs:
  if egg.is_rotten():
    rotten_eggs.push(egg)

By using the far more sexier list comprehension approach, you can do it like this:

rotten_eggs = [egg for egg in carton.eggs if egg.is_rotten()]

Neat, right? I would prefer this type of code over the former any day of the week, and this is what I wanted to put out there in this post. When I see these types of snippets in a project, I tend to chuckle! I’ve caught myself sitting all by myself, and laughing outloud, as if I was building some Weapon of Doom or something, simply because I strongly believe in making use of these simple, yet powerful techniques, when available to you, as they are indeed a great asset! Your code is easier to read, both for yourself and for anyone that may come across it in the future.

That’s it for today. Tomorrow I hopefully get to start work on my Master’s thesis, which I won’t write much about here, as I’ll end up publishing it in the end. Better start counting days (or not, please don’t).

In some of my next posts I’ll try to write about some of the tools I like to use when hacking around, such as zsh and Atom. Cheerio.