Linting code with Neomake and Neovim

Related:


I’ve been using Neovim for a while now and absolutely love it. One of the major advantages it has over regular vim is its asynchronous job processing functionality.

While not a lot of plugins leverage async job-control yet, the few that do offer significant performance increases compared to synchronous alternatives. One such plugin is Neomake, which is heavily inspired by the wildly popular Syntastic. By the way, Neomake also works in regular vim, but then it won’t be async.

Example of Neomake linting JavaScript code with JSCS

Setting it up isn’t hard, but I have to admit I spent an hour or two to sort of get it right. The reason is that I was so used to Syntastic’s setup that I didn’t realize what exactly was happening behind the scenes. So I had to do some reading and experimenting to figure out how to use it right. Information about this is scarce on the web right now, so if you’re in a similar jam or just want to know more about Neomake and what it can do for you, read on.

Read More

How to set up Mailgun on Digital Ocean

also: Forwarding mail to your Gmail account with Mailgun

Mailgun is an awesome e-mail service that makes it super easy for developers to automate e-mail sending. I’m not going to spend much time singing its praises here. Just check it out for yourself. Suffice it to say that if you’ve ever thought about programmatically sending, receiving or tracking e-mail, using just about any programming language under the sun, you really should consider using Mailgun.

I’m currently using it for a number of things, such as having my little $5/month Digital Ocean server (which is also running this website by the way) mailing me sysadmin-related notifications, error logs, updates on some websites I’m regularly scraping and other niceness.

Mailgun logo

So yeah, I love Mailgun. But I have to say, it was a bit of a chore to set it up on my server. The official guidelines didn’t quite work, and none of the help or blog posts I found online about this seemed up to date. After some experimentation, I got it to work though. Turns out you just have to tweak the settings a little bit to make it work with Digital Ocean.

In case anyone is finding themselves in the same situation I did: don’t despair! Here is how to set it up:

Read More

Normal ternaries vs nested ternaries

This pretty much sums up my opinion about ternaries:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var Ternary = function(isNested) {
return {
is: function() {
return (isNested) ? 'the devil' : 'awesome';
}
};
};
// something like `size = (a < 10) ? 'small' : 'large'`
var aNormalTernary = new Ternary(false);
// think `size = (a < 10) ? (a < 5) ? (a < 0) ? 'negative'
// : 'tiny' : 'small' : 'large'`
var aNestedTernary = new Ternary(true);
aNormalTernary.is(); // awesome
aNestedTernary.is(); // the devil

Fixing the reappearing folders problem in your home directory

When I saw someone on Reddit asking about a series of folders constantly reappearing in their home directory, I replied with a quick link to the relevant Arch wiki article.

Judging from the amount of upvotes that got, and from my own struggles with this annoying problem a few months back, I guess this has quite a few people dumbfounded. So allow me to explain in some more detail what exactly the problem is, and how to fix it.

My fixed home dir

Read More

ES6 React UltiSnips snippets for vim

If you’re a React person and you use vim to edit files, and you use the UltiSnips plugin for inserting snippets, and you’re also using ES6 syntax to make those sweet, sweet React components you’ve got there, then you’re in luck because I just pushed some snippets to GitHub just for you!

The Readme links to the people originally responsible for the other snippets. I just enabled them for UltiSnips users too and updated them to the new ES6 syntax as recommended in the React docs.