A place to share my knowledge and escapades in the world of web development.

Installing Vimdeck on Arch

| Comments

I’m going to be talking at Vim London again on Tuesday, so I thought I’d knock a quick presentation together. I was planning on using Vimdeck but it turns out it freaks out on Arch based Linux distributions, such as Manjaro (probably some other Linux distributions too).

When executing gem install vimdeck it tries to install RMagick which fails on my machine due to ImageMagick being installed with HDRI enabled, whatever the hell that is. Apparently the Arch team enabled it a few months back.

The solution? Clone the RMagick repository and execute the following.

gem buld rmagick.gemspec
gem install rmagick-{VERSION}.gem

Where {VERSION} is the version of the gem you just built. This will vary from the time when this post was written so I won’t bother putting the version I had in there. Now you have a fixed version of the gem install you can execute gem install vimdeck and it will install perfectly. If not, congratulations, you’ve discovered a new issue!

Now to write my presentation…

Always remain a beginner

| Comments

I’ve been programming for about five years, almost entirely in JavaScript, three of which being professional. I’m an absolute beginner and I always will be. This is a good thing.

Why remain a beginner?

Because a beginner will never stop learning. A beginner must continually progress or they will stall in their learning, stalling brings with it unhappiness and resentment towards your current situation.

Beginners actively seek knowledge and cast away presumptions, even if they think they know all there is to know about a given technology.

Test private methods

| Comments

If you’ve barely passed the title and you’re already seething with violent rage: This post is for you. Like medicine that smells of battery acid, this’ll taste bad and potentially kill you but you’ll feel better for it in a few days. Let it settle in for a bit, mull it over.

Herein lies my argument for testing private methods within JavaScript (and potentially any other language that doesn’t have real privates, I’m looking at you, Python).

Graph from scratch

| Comments

James mentioned the other day that he was drinking tea “at a rate of 0.75 OC”, OC being the base speed at which I myself consume a mug of that wonderful brown liquid. A little flurry of tweets ensued which resulted in me kind of accepting a joke/challenge using a meme.

This post is mainly about plotting a graph with nothing but JavaScript and a canvas element, but it also gives me a chance to finally document my tea drinking habits for the world to gaze upon in wonder.

Grabbing elements from the DOM

| Comments

If, like me, you actually quite enjoy working with the vanilla DOM implementations, you may wonder how you’re actually supposed to find the elements in the first place. I’ve been using quite a nice technique for a while now that allows you to have hyphenated names in your HTML, but keep camel case in your JavaScript even though you’re searching for the elements en masse.

Do things that scare you

| Comments

No, I’m not advocating base jumping while defusing a bomb, that’s a different kind of scared. I’m talking about things like learning Haskell or tackling TDD for the first time. Things that you can’t or won’t use right now. Things that make you go “eh?”.

I’ve only started looking for things that I don’t like the sound of since I became worried about stalling as a programmer. I had this horrible looming feeling that I was good with JavaScript and the web, but not too much else.

Classless JavaScript - Continued

| Comments

This is a follow on from my previous post, Classless JavaScript. You might want to read, or at least skim, that first.

I’ve been having a think about all this classless JavaScript stuff, which is basically normal JavaScript without traditional constructors, and I’ve come up with a few ideas to refine it. The first of which being DRY (Don’t Repeat Yourself). I’m going to show you the things I thought of and a few working examples of this strange technique.

Classless JavaScript

| Comments

As JavaScript developers, or even web developers as a whole, we seem terrified by the thought of direct usage. No technique or idea seems to be considered “legit” until it has been abstracted by several layers of syntactic sugar and, potentially useless, fluff.

One of the common abstractions is the addition of “classes” to JavaScript; prototypical inheritance isn’t good enough for us lot by the looks of things. We seem to crave the features of other languages when our language of choice isn’t really built for them, it’s built in a different way and probably shouldn’t have classical inheritance principals forced down its VM / throat.

So what if we worked with JavaScript in a more natural way? First, what would be more natural? Personally I believe that, like the underlying language, everything should revolve around objects; we create and manipulate these malleable entities instead of trying to lock things down and restrict our data.

This idea lends its self exceptionally well to functional programming and the actual VM, which no longer needs to mess with prototype chains or any other form of inheritance for that matter. It’s as raw as JavaScript usage can get, it’s kind of like C structs (although nothing like them at the same time) and I think it’s pretty elegant.

Handling concurrency and asynchronous JavaScript

| Comments

If you’ve worked with JavaScript in a browser, or indeed on the server, for any length of time you’ve probably had to deal with asynchronous spaghetti. This kind of spaghetti is not delicious in any way, shape or form.

You end up with multiple boolean variables and function calls constantly checking if all of those AJAX requests have finished; it is far from ideal. I’m going to show you how to break the problem down and come out of the other side with your sanity still intact.

Building for browsers in a terminal

| Comments

My entire web development work flow takes place within my terminal; obviously I need a browser too, but other than that I have no GUI tools floating around. I’m going to show you what tools I use and how I use them. Take from this what you will.