Setting up coc.nvim for Ruby development

Conquer of Completion

If you don’t already know what coc.nvim is, I recommend you take a look at the project README and Wiki. To give you an idea:

To complete this guide you need:

  1. Vim or Neovim
  2. Reasonably up-to-date versions of Node and Ruby
    • I’m using Node 12.x and Ruby 2.6.x. You’ll need gem and npm available

Installing coc.nvim

To get started, install the package via your package manager. I use vim-plug personally:

Plug 'neoclide/coc.nvim', {'branch': 'release'}

If you use another, check out these installation examples

Now you’re all set to :PlugInstall. You can confirm it’s all working by using :CocInfo, which should open a split with some information like this:

coc.nvim service information

If you’ve gotten this far, good job! coc.nvim is now installed.

By default, you won’t notice much different. Here’s a mapping that’ll get the completion popup working:

inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'

There are several other mappings you might find useful. See :help coc-interface

Now open up some code. When you start typing you should notice the completion menu:

autocompletion in action

If that’s working, it’s time to move on.

Ruby Support

First thing you’ll want to do is gem install solargraph. Solargraph provides IDE tools for developing with Ruby. Specifically, it provides a Language Server implementation that coc.nvim can consume.

Once you’ve installed it, run solargraph config. This will generate a .solargraph.yml configuration for you to adjust to your project

Tip: Open the config and adjust your include and excludes. Solargraph is a great tool, but can take a minute to start providing information. Check out this comment from the author about load times. It can take up to ~20 seconds to load up ShareGrid.

Now edit your vim config and add this variable:

let g:coc_global_extensions = ['coc-solargraph']

From the documentation:

Global extension names to install when they aren’t installed, define this variable to a list of extension names when you can’t use |coc#add_extension()|

Save and re-open vim. You should notice a terminal buffer open up–don’t worry, it’s coc.nvim installing the coc-solargraph extension!

Once installed, you should be able to jump right into some ruby, open up a test.rb, think of a class you’re familiar with in your codebase, and try something out:

example of smart auto-completion of a service

As you can see above, Solargraph is providing accurate information about what methods the class responds to.

Now that you’ve gotten your feet wet, go back to coc-interfaces and add some mappings for jumping to references, implementations, and more.

Final Notes

This really only scratches the surface for coc.nvim as a plugin.

You should know that your experience will not always be the same. Not all language servers implement the whole spec, and some of them don’t follow the rules either. Some will give you diagnostics as you work, some might only give them to you after you save. You’ll figure out what they can do as you go.

I highly recommend adding the coc-json extension. coc.nvim uses its own configuration in your vim directory called coc-settings.json, you can use :CocConfig to open it up for the first time.

The extension will give you much more information about the settings that are available. You can toy around with it. Try typing out “codelens”.

For your configuration, I recommend doing this right away:

  "codeLens.enable": true,
  "solargraph.useBundler": true

The solargraph setting will tell coc.nvim to use bundler to run solargraph. This is specifically useful if you add it as a dependency to a Gemfile in your project.

Good luck, have fun!

Seattle, WA

After a lot of thought I’ve decided that it is time for a change of scenery and humidity. I’m moving to Seattle.

When I was very young I lived with my father and his family in Seattle very briefly, but not long enough to remember anything but the highlights. I’m looking forward to creating some lasting memories there this time around.

Soon I’ll be joining the ShareGrid team, and honestly I’m very excited. It’s going to be a different experience, and I think it’s the next step in my career.

I’ve learned a lot while I’ve been here, and I’ve learned a lot about myself. The time I’ve spent here in Orlando sometimes felt like 0 to 60 life lessons and experiences that I’ll definitely be keeping with me for a long time.

Also, mountains. Oh man I love mountains.

Goodbye, Florida.

Starting with IZEA

Today I start my first day at IZEA here in Orlando. I’m nervous, but I’m ready for the work.

Here’s to good times.

OSCON Amsterdam and GitLab Summit 2015

Last week I flew internationally for the first time to join GitLab for their summit and OSCON in Amsterdam.

The first day I got to meet a lot of the GitLab team, and core team. We went on a walking tour of the city, and it was awesome.

I really love historic things, and seeing these old buildings and hearing a little of the history behind Amsterdam really blew my mind. All that with the fact that some of the sights are just plain beautiful.

Going through the city we got a great look at the canals that some people might know Amsterdam for.

We also went through the red light district, where this is smack right in the middle.

I really should have gotten more pictures while I was in Amsterdam, and I’m a little disappointed I didn’t get more. Was very distracted with looking at everything there was to see. The old houses lined up. The quirky sizes to avoid taxes. The palace and other churches. There was just so much to see.

The central area is all really nice and clean, and the people are pretty great as long as they aren’t on a bike. If you visit, the cyclists are out to kill you. Don’t let anyone else tell you different.

The next couple of days most of us attended OSCON. I spent those two days getting to know a few members of the core team (mostly) not employed by GitLab.

Compared to OSCON Portland this year, this event didn’t feel even half as big, but the conference itself wasn’t bad. I enjoyed a few of the talks, and mostly enjoyed just socializing with the rest of the crew.

It’s cool to have seen the growth of GitLab in person. With around 40+ people present, they’ve put a pretty nice team together. Stan said it best:

“the GitLab Summit felt like a mini-United Nations conference: 40+ representatives from all around the world, united in purpose.”

I ended the week having the opportunity to meet my friend Martijn and have lunch with him in Vondelpark, which was described to me as Amsterdam’s “Central Park”.

I hope to see them all again in the future, and I definitely hope to be doing more international travel in the near future.

Joining GitLab Core

A couple of days ago I was offered the opportunity to join the GitLab Core Team as a volunteer, which consists of some of the employees who develop GitLab and volunteers.

Since 2012 I’ve been an avid GitLab user, and for a couple of years and some, I’ve been supporting users in GitLab IRC channel on freenode, #gitlab.

Really the cool thing about this is I’ve had the opportunity to contribute, even if it’s small.

In 2012 I was also learning rails, and moving away from mercurial to git. I wanted to find something better than gitweb, and had been using hgweb up until this point. Sometime into this hunt a friend ran into GitLab and I was instantly in love. While I used GitHub for anything I would consider open source, I wanted to host my private repositories myself and this interface blew away anything available (around version 2.x).

Even greater to me, GitLab was a rails application. Since I was learning rails at the time it turned out to be a great codebase to learn from. I knew a little bit then, but after a lot of time debugging my own install issues, and helping others I started to familiarize myself with the codebase and would often reference the code to get a better understanding of structure and design patterns when working on my own applications.

It’s been a few years now. GitLab has since grown into a YC backed company, with a great staff and large list of contributors with an amazing product.

There’s a little irony being as much as I’ve been helping GitLab users I’ve hardly contributed any code, so I hope to make a little more time to open a few merge requests in the future knocking out some issues.

All this said, I’m super happy to be able to interface with the rest of the core team.

Being synchronous with gulp

Working on a project at work today I ran into an issue with gulp where I need to run a build task that ran a group of other tasks in a very specific order.

The first problem I ran into is that gulp really doesn’t support this “easily”. You can’t really say “this command is a synchronous task don’t run it in parallel with other commands”. Fortunately one of our designers Drew keeps a pretty rad collection of reusable gulp tasks on GitHub that exposed me to run-sequence.

The syntax is simple and straight forward:

// ...
var run = require('run-sequence');
// ...

gulp.task('build', function() {
  run(['css', 'js', 'condense']);

Enter second problem. js is using gulp-shell and for some reason, staying asynchronous. This is causing condense to run and finish before js has had the opportunity to finish. I still haven’t quite figured out the problem, but I did find a temporary solution.

Something gulp does support is setting a task that needs to be run before the task being called runs:

gulp.task('condense', ['js'], function() {
  // ...

This will make gulp run js first, then it will run itself.

The problem I’ve had is probably a weird problem I can fix with a little refactoring, but learning the sequencing methods was fairly helpful.

First time on Ruby5

On August 12th I got to co-host Ruby5 with Carlos Souza.

I recently volunteered to join the group of people involved with a few podcasts that CodeSchool and Envy run; like 5.js, and iOS Bytes.

A couple of things I’d really like to work on is speaking and writing, and this has been a great opportunity to get involved and work on these things.

Looking forward to more!

Learning C by comparison #3: Using includes and multiple files

This is the third part of my Learning code by comparison series of learning C with explanations in Ruby.

It’s always normal when writing a library, application, or other things in Ruby to use multiple files. It’s common to do this with C too, but since we compile it’s not as simple as our typical require.

To start off our Ruby example we’ll create a Person module with common methods we’ll want to include in our James class. This would allow us to give James extra methods that are unique to that class.

module Person
  def full_name
    "#{@first_name} #{@last_name}"

We’ll save this to person.rb. Now we’ll create james.rb and make use of Person.

require './person'

class James
  include Person

  def initialize(first_name, last_name, age)
    @first_name = first_name
    @last_name  = last_name
    @age        = age

  def old_enough_to_drink?
    @age > 18

james ='James', 'Newton', 21)
james.full_name            #=> "James Newton"
james.old_enough_to_drink? #=> true

One of the important lines to notice here is the require where we’re including Person from person.rb.

So, all in all; super easy. Now we move into C.

In C there is no way to just “include” another C file. Since C is compiled, we supply the extra C files to our compiler. But that itself isn’t enough. We have to make use of “header” files to fill in some gaps.

In C we’ll start with a very basic james.c:

int main(int argc, const char *argv[])
    return 0;

Now, we’ll create a person.h. This header file will define our struct’s and functions.

#include <stdio.h>

#ifndef __PERSON_H__
#define __PERSON_H__

typedef struct {
    char *first_name;
    char *last_name;
    int  age;
} person_t;


In this we’re wrapping everything in a ifndef which is a “if not defined”. This ensures that things are not redeclared when it’s included in multiple places. The second line is defining __PERSON_H__ if the ifndef is false. Alternatively there is a ifdef.

You’ll also notice we’re including stdio.h. We’re including this so we can make use of printf.

Now we’ll create a person.c which will define a function to print out our persons information:

#include "person.h"

void person_print(person_t person)
    printf("Name: %s %s\n", person.first_name, person.last_name);
    printf("Age:  %i\n", person.age);

Here we’re including person.h so we can make use of the definition of person_t, and printf.

Now we’re going to want to make use of person_print inside of james.c, but we cannot include a C file. This is where how we compile starts to become important, which we’ll touch on soon.

But first we need to add to james.c to actually make the program do something:

#include "person.h"

int main(int argc, const char *argv[])
    person_t james = {"James", "Newton", 21};


    return 0;

Now we need to do one more thing, and that is declare the person_print method inside of person.h:

// ...

extern void person_print(person_t person);

// ...

The reason we do this is because james.c does not know our function exists. By adding a prototype declaration we’re letting james.c know that the function exists, just not what it does yet. This’ll also allow us to use person_print in more files if we wanted to, rather then having to redefine it multiple times.

Now, to compile our program.

Usually in my compile examples I just do gcc file.c, but now that we’re using multiple files we’ll get a little more detailed.

We’ll use the following command to compile:

$ gcc -o james james.c person.c -I .

In this command -o james tells our compiler that the program will be compiled to the executable james. The next two params, james.c person.c tell the compiler the files to compile, and -I . tells the compiler the “include search path” (or, where to find our person.h). Since everything is in the same directory for my example -I isn’t needed, but there for the sake of example.

After compiling there will be an executable file named james. Compiling and running will yield these results:

$ gcc -o james james.c person.c -I .
$ ./james
Name: James Newton
Age:  21

Full code samples.

Using call in Ruby classes

Recently looking at the source for jbuilder I noticed the curious syntax:

json.(var, :sym1, :sym2)

Later I discovered that it’s some syntastic sugar for call. You may be familiar with this method from using a Proc or lambda, or even passing blocks around like so:

proc { 'Hello, world!' }.call #=> "Hello, world!"
-> { 'Hello, world!' }.call   #=> "Hello, world!"

def some_method(&block)
  @block = block

some_method do
  'Hello, world!'
end #=> "Hello, world!"

So we know that all of these are forms of Proc in action. It turns out you can do more with call outside of the realm of Proc.

jbuilder just happens to use call as a short form of it’s extract! method, allowing you to pass an object to it listing attributes (or methods) to “extract” for display. I’ll demonstrate:

class Person
  attr_accessor :name, :age, :sex

  def initialize(name, age, sex) = name
    self.age  = age  = sex

  def call(*attributes) do |attribute|

person ='James', 21, 'male')
person.(:name, :sex) #=> ["James", "male"]

In this example I used the alternative syntax for call, rather than

So what is this good for? A good example of a project that has heavy use of call in classes is Rack. You’ll find in a lot of it’s classes that it uses call as kind of a central API.

Shout out to my friend Jeremy for telling me a little more about this stuff when I first ran into it.

Learning C by comparison #2: Arrays, and more on structs

This is the second part of my Learning code by comparison series of learning C with explanations in Ruby.

This time around I’m going to answer some simple questions I’ve had for myself while learning basic C. The first thing is how I could call a struct from another:

In Ruby I can do this:

class Person
  attr_accessor :name, :age, :colors

  def initialize(name, age, eye_color, hair_color)   = name
    self.age    = age
    self.colors =, hair_color)

class Colors
  attr_accessor :eyes, :hair

  def initialize(eye_color, hair_color)
    self.eyes = eye_color = hair_color

person ='James Newton', 21, 'brown', 'brown')        #=> "James Newton" #=> "brown"

Since we don’t have fancy classes in C as I touched on in the last post, we use struct to define our “objects” in C:

#include <stdio.h>

typedef struct {
    char *eyes;
    char *hair;
} Colors;

typedef struct {
    char   *name;
    char   *age;
    Colors colors;
} Person;

int main(int argc, const char *argv[])
    Person person = {"James Newton", 21, {"brown", "brown"}};

    printf("Name: %s, Age: %i, Eye color: %s, Hair color: %s\n",, person.age, person.colors.eyes,;

    return 0;

And after a quick compile and run we’ll see:

$ gcc test.c
$ ./a.out
Name: James Newton, Age: 21, Eye color: brown, Hair color: brown

Now, how to work with arrays!

Ruby is easy, array = ['one', 'two', 'three'] gives us an array of three strings we could access with array[i]. With C we get a little complicated depending on what information we’re throwing in our array.

#include <stdio.h>

int main(int argc, const char *argv[])
    char *people[3] = {"James Newton", "Robert Babcock", "Zach Smith"};

    for (int i = 0; i < sizeof(people) / sizeof(people[0]); i++) {
      printf("Name: %s\n", people[i]);

    return 0;

We can also define people[3] one by one like:

char *people[3];

people[0] = "James Newton";
people[1] = "Robert Babcock";
people[2] = "Zach Smith";

Since we’re doing a loop here to print out all the names in people we’re using sizeof to get the size of people in bytes, then dividing it by the size of an item in the array (people[0]). Without this the loop would continue to run past the 3 items because the array is greater than 3 bytes, and segfault. Ruby handles this for us when looping through arrays.

Compiling and running would get us:

$ gcc test2.c
$ ./a.out
Name: James Newton
Name: Robert Babcock
Name: Zach Smith

So now that we have an idea of how to use struct, why not try to make an array of “objects”?

Adding on to our Ruby script from earlier, we could do this quickly:

people = []
people <<'James Newton', 21, 'brown', 'brown')
# add more people, like Robert and Zach. #=> "James Newton"

Now we’ll make use of the code from both of our previous C programs to make an array called people that contain several Person struct’s.

#include <stdio.h>

typedef struct {
    char   *name;
    int    age;
} Person;

int main(int argc, const char *argv[])
    Person people[2] = {{"James Newton", 21}, {"Robert Babcock", 22}};

    for (int i = 0; i < sizeof(people) / sizeof(Person); i++) {
      printf("Name: %s, Age: %i\n", people[i].name, people[i].age);

    return 0;

And when we compile we get the following output:

$ gcc test3.c
$ ./a.out
Name: James Newton, Age: 21
Name: Robert Babcock, Age: 22

And we’ll stop here. So with this we’ve got some very simple samples on how to use a struct inside of another struct, and arrays.

Full code samples.


Yesterday was my first day living in Orlando, FL. I’ve moved here to join the team at Code School Monday. I have to start wearing pants to work.

I’d like to say thanks to Chargify. It’s been a great ride and I’ll miss everyone on the team. I learned a lot working with you all.

This move is also a big point in my life. I’ve lived in Panama City Beach, FL for almost all of it. It is where my family is, and everything I’ve really ever known.

I hope that our small tech scene continues to grow. It was fun doing our OpenHacks every Tuesday. I will definitely try to help from afar as much as possible.

I will miss everyone and will be visiting whenever I can.

The last few years have been full of ups and downs. With this move I hope to be making changes to my life for the better.

If anyone in the Orlando area wants to hang out any time, feel free to get in touch!

Learning code by comparison

Recently I’ve slowly been learning C. Learning C has been on my agenda for years since I started using IRC. I’ve always wanted to give back to the IRC community through contributions to the software I use; most of which are in C.

Usually when I learn a new language I try to compare it with language I already know. This probably isn’t a new concept.

So in this, I wanted to share my train of thought for figuring out how to deal with what I would usually know as “objects”, with C.

To guide myself, I start with a simple Ruby script:

class Person
  attr_accessor :name, :age

  def initialize(name, age) = name
    self.age  = age

person ='James Newton', 21) #=> "James Newton"
person.age  #=> 21

Since C does not have classes like Ruby, we use struct:

#include <stdio.h>

typedef struct {
    char *name;
    int  age;
} Person;

int main(int argc, const char *argv[])
    Person person = {"James Newton", 21};

    printf("%i\n", person.age);

    return 0;

A couple of things to point out here is

  1. C does not have a string type, so name is a pointer. This gives us the freedom to make name anything we want. It could also be something like char name[100] to just allow up to 100 characters as the name value.
  2. main must be an int type.

Then doing a quick and simple compile we get:

$ gcc test.c
$ ./a.out
James Newton

Now I’d like to make a function that will handle outputting the information about a Person.

In Ruby:

class Person
  # ...

  def info
    puts "#{}, #{self.age}"

person ='James Newton', 21) #=> "James Newton, 21"

Since struct can’t include functions, we write a function that works specifically with a Person.

Right below our Person struct:

void person_info(Person person)
    printf("%s, %i\n",, person.age);

You’ll notice that we have Person person as the parameter. This means the value being passed will need to be a Person.

Next we’ll modify our main and take out the original printf calls and replace them with the function:

int main(int argc, const char *argv[])
    Person person = {"James Newton", 21};


    return 0;

After compiling and running we’d get the expected result:

$ gcc test.c
$ ./a.out
James Newton, 21

I’ll stop here because I’ve covered the gist of what I wanted to accomplish in this post. C in general is way more complicated than Ruby. You often don’t really realize how much work higher level languages like Ruby do for you, like memory management; which wasn’t touched on in this.

What little C I’ve learned so far I’ve learned by reading through Learn C The Hard Way. It’s a good place to start for anyone looking to jump into C.

I may write more as I progress through C, but until then!

Full code samples.

RubyServ - Ruby IRC Services implementation

I’ve been working on this for quite some time, and now I have a place to write about it.

I run a private IRC server. It’s only me, and a few select people that I’ve invited to join me mainly for technical chat.

For a while I ran a bot that would stream my commit messages to IRC, and I started of thinking of how I could turn the IRC server into more of a dashboard for me to manage stuff like my projects, and more.

After finding a couple of older Ruby IRC Services implementations I decided to build my own.

So I made RubyServ.

The implementation is designed to connect to an IRC server as services, so that it can keep track of the state of the network.

By default the only plugin that is loaded is the Core plugin, which is the RubyServ client itself.

Typical plugins look like this:

module PluginName
  include RubyServ::Plugin

  configure do |config|
    config.nickname = 'howell'
    # ...

  match(/command (\S+)/) do |m, param|
    m.reply "The param is #{param}"

This will match user input, with the following results:

22:48:02    newton | .command test
22:48:02   @howell | The param is test

Other interesting features is the ActiveRecord inspired pulling of gathered information on the IRC server:

[1] pry(...)> RubyServ::IRC::User.find_by_nickname('newton')
=> #<RubyServ::IRC::User:0x000000029a12b0
 @realname="James Newton <>",

In this example, we’re pulling the information gathered for my nickname, newton. All this information is available the same way to RubyServ plugins.

I’ve slowly been working on adding to the plugins repository based off things I’ve needed on my server. Hoping that it will grow in the future.

One of the features I’m most proud of is the web method for plugins, which is for using the baked in Sinatra integration.

module PluginName
  include RubyServ::Plugin

  # ...

  web :get, '/user/:id' do |m, id|
    # ...

    m.message('#channel', "User #{id} has been requested")

With the web method I can listen for incoming webhooks from services I use like GitHub. An example of a commit payload hitting one of my defined web routes (and parsed for reading):

23:01:49   @howell | rubyserv: James Newton <> master * 194bcb44e: add shortcut to client.message in Message

RubyServ has been a long time work in progress, but it’s been a fun project. I hope some time others find it as useful as I have.

Hello, world!

Welcome to my new blog! I’ve been working on this for a few weeks off and on, and recently came to a point where I felt like it was deployable.

I started working on this after a conversation at one of our somewhat weekly OpenHacks meetups, where I was called out on not having a blog; even though I have a tendency to tell our local learners that they should start one.

After a little bit of thought I decided I’d write a blog app that reflects my ideal writing area. While I’m not much of a designer, I wanted to keep things simple.

Here’s a couple of screenshots:

Controls Visible

While typing

Oh, and it’s open source.

I took some inspiration from Svbtle and Draftin while making this; both are in my opinion great examples of simple designs. I wanted an editor where there wouldn’t really be any elements that would distract me, and a clean interface. Not to say some things that do this don’t already exist. I wanted to do it myself, my way.

Now that I have this in production I hope to write more often so I can improve my writing skills, and write about the random things I make.