Friends don't let friends `sudo npm install -g` packages

A friend of mine was installing his first npm package the other day (in case you’re wondering, the package in question was vtop). But while everything went fine and my buddy is enjoying his node-powered monitoring now, I was a little disheartened to learn that, as per the readme, he had sudo npm install -g‘d this global package.

super user

Call me crazy, but I just don’t like the idea of needing sudo to install global npm packages. The good news though is that you don’t really need it. Let me show you how.

Read More

Neovim, Deoplete, JSPC, UltiSnips and Tern: A config for kickass autocompletion

First of all, sorry for the delay, I promised to write this earlier but life got in the way.. Hopefully I’ll be writing more regularly again now though :-)

Tern autocomplete example

Anyway, earlier this year I wrote a series of Neovim articles on how to set up some of the more popular plugins. The one I did on Deoplete - Shougo‘s asynchronous keyword completion plugin - is still one of the most often-visited articles on this blog.

I had recently been made aware though that maybe my original article was a little simplistic as some people were still experiencing problems setting Deoplete up and make it play nice with multiple completion plugins. As I still believe in Deoplete as a fantastic productivity-booster, I decided to write an update and hopefully help some people make their kickass Neovim setup just that little more kickass!

In this case, I will be setting up Neovim so the Deoplete autocompletion engine pops up automagically and pulls in from a few different sources: words from the file itself, UltiSnips snippets, JSPC parameter completion and the Tern code-analysis engine for JavaScript. If you want to use different autocompletion plugins or a different language, then that’s fine, you can still use this guide, just change the plugins, sources and omnifuncs and check your plugin’s readme if you need extra help.

Let’s get started!

Read More

How to get a shiny coverage badge for your GitHub project

I know the internet’s great at all, but you know what’s not great? An internet connection that doesn’t work and keeps kicking you off every five seconds! That’s basically what my life has been like the past week and a half, so you can imagine how frustrated I’ve been.

Coverage Status

Time to let off some steam then by writing up this simple tutorial on how to give your (Node) project a nice coverage badge.

Read More

Relative wdn warp points and clg new command

Right, here’s another quick update for those blessed few among you who are, for some reason or another, interested in my quest to use Node.js to make the command line as convenient as it can be for bloggers and content creators.

wdn v3.2.0: relative warp points & tests

For my warp directory package, I’ve just added a relative paths feature, allowing you to jump to paths relative to a warp point. What does that mean? Here’s an example:

[~]$ wdn ls
  warp1  =>  /home/user/my/project
  warp2  =>  /home/user/another/project
[~]$ wdn warp1
[~/my/project]$ wdn warp2/relative/path
[~/another/project/relative/path]$

Simple, right? You can use Windows-style backslash separators too, but you’ll have to double them up (as in wdn warp2\\relative\\path). I guess I could address this, but since exactly zero people are using this package on Windows, I’m not going to bother right now and will use my time to do other things – unless someone reports an issue, in which case I’ll get right to it!

clg v0.2.0: the new command

As for my clg package for bloggers and maintainers of statically generated websites, I just added the new command. This means you can now use it not just for editing existing content, but for conveniently making new content as well.

So no more navigating to the right directory (cd ../../../source/_posts, amirite ppl?) and dropping a markdown file there with some bootstrapped yaml info. Just write a little .clg.json config file to set up your directories and you’re good to go. As an example, this is the .clg.json I’m using on this very Hexo blog:

./.clg.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"sourceDirs": "source/_posts",
"newDirs": {
"post": {
"dir": "source/_posts",
"metadata": {
"category": "javascript",
"tags": ""
},
"assetDir": true
},
"draft": "source/_drafts"
}
}

With this in the root dir of my blog, I can go anywhere within it and do clg new post to automatically drop a new markdown file with some title, date (defaults), category and tags metadata in the ./source/_posts folder and open said markdown file in my $EDITOR. It will also automatically create an asset folder for images. Likewise, clg new draft will drop a simple markdown draft in the ./source/_drafts folder. Once written and saved, you can edit your content using clg edit. Check the readme on GitHub for more info.

I’ve also been doing some of the more boring but necessary work on both projects – adding tests, comments etc. At some point I’ll feel the projects will have matured enough to share them with the world, but for now, if you’re reading this, you’re one of the less than 20 people using it ;-) No matter, I’m really just building it for myself anyway.

Anyway, hope everyone is doing well. I promise I’ll write some more (neo)vim and javascript tutorials soon (since those articles are by far the most popular on this blog), but I’ve been busy doing these projects and building a business site for a buddy and it might take just a little while longer. But hey, good things come to those who wait so bear with me.