Elixir Runtime Configuration

Nov 18 2017

tldr: Don’t want to configure / learn a new external library just to use a dang environment variable in your release? This is for you: skip to the Solution section.

Context

You’ve started your first Elixir web application; it’s functional and fast and delightful and you’re ready to deploy. The Internet suggests you always build a release for production using Distillery (they’re right btw because...


Command Line History Hacking

Feb 13 2017

Lately I’ve been interested in optimizing my use of the one true shell: Bash.

One nifty feature I learned from the wonderful “From Bash to Z Shell” is how to use the command line history for command composition.

In addition to C+p, C+n, C+r and the like for navigating and reusing past commands, you can also compose new commands from past commands using the “bang” history lookup modifiers.

The...


LessCode Form Validation - Serverside Edition

Jun 9 2016

One common task that comes supported in most large frameworks is form validation.

There are at least three different places form validation could be implemented.

  1. Client-side
  2. Server-side
  3. In the Database

For this post we’ll mostly explore the Server-side variety, with an example of how we can use the server to respond with helpful messages for the user.

I tend to think of Server-side validations...


Polymorphic Spree

Apr 14 2016

This post will try to describe polymorphism using a simple example and compare that solution with a semi-stateless message passing based approach. I was inspired to write this by JEG2’s observations in using Elixir and how it relates to Object Oriented design, and also by Avdi Grim’s wonderful Ruby Tapas episode 357 ‘Object Oriented Programming’. If you’re not already a Ruby Tapas subscriber I highly...


Building A Tiny Web App

Nov 27 2015

I’ve been infatuated with the LessCode movement as of late. A few days ago I set out to see how quickly I could construct a small database backed application. Granted it did take a bit longer than 15 minutes, the libraries used in this project are quite small and pretty easy to understand. We’ll avoid magic, and walk through each step.

Libraries used: Cuba, Mote, Nomadize, SQLCapsule

We’ll be...


On Selling Used Cars With Postgres

Oct 22 2015

Let’s say we have an inventory of used vehicles and we’d like to display a selection of these vehicles to a user. It would be ideal if we showed the user a group varied by brand / model. Toyota makes a great car but It wouldn’t do to only display Toyota Camrys over and over.

It’s not difficult to imagine a car as a simple data object:

cars = [
  { make: "Toyota", model: "Camry", year: 1996, mileage...

TDD - Top Down Design

Sep 21 2015

Note: This is post number one in a series on building an application without a proper ORM.

Backstory: For a long time, I’ve wanted an app I could put recipes in that showed each step of the recipe, in order, on a singular page, with nothing else. I have trouble finding/keeping my place when working through a recipe and this seemed like an easily solvable problem.

I intend to use/display the Step


Cursing Windows

Feb 18 2015

AKA ‘How On earth do I make a window?!’

This post uses ncurses-ruby I’d recommend looking through some of the examples with the caveat that they are not quite idiomatic Ruby. They are helpful enough to get started.

require 'ncurses'

Ncurses::initscr()
Ncurses::start_color()
Ncurses::noecho()
Ncurses::cbreak()
Ncurses::keypad(Ncurses.stdscr, true)

begin
  win = Ncurses::WINDOW.new(10, 10, 10,

Hello Rust

Aug 27 2014

Disclaimer: I’m probably wrong; I’m usually wrong. (please correct me, I love corrections)

As a newb to Rust I found the vector/string paradigm quite daunting. Let’s play:

fn main() {
    let place    = "World";
    let greeting = "Hello";
    let message  = greeting + " " + place;
    println!("{}", message)
}

// strings.rs:4:20: 4:31 error: binary operation `+` cannot be applied to type `&'static...