Michael Cordell's Blog

GrapeTokenAuth 0.1.0 release

November 10th, 2015

After several month’s of work, I am happy to announce the first release of GrapeTokenAuth, a token authentication solution for Grape APIs. GTA is a drop-in authentication solution for Grape APIs that aims to maintain a low direct-dependency footprint. GrapeTokenAuth is a port of devise_token_auth, whereas DTA is a devise and rails solution GTA depends on grape and warden. GrapeTokenAuth has built in compatibility with two mature front end libraries: ng-token-auth (for angular) and jToker (for jQuery). If you are build Grape APIs and have been looking for authentication, grape_token_auth may suit your needs.

Setting up authentication on a Grape API with GrapeTokenAuth

September 15th, 2015

Grape is a fantastic framework for building an API. Of course, one of the most fundamental aspects of any API is authentication. The grape_token_auth gem is approaching its first major release (0.1.0) and this will provide a “getting started” guide.

Better Fuzzy Search with Ctrl-P in Vim

January 27th, 2015

For those familiar with Sublime Text and have since moved to vim you probably miss the Cmd+P feature that allowed you to find a file in your working directory through a fuzzy match. The two main plugin contenders for fuzzy file finding in vim would arguably be Ctrl-P and Command-T. Personally I perfer Ctrl-P because it does not have a compiled extension and it offers a few niceties such as MRU and buffer switcher. Here’s a gif of it in action:

Prime Factor Problem Cheat Sheets

December 20th, 2014

1 is not a prime number.

API with Padrino and Grape

November 2nd, 2014

Recently, I have been exploring options for creating RESTful APIs in the Ruby. Concurrently, I have been investigating Sinatra and its father-framework padrino to create a lighter weight web app. While Sinatra in itself is a suitable solution for APIs, grape is a micro-framework specifically geared towards creating them. It also mounts well alongside Sinatra apps so it follows that it should play well with padrino. Below, I present a method for setting up a grape API in padrino and two methods for testing the API one using plain rspec with rack-test and another using airborne. The complete repo for this process can be found here at padrino-grape-example.

REST API and related object creation

October 22nd, 2014

While building a REST API I began examining th issue of creating child objects that do not already have a parent object created. Consider the following scenario: Books have one author and author’s have many books. What happens when you want to add a book but have not yet created the author resource. Further, what happens if you do not want to add an author without at least one book?

Quick fixup in Vim with fugitive

July 20th, 2014

I am a huge fan of Tim Pope’s fugitive git plugin for Vim. I rarely have to drop out of vim to do any git related functions. However, I found that --fixup is not well supported in fugitive, but can be easily be achieved. One of my workflows with git is to add fixup commits whenever I am doing revisions due to code review or otherwise. When the code is ready for a pull request, I do a rebase with --autosquash and I get a nice clean git history. Technically, I am re-writing history with this flow but I much prefer a clean and organized commit history.

Automating the start and end of your work day

June 13th, 2014

You probably do the same thing when you arrive every morning at the office if you are a developer. Fire up your editor, open your chat program, probably a console or two. At the end of the day you probably shut all of that down, and it is a pretty stable and recurrent flow, which means that it can be automated! As an exercise, I wanted to automate my own daily bookend processes and I’d like to share how I accomplished that. As a short preface, this post focuses on automation in OSX but similar tools are probably available in most linux distros. My tools of choice for this are:

Getting Started with Slate

May 25th, 2014

Slate is an open source window management tool geared towards power users. It obviates the use of many paid tool such as Divvy and Stay. I am a long time Divvy user and was considering using Stay to manage window arrangements, until I found Slate. Slate is configured through a .slate file that will be familiar to users of vim. The full documentation can be found on Slate’s github page and I highly recommend this article on getting set up. What I would like to share below is a quick and dirty setup with slate that I found works for removing my need for Divvy, adding a cool new feature, and demonstrating a simple window management.

Ubuntu 14.04 and Compiling Ruby 2.X

April 26th, 2014

While trying to set up a VPS running Ubuntu 14.04 I was unable to compile Ruby 2.1.1 (which was the current version). I kept running into errors such as:


Older Newer