rubycoloredglasses


I'm Jason, a web application developer in East Tennessee.


  1. Error when building PhantomJS 2.0

    I was tasked with installing PhantomJS 2.0 on an Ubuntu 14.04 VPS running with 2 GB of RAM. Online discussions on Github and Google Groups seemed to have pointed to the build process requiring much RAM to complete without error.

    g++: internal compiler error: Killed (program cc1plus)
    
    Please submit a full bug report, with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
    
    make[2]: *** [.obj/inspector/InspectorAllInOne.o] Error 4
    make[2]: *** Waiting for unfinished jobs....
    make[2]: Leaving directory `/home/app/src/phantomjs-2.0.0/src/qt/qtwebkit/Source/WebCore'
    make[1]: *** [sub-Target-pri-make_first-ordered] Error 2
    make[1]: Leaving directory `/home/app/src/phantomjs-2.0.0/src/qt/qtwebkit/Source/WebCore'
    make: *** [sub-Source-WebCore-WebCore-pro-make_first-ordered] Error 2
    

  2. Setup Environment for Django Development

    Although this website is primarily devoted to Ruby / Rails development, I’ve found it necessary to learn Python for a new position I might take in the upcoming year. Here is my guide for setting up your local workstation for Python / Django development on a Mac OS X workstation.


  3. Issues with RVM after upgrade to OS X Mavericks

    So I just upgraded to OS X Mavericks (10.9.5). I also upgraded to X Code 6, and also installed the command line tools via the xcode-select --install command. I also have the ‘apple-gcc42’ Homebrew package installed to provide GCC 4.2.

    Still however, when I would try to install a version of Ruby via RVM, I would get this error:


  4. Bypassing the AngularJS router for anchor tags

    I’m working with a Rails application that is using an AngularJS front-end. We are using routing to override the behavior of anchor tags to ensure that they load other templates with controllers, as defined in our routeConfiguration.js. This works out great most of the time, unless you need to override the routing so that your anchor tag can point to an end-point served by your Rails back-end. In my case, I’m linking to an end-point that serves a named CSV file. Without any sort of over-ride, I was finding that the default fallback behavior defined by the otherwise() method was occurring. In my case this was a 404 page template that loaded.


  5. Sharing Administrative Rights with Homebrew

    I installed Homebrew on my work computer, and have installed many ports using Homebrew from an account on my machine. This has resulted in all of the files and folders managed by Homebrew being owned by the user account I installed the ports from, with ‘admin’ group ownership.

    Recently I created another account on my machine, logged into it, and ran ‘brew doctor’ just to make sure everything was in excellent order, and I ran into these errors:


  6. InstructureCon Hack Day

    Disclaimer: The opinions or statements expressed herein should not be taken as a position of or endorsement by the University of California, Berkeley.

    I’m currently at InstructureCon attending the “Hack Day” event, which is simply an event where any developers wishing to integrate their systems with Canvas can ask questions, talk to Canvas developers, etc.

    Here are some things I’ve clarified with their developers thus far, thanks to Eric Berry and Brian Palmer (codekitchen.


  7. Strong Parameters with Spree Extensions

    I’m currently working on an extension for Spree, an e-commerce solution for Ruby on Rails applications. The developer documentation for Spree is very helpful, letting developers know that they should use certain Ruby meta-programming methods to extend the functionality of the Spree system. The extension I’m working on was setup under a version of Spree that used Rails 3.

    Now that Spree v2.2.1 uses Rails 4.0.4, I’m having to refactor some parts of this extension to adapt to new practices.


  8. Ruby Class Name

    I noticed that in a module used on the CalCentral project that logger expressions used in a module referenced ‘self.name’ many times. I checked ApiDock.com for a reference to this class in the Ruby or Rails documentation, but I couldn’t find one. The module itself didn’t define a #name method, so I was perplexed.


  9. Using 'for in' in Javascript

    Today our lead front-end developer pointed out to me that when using a ‘for in’ loop in Javascript that you want to make sure to use hasOwnProperty() on the element to make sure it belongs to the object, and not properties that were inherited through the prototype chain.

    More information is available on this page describing common Javascript code mistakes caught by JSLint.


  10. How to 'head' a text file in Ruby

    I wanted to just view the first 20 lines of a 10,000 line CSV file returned by an API in a Ruby on Rails project I’m working on. Here is the chain of Ruby commands I came up with to effectively ‘head’ the CSV document returned.

    >> csv = "first line\nsecond line\nthird line\nfourth line\nfifth line\nsixth line\n"
    >> csv.split("\n")[0..3].join("\n")
    => "first line\nsecond line\nthird line\nfourth line"