Blog Posts

  • 06 Dec 2022 » ActiveRecord validations as a developer safety net

    Here is an idea I had - using rails ActiveRecord validations to ensure that the proper methods are used to update state.

  • 14 Mar 2017 » Using webpack-dev-server with (iOS) devices on the local network

    I was having an issue when using webpack-dev-server (via the webpacker gem). It worked great on my development machine, but I couldn’t get the webpack bundles to load on other devices, namely my iphone and ipad, that were on the same local network. The steps I took to fix this are as follows, in the context of a rails application. Note that this tutorial is very specific to iOS and the WebBlock app, but the general idea of using a proxy is applicable to other devices.

  • 17 Sep 2015 » Which Strong parameters can I securely permit in rails?

    Assume the following setup in a typical rails application:

  • 24 Apr 2015 » Starting (and restarting) a slideshow on a remote raspberry pi

    I recently got my first raspberry pi, it is being used to run a simple display board at work. Newsletters and announcements are converted to image form and then displayed in a slideshow. After some trial and error I came upon the fbi command, which displays images on a screen directly, no need for an X-session. This has worked really well, I have a script that displays all the .png files in a directory:

  • 15 Apr 2015 » Base64 decoding email attachments with Ruby

    This may be a fairly uncommon situation, but have you ever needed to recover an attachment from a deleted email? I had accidentally deleted an email containing an excel spreadsheet that I still needed. For reasons I won’t go into here, the only copy of the email I had was a ‘raw’ text file of the email. rather than mess around with trying to get to recognize it as an email, I decided to try and recover the base64-encoded excel file from the email.

  • 20 Dec 2014 » RSpec-mode, Magit and Path problems in Emacs

    I have been using rspec-mode to run my specs lately. It’s nice to get the spec feedback without having to tab out to a terminal (or running a terminal in emacs). C-c ,m works great, it runs all the specs for the current buffer. More and more, I’ve been seeing the value in Magit-mode. I always loved the ease in which magit lets you choose hunks of files to commit, but I just learned that you can stage arbitrary sections of a hunk! Simply mark (highlight) the section that you want to stage for commit, and then press s in magit-status-mode. So handy!

  • 16 Sep 2014 » Arbitrary Mode Scratch buffers for Emacs

    In my current job, I do a fair amount of teaching about web development. Usually these are quick 10 minute lessons, and often times it is easiest to explain a concept with a code snippet. Being an emacs user, I typically open up a new temp buffer, set the major-mode js2-mode/web-mode/css-mode (for javascript, html/velocity/jsp and css respectively) and start typing. After doing this several times, the several steps became irritating. It seemed to me that emacs is all about customization, and I should be able to open an arbitrary buffer with one command. Seeing this as a perfect excuse to further enhance my elisp skills, I came up with the function below. Now I can just call this function1 and type in the mode-type and a buffer with all the correct settings is loaded.

    1. I bound this to C-c C-s b, for Create Scratch Buffer, it may or may not be appropriate for your keymap setup. 

  • 19 Nov 2013 » Failing Tests Considered Helpful

    Background: I work in web development, and am trying to learn and apply the concepts of TDD.

  • 08 Jun 2013 » Reading list

    Over the course of my college career, I have been simultaneously fascinated by the concepts presented in class and disappointed by the lack of the practical lessons. This may or may not have been a bad thing, as it piqued my curiosity and led me to search elsewhere to supplement my college education.

  • 03 Jun 2013 » About me
    def learn_More
      unless status.equal? no_more_to_learn
        set_status "learning"