Rails Precompile Failure With Bower Packages

I work with a team where we use bower packages in the vendor/assets/javascripts. Nothing to out of the ordinary, but to compile them for production we use the following block in our config/application.rb:

config.assets.precompile << Proc.new do |path|
full_path = Rails.application.assets.resolve(path).to_path
app_assets_path = Rails.root.join('app', 'assets').to_path
if full_path.starts_with? app_assets_path
if File.basename(full_path) =~ /^[^_]+(.*)\.(css|js)\.?(sass|scss)?$/
puts "\e[0;32m✓ #{full_path}\e[0m"
true
else
puts "\e[1;30m✗ #{full_path}\e[0m"
false
end
end
end

All was well with this up until a package was added that had a bower.json file in it. The package in our case was requirejs-plugins. After adding this package in, during an asset compile we were greated with the following error:

Work Your Hardest or Work Your Best?

An couple interesting phrases you’ll hear tossed around from time to time are, “We’ll have to work our hardest to accomplish this,” and “We’ll need to do our best to accomplish this.” From the outside these two seem very similar; however, when you start to break them down the only two words of difference are hard and best. Curious, are these two words the same? For fun I am going to provide the relevant definitions.

hard: requiring a great deal of endurance or effort.

best: of the most excellent, effective, or desirable type or quality.

It’s normally pretty great when you can work hard and do your best, but it’s not all to fun to work hard and create sub-par quality. Always focus on best over hard. It’s hard to have the first without the second, but don’t automatically assume there is some magical ratio between them.

Estimating the Unknown for a Deadline

One of the biggest “oh noes” in the book for me is when estimations are wanted for work that already has a timeline and scope seemingly out of my control. All to often these kinds of projects feel doomed to fail, or at best a gamble. After reading a stream of different view points on this topic I decided to stop and reflect on myself. Why do I feel this way when a project takes this form?

Youtube Download Tool

I have been watching the LCS on my phone off and on when I find some spare time and try to keep up on it during the week. After getting tired of sketchy wifi spots and burning through my data plan I decided to find a better way.

Landed in Gatlinburg

Rented a vaction house in Gatlinburg through the rest of the weekend and have had a fantastic time so far. Spending some rest and relaxation with some great friends and hope to spend some time learning how to use my new GoPro.

Crouching Code, Hidden Intent

Yesterday I was looking at some Ruby code that had an initialize method like this:

def initialize(data)
@data = data
@data = Wrapper.new(data) if data.is_a? Hash
end

This code has hidden intent that could be easier to read. By assigning @data possibly twice it forces the reader to keep extra context in their head while reading and masks intent. The intent of this code is to assign @data with whatever is passed in, unless it’s a Hash, if it’s a Hash it’s supposed to be a Wrapper.

Let’s see if we can write this a little better to help bring that intent forward:

def initialize(data)
@data =
if data.is_a? Hash
Wrapper.new(data)
else
data
end
end

Ship Soon and Often

When you can, this should be how software is made. As I get older the thought of working on a software project that takes more than three weeks before feedback comes from the end user scares me more and more. Don’t get me wrong, I totally understand that not all software projects can accomplish this; and for them I weep. Call this idea whatever you want. You can call it Agile, Kanban, or whatever else I couldn’t care less…

Caps Lock Is the New Ctrl Key

If you are on Linux and still using the CapsLock key for it intended use, you may need to re-think your life choices. I have recently done just that and have remapped this near worthless key to Ctrl and it has been heavenly (apart from still wanting to press Ctrl of course).

If you are on Ubuntu you can remap it by editing the /etc/default/keyboard file. Find the line that looks like this XKBOPTIONS="" and make it looke like this instead: XKBOPTIONS="ctrl:swapcaps". This will swap the role of ctrl and caps lock. If you just want to kill the idea of CapsLock all together then you should use the ctrl:nocaps option instead.

My Erlang Talk With Gridlock

I’ve been pushing hard on learning Erlang for about four months now, and this week felt like a good time to give a talk on what I’ve learned so far. To aid in my learning back in December I started developing Gridlock, a multi-player minesweeper clone that I’ve built in the past with Node and Rails.

All in all it went really well and I am excited and ready to dive into learning Elixir next. I have enjoyed learning functional programming languages and think there is some really good lessons to learn from them. I’m not sure what will be on my horizon next; however, I feel more confident having added this knowledge to my tool belt!

Edit: You can find an example of Gridlock here: Gridlock