Michael Cordell's Blog

Customizing phoenix generation templates

When using a framework’s code generators, its often useful to be able to tweak the code that is generated each time. In particular, the templates that are used to generate the HTML often need a custom structure to match your styling or fronted CSS framework. In phoenix, this is done by adding new template files …

IEx history

In elixir, IEx lacks a history in the way that the interactive shells in ruby (pry and irb) have. In order to get this working, erlang-history must be installed. This can be accomplished with the following: git clone git@github.com:ferd/erlang-history.git cd erlang-history sudo make install

Tufte One Day Course Retrospective

Earlier this week, I had the distinct pleasure of attending Edward Tufte’s one-day course. For those unfamiliar with Tufte, he is a master in data visualization and presentation, and one of the preeminent thinkers in the field. I had been referred to Tufte’s work but my mentor and have read one of his …

GrapeTokenAuth 0.1.0 release

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 …

Setting up authentication on a Grape API with GrapeTokenAuth

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. In this post, we will walk through setting up …

Better Fuzzy Search with Ctrl-P in Vim

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 …

Prime Factor Problem Cheat Sheets

1 is not a prime number. A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. – Wikipedia Finding Prime Numbers Sieve of Eratosthenes A basic implementation of the sieve of Eratoshenes I wrote: def primes(max_value) search_space = …

API with Padrino and Grape

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 …

REST API and related object creation

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 …

Quick fixup in Vim with fugitive

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 …

Pages