Eric Boehs

Adding a Custom Postgres Type in Rails 4.2

Sep 17, 2015

In a Rails app at work, we are using a PostGIS data type of geometry and we were getting this warning in our logs:

unknown OID 16391: failed to recognize type of 'geo'. It will be treated as String.

This is because by default, Active Record doesn’t support the OID 16391 for this data type. We can add our own in Rails 4.1 as recommended by Rob Di Marco.

Read more…

Configuring Pow including SSL

Jan 20, 2015

I used pow in the past and didn’t like it. I’ve given it a second chance and it seems to be working out. I’d like to give Invoker a try though but I’ll save that for another day.

Pow is a daemon that runs your rack (Rails) apps in the background when...

Read more…

Parsing null terminated key/value ASCII strings in Ruby

Oct 31, 2014

I’ve recently been messing with a lot of hex thanks to my current client. I ran across a key/value hex string where each key/value pair was NULL terminated (pairs separated from other pairs with a NULL character) and each key was seperated from its value by a colon. Here’s the hex string:

>> hexstr = "56494e3a3147314a433534343452373235323336370050524f544f3a3500504152414d533a302c312c322c342c372c392c31312c31342c323000494e44435452533a302830303030303030303030303131292c3128303131303031303131313129"

First I wanted to convert this to ASCII, Ruby makes this fairly simple:

Read more…

Test if memcache is running and accessible

Feb 3, 2014

I’ve been writing a Rails template for our future projects at Brightbit and I’ve been testing everything, including our application’s environment. I’ve wrote a special rake task to test our different environments (development, test, staging, production, etc). This helps us ensure each environment is configured correctly. Ideally it would let the person running the tests know what is wrong with their environment and how to resolve it.

One of the environment details I wanted to test was that memcache was setup and running correctly. I could of course test for the memcached binary or check if it was running, but since we are running these tests in the context of a Rails app, why not just ask Rails if it can connect to the memcache server?

Read more…

Sharing a team Heroku account

Mar 22, 2013

tl;dr: Share a Heroku account for a single place to add/remove team members for all shared apps. Permission allocation/revocation made simple! How? Add a new key for each team member to the shared account; access app repos using the heroku-accounts plugin

Currently at Brightbit there’s 4-5 team members to add to each Heroku app. And with some projects having two, three or more apps (staging, production, splash, etc) it gets a bit cumbersome adding all of us and it will only get worse with more team mates.

Read more…