Oliver Caldwell's blog

On languages, text editors and tools.
https://oli.me.uk/ (RSS)
visit blog
Recent video content
1 Mar 2021 | original ↗

I’ve been slacking on the blogging front, sorry about that! But I haven’t been idle, I’ve been pushing out Conjure releases and speaking at conferences as much as possible. I thought I’d post something here to prove I’m still around and still hacking around with weird Lisp-y ideas. Here’s all of my recent-ish videos from my YouTube, with more to...

Conversational software development
7 Jun 2020 | original ↗

If you’re a seasoned Lisp (or similar) programmer a lot of this will just be rewording of what you already know. If all you’ve ever known is editing source files and restarting your program this should hopefully be new and inspiring. Conversational software development is a term I’m half heartedly trying to coin to describe a way to develop your...

Neovim configuration and plugins in Fennel (Lisp)
30 Nov 2019 | original ↗

A lot of this has been made irrelevant or far easier in Aniseed v3.0.0+. There’s a bunch of macros and helper scripts that remove a lot of the boilerplate, check out the documentation! The sentiment of this post is still accurate, it’s just easier to implement now. In the beginning, there was Vim Script (also known as VimL). All Vim...

Getting started with Clojure, Neovim and Conjure in minutes
6 Nov 2019 | original ↗

14-06-2020: Updated the post to reflect the current state of Conjure. Conjure is my attempt at Clojure and ClojureScript tooling for Neovim. Here’s a quick demo of Conjure in action for those of you that haven’t seen it before. I’m going to help you get Clojure code evaluating in a matter of minutes, you’ll be able to try Conjure for yourself and...

Clojure prepl for tool authors
4 Nov 2019 | original ↗

I’ve written pretty extensively about how to start a prepl as well as what prepls are. I’ve also written a few tools such as Conjure and Propel that wouldn’t exist without it. Since fantastic tools such as shadow-cljs are beginning to implement their own prepls I thought it was about time I transcribed my understating of how the prepl should be...

Minimalistic blogging with Clojure and AsciiDoc
23 Oct 2019 | original ↗

I’ve procrastinated my way to yet another blogging stack and I’m very happy with it! I’m going to walk you through how it works and show you a few tricks of prepl based development I found along the way. If you like the idea of this approach feel free to fork Olical/blog. Previous worlds My poor blog has been through quite a few iterations, I...

REPLing into projects with prepl and Propel
14 Sept 2019 | original ↗

This post is intended for Clojure or ClojureScript developers who’re interested in trying prepl based tooling over traditional nREPL approaches. I hope to show you how to get started quickly with my own tool, Propel, then show you where to go once you outgrow it. You may be interested in my other post, Clojure socket prepl cookbook, which walks...

Exploring REPL tooling with socket prepl
16 Jul 2019 | original ↗

This post is mainly to help me plan my talk at London Clojurians on 16th July 2019 on the same topic. If you’re reading this, you’re probably a Clojure programmer to some degree, even if that’s just dipping your toes into the pool of immutability now and again. Chances are you’ve encountered some sort of command line tooling such as Leiningen or...

Extending Neovim with any language (mostly Clojure)
28 Jun 2019 | original ↗

This post is mainly to help me plan my talk at Vim London on 3rd July 2019 on the same topic. Come along if you can! You may have seen me constantly tweeting about Conjure (Neovim Clojure(Script) tooling over prepl) on twitter at @OliverCaldwell, what you may not know is that it’s my third re-write of the project already. I originally attempted...

Clojure socket prepl cookbook
22 Mar 2019 | original ↗

This post has been translated into Russian by Vlad at Softdroid. I’ve since released Propel which essentially does everything this blog post talks about but via an easy to use CLI or function. Feel free to have a read anyway! The socket prepl is a relatively new tool built into Clojure that allows you to REPL into a running application. It’s...

Wake word detection with Clojure (or Java)
12 Oct 2018 | original ↗

Hello there, intrepid Clojurian. If you don’t want to follow along with this post and just want to copy some code, go to Olical/clojure-wake-word-detection. Enjoy! If you follow me on twitter or GitHub you’ve probably seen me working on Snowball, a voice activated Discord bot written in Clojure. It works fairly well and allows my friends and I to...

Editing Clojure with Neovim
4 May 2018 | original ↗

I’ve used Spacemacs since I started working with Clojure a few years ago, it’s an extremely powerful system on par with full IDEs such as Cursive. I highly recommend either of these tools to the budding Clojure(Script) developer, they will carry you as far as you need to go and beyond. The reason I have drifted back to Vim (Neovim specifically)...

Clojure and ClojureScript tests on Travis
29 Mar 2018 | original ↗

As far as I can tell, there isn’t a canonical way to run your Clojure(Script) tests on Travis through the Clojure CLI. I think it’s slightly easier for those of you using lein, but here’s how to do it with clj. Dependencies You’ll need a couple of deps to execute your tests, here’s an example deps.edn: {:deps {org.clojure/clojure {:mvn/version...

Finding new dependencies with Depot
29 Mar 2018 | original ↗

If you’re using lein you can use lein-ancient to find newer versions of your dependencies, if you’re using boot you probably have something similar. With the Clojure CLI however you have to keep track of these things manually. I’ve created a little tool called Depot that aims to give you this same new version detection for your deps.edn file. The...

Clojure and ClojureScript testing with the Clojure CLI
9 Mar 2018 | original ↗

This post is sort of an extension of a previous post, Clojure projects from scratch. That will introduce you to structuring your project around a deps.edn file, here we’re going to simply add a couple of dependencies that allow you to run your tests. In a Leiningen project, lein test will execute your Clojure tests, no questions asked. In a...

Clojure and ClojureScript nREPL with Clojure CLI
4 Mar 2018 | original ↗

If you’ve decided to try out the new Clojure CLI introduced with Clojure 1.9 you may have found yourself slightly lost when it comes to getting your CIDER (or other development environment) hooked up to your project through nREPL. My previous post, Clojure projects from scratch, may help you with understanding these concepts and tools if you’re...

Clojure projects from scratch
26 Feb 2018 | original ↗

This post is intended primarily for two groups of people: People just starting out in Clojure, who know parts of the language but don’t know how to begin structuring a real project. Seasoned Clojurians who wish to see how to structure a project with the new Clojure CLI + deps.edn and not lein or boot (even though they’re still awesome). My goal...

Hello, World!
27 Oct 2017 | original ↗

This posts is out of date as of the end of 2019. I’ve rewritten it in Clojure and AsciiDoc and ported the super old WordPress posts into AsciiDoc. This content is mostly irrelevant now. I’ve, once again, migrated my blog onto another platform. This time I’ve gone from WordPress on my own Linode to Cryogen on GitHub pages. This means a few things:...

Taming clojure.spec with expound
18 Oct 2017 | original ↗

From Clojure 1.9 and up, the core language is guarded by various clojure.spec definitions. This means, even if you’re not using spec directly yourself, you will potentially encounter spec derived errors. These errors, much like all errors in Clojure, are extremely verbose and make it hard to discern what the actual problem is at a glance. These...

An introduction to transcriptor
6 Oct 2017 | original ↗

Transcriptor is a new Clojure tool released by Stuard Halloway (who literally writes books on Clojure) that approaches testing from a different angle. I only noticed it after he tweeted the following and I asked for him to elaborate. Luckily enough, he did! status: replacing gratuitous test framework goo with information-rich #clojure ex-info —...

Updating dependencies without CHANGES.md
5 Apr 2017 | original ↗

I recently received an issue on EventEmitter, my longest running project I have carried through my entire career so far, asking where the change log was. The bad news is that there isn’t one. Although I have a pretty thorough change log for my newer projects like react-faux-dom, I didn’t even understand semver back when I started it all those...

The Collatz conjecture, visualised in Clojure
4 Apr 2017 | original ↗

Before I begin, watch the video that prompted me to do this in the first place. Okay, now you know what I’m talking about, the Collatz conjecture. It’s scarily simple, you take a number, if it’s even you halve it, if it’s odd you multiply it by three and add one. Repeat this and you will end up at one, every time. Well, that’s the conjecture,...

I’m on Linode now
28 Mar 2017 | original ↗

And I’m pretty damn happy with it, as happy as you can be with a server I guess. Note: There’s a referral link at the bottom of this post. Some context I’ve been running my blog off of webfaction for a few years now, I actually used it before then whilst at a previous job too, if memory serves correctly (James? Did we?). It’s been working well...

When projects rise from the grave
15 Nov 2016 | original ↗

Halloween is supposed to be over, so why is my project coming back from the dead? Olical/Color is something I started in early 2011, I think I was still at my first job as a junior web developer tinkering with WordPress and custom PHP sites. I’m now on my 5th workplace doing something entirely different. I’m studying computer science and lisps in...

Getting Go Going
10 Oct 2016 | original ↗

I recently had to compile and run a go project, I found it thoroughly confusing initially and struggled to find a comprehensive guide on how to manage the repository in an idiomatic way. I’m going to show you how to get go projects up and running on your machine, I hope it’s the correct way, correct me if I’m wrong! Packages You’re going to want...

An introduction to ClojureScript
27 Feb 2016 | original ↗

In this post I’m going to attempt to explain where ClojureScript comes from as well as what it is and what it can do for you. I’m coming at this from the perspective of someone who writes a lot of JavaScript already, probably with React and Redux. Lisp ClojureScript is a very slight sub-set of Clojure, the main difference being one compiles to...

Working with multiple of lists in JavaScript
9 Feb 2016 | original ↗

If you’ve ever had to iterate over multiple lists at the same time or map a filtered map of a map, you’ll understand that nesting all of those blocks and callbacks isn’t very easy to work with or understand. Luckily, there’s some cool techniques that make turning several arrays (or infinite sequences created by generators, for example) into a...

Asynchronicity and JavaScript
24 Jan 2016 | original ↗

There are two very difficult things in UI development, well, there’s a lot more than that but here’s two very important aspects. Management of state Management of asynchronicity A lot has been done to make state less… evil? (see React, Redux, Cycle, Elm, Om, etc) The same can’t really be said for async operations, we kind of dumped some bare...

Installing Arch Linux on a Dell XPS 13 (9350)
6 Nov 2015 | original ↗

I’ve wanted a powerful yet light Linux laptop for a while now, something with a decent CPU and buckets of battery life. I finally found that in the Dell XPS 13. I originally tried to purchase one from Amazon, which failed for some reason (they never explained why they refunded and cancelled, no stock?) but then purchased it from Dell directly....

D3 within React the right way
9 Sept 2015 | original ↗

If you follow me on twitter (I’m @OliverCaldwell, if you don’t) you will have noticed that I’ve been tweeting about D3 and React a lot recently. More specifically, how to use both together in a pleasant yet efficient way. After a few weeks of thought and a couple of potential solutions actually being built and used, I settled on what I think is...

My new prompt (oh-my-zsh)
3 Aug 2015 | original ↗

I’ve rewritten this in fish shell functions since writing this, you can find that in a gist. I’ve been thinking about my terminal prompt recently, more specifically my oh-my-zsh theme and what I actually need it to show. I’ve been using the “clean” theme since I began using oh-my-zsh but I’ve realised I basically ignored the information it’s...

Wrangling JavaScript with Vim
17 Jun 2015 | original ↗

I’ve created a few posts on here about writing JavaScript with Vim, this is because it’s what I do all day (and night) long, I’ve refined my editor to make writing this slightly questionable language as easy as possible. I’ve now hit a point, once again, where I feel like I should share my tooling for everyone else to take advantage of. You can...

Lazy arrays in JavaScript
31 May 2015 | original ↗

So I built a thing called lazy-array. It came off the back of a tiny gist and grew into something quite powerful (if I do say so myself). This project allows you to define lazy arrays in JavaScript, surprisingly enough, but what are they? Lazy arrays A lazy array is a sort of collection that doesn’t actually do or contain anything until it’s...

Things I learned about Docker the hard way
7 May 2015 | original ↗

This list was just ripped from a Google Keep item I wrote late last night, just wanted to share. A process per container is noble but hard for existing projects. Use one container if you have multiple components with a startup order / dependency. Write a script to manage the processes. When you build a directory with a Dockerfile it will push the...

Some thoughts on Prolog
3 May 2015 | original ↗

I usually write some notes as I read and work then pad those notes out into a full post after I’m done with the chapter. This time I’m just going to publish it as is (pretty much). Initial thoughts Very concise. Beautiful, after you spend hours getting it working. Reminds me of my experience with Haskell (which isn’t much). Obviously not...

Some thoughts on Io
2 May 2015 | original ↗

I’m talking about the language not input/output. This whole Io != I/O thing made Googling around for documentation and examples a whole lot harder too. This was the second language from the book which, on the whole, was a pleasant experience. My source code for the exercises can be found in my languages repository. The book says it’s as close as...

Some thoughts on Ruby
13 Apr 2015 | original ↗

You may have noticed that I recently started working my way through Seven Languages in Seven Weeks (which will be shortly followed by Seven More Languages in Seven Weeks). I almost definitely won’t finish in that time frame with Coursera deadlines looming ever closer, but it’s worth a shot. I finished the first chapter this evening, which happens...

Making El-Get sync like vim-plug
3 Mar 2015 | original ↗

As my post from last night says, I’m giving Emacs another go. And in an even older post, when I was trying Emacs for the first time, I show my approach to getting my packages syncing like I do in Vim (spoiler alert: It didn’t work very well). My Vim setup will remove unused packages, update what I currently have and then install any that are...

Giving Emacs another chance
2 Mar 2015 | original ↗

I was originally going to call this post “Attempting Emacs 2: The Re-Emacsing – A Vimmers tale”, I thought better of it. As you may have noticed from my tweets over the recent weeks, I’m infatuated by Clojure among many other languages that aren’t the one I’m paid to write (JavaScript). I’ve been planning on working my way through the two “7...

A quick reflection on Algorithms
1 Mar 2015 | original ↗

It may not be completely over just yet, but I’ve gone as far as I can in Algorithms, Part I from Princeton on Coursera. It was an interesting course that ultimately defeated me in some areas, but taught me quite a lot along the way. I’ve given up on the very last part though since the difficulty has ramped up above what I want to burn my free...

Vim for people that don’t want to use it
1 Feb 2015 | original ↗

This is for those of you that use a GUI IDE / editor happily but sometimes use Vim because you have to in your terminal. (think commit messages, SSH and tiny tweaks to files) I agree, Vim is not perfect, although nothing is perfect in every situation. Most of my colleagues use IntelliJ or similar IDEs and editors, which is fine since they’re also...

If I wrote a text editor
15 Jan 2015 | original ↗

A little while ago Jezen Thomas linked a video to me on twitter (non-twitter link). It’s a talk by Gary Bernhardt of Destroy All Software. Please go watch it… now. The following post may contain spoilers that could ruin an otherwise excellent talk. So after that big tableflip inducing reveal, it got me thinking (just like thousands of others who...

Brainfuck VM in Clojure
12 Jan 2015 | original ↗

This is my second implementation for my repository of brainfuck interpretors, this time in the wonderful language Clojure (the first was JavaScript). It largely follows the same format of my initial machine but takes a route that I want to eventually refactor my JavaScript implementation to use as well. It builds a list of token hash-maps that...

Brainfuck VM in JavaScript
5 Jan 2015 | original ↗

Welcome to 2015, I hope you had a good break! Some people may now be taking on resolutions for the year, be that to lose weight or to socialise more. I’ve opted to learn even more than usual, so that means more coursera courses and toy projects in various languages. This is where my brainfuck virtual machines come in. I’ll be writing them in...

Revisiting: Searching JavaScript arrays with a binary search
17 Dec 2014 | original ↗

Last year I wrote a post called Searching JavaScript arrays with a binary search, it’s actually become quite popular and has seen a large amount of suggestions in the comments as well as helping out PowerArray. The problem is that it’s an untested, performance chasing, mess of a function. I’ve always wanted to redo this in a more formal manner...

A JavaScript / Clojure mashup
15 Dec 2014 | original ↗

I’m going to create a nightmare inducing monster and you’re going to enjoy it. Hear me out: Data as code in plain JavaScript without a pre-compilation step or new language to learn (even if Clojure is beautiful and takes all of 10 minutes to memorise the syntax). Of course we don’t have the distinction of vectors and lists, so arrays will have to...

My 2015 Bucket Set
13 Dec 2014 | original ↗

I’m not really one for New Year’s resolutions, but this year I thought I’d create a sort of bucket list of programming related things to learn. But it’s more of a bucket set because the items are unique, I really want to focus on algorithms and data structures as well as a plethora of functional programming languages. So without further ado,...

vim-expand, my second {plugin,bundle}!
10 Dec 2014 | original ↗

So I just pushed up my second ever Vim plugin, vim-expand. It allows you to expand things like \{foo,bar}, \{1..10} and $HOME inline with a single command. It’s not just limited to single lines though, you can also execute it on a visual range! Here’s a quick video of it in action. There’s way more information in the repository, so have a read...

I want to learn stuff and write about it over 2015
10 Dec 2014 | original ↗

I mean, I’ve been doing that on and (mostly) off for a while now, but I really want to focus on things like Khan Academy (which I’m currently using to learn more about algorithms). So hopefully you’ll see more frequent, yet short, posts on things I’ve recently stumbled across. I’ll try and write a few in batches and space them out evenly to make...

My thoughts on React, Flux and Reflux
6 Dec 2014 | original ↗

I could have used “My reaction to React, Flux and Reflux” in this title, but I thought it’d seem unprofessional, so I moved it down to the first point of this post. Because my blog is not an incredibly professional place. I spent a week of evenings and most of a weekend building an application much like a nested todo list with React and Reflux....

Essential Vim bundles for JavaScript and Clojure
21 Nov 2014 | original ↗

I mention using NeoBundle in this post, but I’ve since made the switch to vim-plug. Do it, it’s wonderful. My two primary languages that go through Vim right now are JavaScript and Clojure. Obviously there’s others such as HTML, CSS and the odd bit of Java, but these two stand out since they can have astounding tooling if you select carefully. So...

Emacs: There and Back Again
16 Nov 2014 | original ↗

So I’m back in Vim already. I gave Emacs a few months of good usage though and tried out multiple styles of configuration. At first I tried to build my own from the ground up, a la Vim, but it was too fiddly. I found Emacs to be too big to handle cleanly for one person, so I eventually resorted to Spacemacs. Spacemacs worked great and provided me...

Spacemacs: Emacs + Vim
6 Nov 2014 | original ↗

This post is pretty rough around the edges. I wrote it in Google keep as notes I intended to write up and eventually publish nicely but I don’t have the time. I’ve done what I can from my phone but I just wanted to get it out there. I hope you find it useful! What do you get if you put Vim, Emacs and a dash of pneumonic / consistent key bindings...

Understanding Emacs errors
5 Nov 2014 | original ↗

You can probably begin to get to the bottom of most internal Emacs problems with debug-on-entry. This function prompts for a function name interactively (which also hooks into helm) and will essentially set a breakpoint within Emacs on that function. When it is called you’ll get to see what functions were called and with what arguments. This came...

Angular feels like you’re always viewing a tiny piece of the puzzle
3 Nov 2014 | original ↗

You only see the directive, controller or template. Sometimes parts are in the same place and you can make sense of it. A lot of the time they are disparate and hard to comprehend. I’m wasting time trying to understand how value X gets from A to B, let alone what happens to it along the way or at the other end. Or even what X actually is! I don’t...

If you’re using sudo with npm you’re doing it wrong
29 Oct 2014 | original ↗

I see countless developers blindly firing off sudo npm install -g XYZ and it hurts. A lot. From then on, every time you update or execute global npm commands from within scripts or tools the whole thing will halt or die when it encounters permission related problems. One “solution” I’ve seen for this is to chmod /usr/local. You don’t own this...

Making package.el behave like Vundle
20 Oct 2014 | original ↗

I love Vundle, it allows me to specify a list of packages within my dotfiles repository that is kept up to date and in sync with every other machine I use Vim on. The key point with this is that I can remove a package from all machines by simply deleting the line from my configuration. " Load Vundle. Manages all of the bundles. filetype off set...

A week (or so) with Emacs
28 Sept 2014 | original ↗

So I managed to use Emacs for one whole week of full-time JavaScript work, whilst only falling back to Vim for the odd tweak of JSON or configuration, I count that as a success. It’s shifted my opinion of it since I set up my package management and JavaScript tooling, you can find all of this within my dotfiles. It’s become far easier since I...

Emacs: A few hours after exposure
17 Sept 2014 | original ↗

The symptoms are starting to show: fever, babbling, countless browser tabs and an insatiable urge to learn Lisp faster than it can be typed. After just one evening of playing with my configuration I have a system for me to define and load configuration files with ease as well as sync my plugin files from a list. I am considering have it run it’s...

Why a lover of Vim is going to try Emacs
16 Sept 2014 | original ↗

I’ve been using Vim for a couple of years now, despite that making up around half of my entire career, I feel like I’ve learnt it rather well. I can’t hack VimL like tpope, all hail, but I can flit around a large project and edit almost without thinking. The editor becomes a language seared into your muscle memory. It’s so good I couldn’t...

Building vim-netrw-signs: Into the VimL
3 Sept 2014 | original ↗

In this post I’m going to aim for an MVP that may not be the most usable but can serve as a proof of concept. This version will only run when you call a command and have minimal configuration. Polishing of the plugin will come after in the form of help pages, configuration and automatic execution. The very first step involves creating the main...

Building vim-netrw-signs: Tooling
1 Sept 2014 | original ↗

In my last post I focused on getting the repository and main files up and running, here I’ll briefly touch on the satellite tooling I’m going to hook into to make the development a bit easier. Oh, also, I’m writing this from a cruise ship somewhere around Gibraltar. Travis So I created my .travis.yml file last time which gives me all the...

Building vim-netrw-signs: Introduction
11 Aug 2014 | original ↗

I thought of another Vim plugin idea a while back at Vim London, which happens to be my second of such ideas, the first being vim-enmasse. My plan is to build this plugin over the coming weeks (probably months, ideally not years) and take you along for the ride with these brief posts. From git init to git tag v1.0.0. To begin with, here’s the...

Hello again, WordPress
6 Aug 2014 | original ↗

Once again I’m reworking my personal website and blog. This time I’m aiming to journal my progress through projects that I work on in my free time (such as Vim plugins) as well as the odd rant or tutorial post, as I have written in the past. I felt that trying to force myself to write large posts about huge topics and problems on a regular basis...

Installing Vimdeck on Arch
26 Apr 2014 | original ↗

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

Always remain a beginner
18 Mar 2014 | original ↗

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

Test private methods
13 Dec 2013 | original ↗

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

Graph from scratch
5 Dec 2013 | original ↗

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

Grabbing elements from the DOM
25 Sept 2013 | original ↗

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

Do things that scare you
24 Sept 2013 | original ↗

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

Classless JavaScript – Continued
22 Sept 2013 | original ↗

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

Classless JavaScript
17 Sept 2013 | original ↗

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

Handling concurrency and asynchronous JavaScript
11 Sept 2013 | original ↗

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

Building for browsers in a terminal
8 Aug 2013 | original ↗

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. A quick overview I make use of tmux for multitasking, Vim for any editing with my extensive...

Composing a framework from specialised libraries
28 Jul 2013 | original ↗

Whenever I dive into a frontend MVC project of my own I always end up getting frustrated at the framework selection stage. I quite like aspects of Backbone et al, but none of them feel like that exact thing I’m looking for. This leaves me with three choices; put up with the little things that annoy me about a given framework, write my own or...

Exporting through AMD, CommonJS and the global object
21 Jul 2013 | original ↗

No matter how amazing your script is, you will need to expose it to the wider world at some point. By that I don’t mean publication through NPM or any other package managers, I mean you need to actually expose your classes and functions to the code that needs to consume them. You may be using AMD, CommonJS or the global object to do this, but are...

Use verbose naming in JavaScript
17 Jul 2013 | original ↗

I love verbose names in JavaScript, or any language for that matter. Sadly I see a lot of people yearning for short and obscure method names for no real reason. I can only imagine it’s because the API documentation looks cool in their opinion with no method name being longer than five characters. I hope to show a few people the errors of their...

Tuples in JavaScript
12 Jul 2013 | original ↗

As my last post mentioned, I recently read Functional JavaScript and can’t physically recommend it enough. This book has caused me to make the mental leap between real world applications and functional programming due to the fact that it’s written in a language I live and breath. After reading this I was inspired to pick up Haskell from where I...

Ranges, summation and predicates
2 Jul 2013 | original ↗

I’ve been reading a book called Functional JavaScript by Michael Fogus which, surprisingly, is all about applying functional programming to JavaScript. The majority of the book depends upon Underscore to make JavaScript have a more functional feel, but on the whole it’s fairly vanilla. I have since started trying to apply functional concepts to...

Equipping Vim for JavaScript
29 Jun 2013 | original ↗

I’ve written yet another post on this, I’d recommend reading Wrangling JavaScript with Vim instead. Feel free to peruse this post too, it’s just quite a bit older! On a related note, here’s a newer post listing some of my favourite JavaScript and Clojure plugins. I absolutely love Vim. I use it for all of my writing, be that code or blog posts,...

Maps in JavaScript
12 Jun 2013 | original ↗

No, I don’t mean the things that help you find obscure places, I mean the things you can store data within. Your average JavaScript object that makes up just about everything in the language is actually a map, it just restricts you to mapping string keys to values of any kind. Wouldn’t it be great if you could map anything to anything though?...

Searching JavaScript arrays with a binary search
8 Jun 2013 | original ↗

I migrated from Octopress back to WordPress and all of my code snippets exploded, I’m in the process of fixing those, please bear with me. This post also has huge improvements detailed in the comments section that makes me think this post warrants a revisit, I’ll link to it from here if so. I’ve written a new post! This one includes benchmarks...

Implementing a message bus in JavaScript
5 Jun 2013 | original ↗

For starters, what on Earth is a message bus? It’s not a device used for bulk transportation of postmen… yet. I see message buses as the predecessors to the event managers you see so commonly in today’s modern JavaScript. The only problem with event emitters and the like is that you require a library built to handle it which incurs an overhead on...

Prototypical inheritance done right
1 Jun 2013 | original ↗

I’ve read a lot of posts in the past on this subject; this includes some by massively influential developers such as John Resig. I don’t think the popular methods are the right way though. They all feel synthetic and unnatural. Not nearly vanilla enough for me. Plain ol’ JavaScript is perfectly capable of handling all of your inheritance needs...

Faster JavaScript
1 Sept 2012 | original ↗

I have been working on my EventEmitter class for about a year so far. I have rewritten it roughly every three months to put all of the techniques I have learned into practice. Now I have finished version 4 and it is the fastest yet by a long way. This jsPerf test between version 3 and 4 proves my point nicely. In this post I will point out the...

Localizing times with xtz
21 May 2012 | original ↗

I have just uploaded the first version of xtz. xtz, shorthand for cross timezone, is a script that converts times on your page to the users local time. So you could replace something like “27 January, 2000 10:00:00 CST” with “27th January, 2000 at 4:00pm” if the user is in the UK. If the user is in the CST timezone then you would have something...

Fun with negative margins
18 May 2012 | original ↗

Ever wanted to overlay elements? You can create great effects and produce a really engaging site by simply making `div`s overlap slightly. But sometimes making elements lay on top of each other is harder than you would think. One of the biggest problems people have when overlaying elements on top of each other seems to be z-index issues. Luckily...

Writing a modular frontend
31 Mar 2012 | original ↗

It may be a bold statement, but I believe that modularity is the way forward. By that I mean writing modular code will coax us into writing reusable and higher quality classes and functions. This feeling is present when writing backend or frontend code, the problem is that modularity in the frontend can feel a little alien at first. The thing...

Portable JavaScript
24 Mar 2012 | original ↗

I gave in to AMD. I am currently using RequireJS on a project which uses quite a few different scripts including MooTools, Kalendae (which is amazing by the way) and the Facebook SDK. By using AMD I have separated the whole project into manageable modules which are loaded in parallel with each other. I am loading MooTools and the Facebook SDK...

Writing great JavaScript
14 Mar 2012 | original ↗

I probably could have named this post something like “Writing clean, validating and portable JavaScript”, but that would be no where near as catchy. The problem with “great” is it means different things to different people. I am going to show you my idea of great which may differ from many developers views, but I hope it helps someone improve...

Thoughts on JavaScript libraries and frameworks
9 Mar 2012 | original ↗

There seems to be a lot of uncertainty about how we should use JavaScript libraries recently. The main debate is whether we should still use huge 100kb frameworks, such as MooTools and jQuery, or swap to tiny micro libraries that each perform a specific task, thus resulting in a smaller page size and load time. I personally do not get on too well...

Pure CSS toggle accordion
3 Mar 2012 | original ↗

CSS is brilliant. When written properly you can do so much with it. I believe that you should always try to build crucial UI elements with CSS rather than JavaScript. It always feels slightly more responsive, and now with transitions you can make things look amazing with just one line. So I thought I would try my hand at creating an accordion. We...

Sliced text effect
27 Feb 2012 | original ↗

I am a huge fan of Terry Pratchett’s discworld books. At one point in the series Death, with his scythe so sharp it can cut sound, manages to slice words on the page into separate letters. The resulting effect on the page looked strange but brilliant. I thought I would try and recreate that effect. And here is what I came up with. I am afraid the...

Getting started with LESS
25 Feb 2012 | original ↗

Taking your first step in any language can be a daunting task. And starting with LESS is no different. The main difficulty with LESS is getting your development environment set up to work with it correctly. In this post I am going to try and guide you through getting up and running with this brilliant CSS preprocessor. Prerequisites Before you...

Color in JavaScript
22 Feb 2012 | original ↗

Quite a while ago I wrote some JavaScript to help with manipulating colors. I wrote it before I perfected the way I wrote classes and JavaScript in general. That means that it is pretty shabby in comparison to what I can do now. Here is Color in it’s old form. I say old because I am going to rewrite it. This time using classes, making it run in a...

Inheritance in CSS
18 Feb 2012 | original ↗

When creating styles for elements such as buttons or text boxes in CSS there are always variations. These variations include things like icons and colors. Copying a chunk of CSS and editing the attributes isn’t ideal, so what can you use instead? Inheritance, that’s what. So, what is it, and how does it work. Well the concept is fairly simple,...

Multiple borders with CSS
15 Feb 2012 | original ↗

Any time that I spot an element with multiple borders in a design that I am coding, I instantly turn to Google. Sadly, it never yields the results I seek. I am always hopeful that in the last month every browser has implemented something like this. div.multi-border { width: 100px; height: 100px; background-color: rgba(0, 0, 0,...

Centering with the flexible box model
12 Feb 2012 | original ↗

For those of you that have not heard of the flexible box model, brace yourselves. When it is more widely supported you will no longer need to silently (or audibly) scream to yourself when vertically centering a variable height block level element. But it does more than just center any way you want. It also allows you to center multiple elements...

Introduction
11 Feb 2012 | original ↗

Well, here we go. I have been working on this new blog on and off for about a week now. I thought I would start off with a post about some of the technology behind it. Jekyll The first thing you will notice from checking out the source will be that it is powered by Jekyll. It is a blog aware static site generator that allows me to create...

↑ these items are from RSS. Visit the blog itself at https://oli.me.uk/ to find other articles and to appreciate the author's digital home.