GhettoCo.de

Dot Dot Dit Dit Dot Dot Dash

Problem Child

“What’s going on with you, DevilDog? Staff Sergeant Fuckface is saying you’re his problem child?”

I didn’t know what to say when, as a young Corporal in the Marine Corps, my mentor, a well-liked Gunnery Sergeant in my unit, told me that my Staff NCOIC was spreading the word that I was a fuckup. I’d just recently gotten my NCO stripes and was working my ass off to learn to be a good leader of Marines and set a good example for the younger Marines in the unit. Yet more and more, it became apparent that nothing I did was going to be good enough for the Staff Sergeant. I couldn’t figure out why the guy just didn’t like me.

A few months later, that Staff Sergeant was led away in handcuffs for stealing thousands of dollars from a retired Marine. As I understand it, once he learned the gig was up and he’d been caught, the unit Sergeant Major asked him what the hell he was thinking and Staff Sergeant Fuckface simply responded, “I thought Ford would get blamed.” After 17 years of service, he ended up walking away from the Marine Corps with a reduction in rank to Private, no benefits, and a Bad Conduct Discharge…after spending 6 months in the brig.

I won’t bore you with the details of his scheme, how he planned to let the blame fall on me, or how I oh-so-narrowly escaped being caught up in his bullshit. But I often reflect on how, if I hadn’t gotten extremely lucky, my life would look completely different than it does today. I likely would have gotten even a harsher sentence than he had. Probably a year or two in Leavenworth. I’d be a convicted felon through no fault of my own. I was lucky to escape that fate.

But I never quite recovered from the damage that he’d done to my reputation while setting me up to take the fall. It became clear, in hind-sight, that he had been spreading the word that I was a shit-bag so that once the hammer fell, he could just sit back and say, “See, I told you he was a shit-bag.” In the minds of other NCOs and Staff NCOs of my unit, sure Staff Sergeant Fuckface was a turd…but maybe some of the things he said about Ford was true. I always had a question mark hanging over my head and I never got promoted, again.

I often think back and replay the entire thing in my mind, each time coming to the same conclusion: Fuck that guy.

Installing .deb Packages Locally

My current job is in a PHP shop and although we have ruby installed on our production machines, it’s basically the system ruby packaged with our OS. Being a ruby developer, I’ve developed quite a quiver of ruby scripts and tools over the years that allow me to personally do my job better, regardless of what language I’m developing in. Most of those scripts rely on RubyGems not installed on the machines. While installing gems locally is a long-solved problem, sometimes a gem needs to be compiled against a native component that isn’t installed on the machine. So how do we install it so we can build our gem, yet not disturb the system?

In this example, I’ll show you how to install the mysql development packages so that the mysql gem can be built.

Creating Angularjs Services in Coffeescript

For my latest personal project, MicBooker, I’ve decided to go with the AngularJS framework. In a very short amount of time, I’ve been able to get further, faster with Angular than I have with any of the other MV* javascript frameworks I’ve tried. Nothing against the other frameworks, it just seem they’re all changing and improving so rapidly that the documentation isn’t keeping up.

So far, I’ve found Angulars docs to be much better and they even have several screencasts and tutorials to help you get up-to-speed quickly. That said, I did run into my first issue that caused me a bit of head-scratching. It took me a couple of hours of experimentation to implement custom services and filters in Angular.

In case you’re having similar problems, here’s a brief outline of what worked for me.

Y’all Cray

Technically, I currently work for a well-established company. Workforce-wise, they’re not huge but their operations are significant. Couple that with the fact that they deal primarily with banks, and it’s no surprise that their process is very “enterprisey”. Luckily, I don’t “really” work for that company. I’m the CTO of a much smaller “startup” that’s being seeded by the owner of said larger company.

It’s so funny to talk with the C# and Java developers from the parent company because they just don’t “get” how we work. For instance, testing. We’ll be consuming their services via a SOAP API (I said they were enterprisey). Today, one of their devs came by my office to talk to me about the various error conditions and codes in their API. Some of them will be newly created in their system specifically for how we’ll be using the system. The developer assured me that they’d get them implemented as soon as possible so I can start to test my logic for handling them.

I told him not to worry and assured him that as long as the service will match the specs, then I can start writing and testing my code before they get finished building it.

“But how can you test hitting our service if it’s not built?”

“Oh, I could do it a bunch of ways but I’ll probably just stub out the calls with webmock or something. Even after the service is built, most of our tests won’t actually hit the service anyway unless I delete the VCR cassettes.”

blink blink…stare…what…I don’t…did he just say VCR cassettes?

As he was walking away, I swear I heard him whisper under his breath, “That dude’s crazy”.

One of these days, I hope get a minute to sit down with those guys and show them how we run tests. Until then, I guess we’ll just have to live with being those crazy kids down the hall.

Bootstrapping Design

I can’t count how many times I’ve started a new project, wireframed it, built it, and then had the whole thing fall apart when it came time to do the work of actually finishing the design. Usually, it’s a personal project that, while you hope others may find some value in it, it’s not a money-making venture. So I don’t want to spend much on it.

That means I definitely don’t want to pay a designer. Nothing against designers. I’m in awe of them and the products they produce. I just can’t justify the cost of a good designer for a pet project that even I’m going to be over in a couple of months. And if I’m going to use a not-so-great designer, I may as well do it myself.

That’s why I was intrigued by Jarrod Drysdale’s new ebook, Bootstrapping Design.

Paperclip Defaults and the Asset Pipeline

The latest stable version of Paperclip hasn’t yet been updated for the Asset Pipeline. This only affects the default image which is served if no file has been uploaded for the attached asset. If you’d like your default “missing” images served from image assets in the pipeline, configure the default_url like this:

app/model/foo.rb
1
2
3
4
5
class Foo < ActiveRecord::Base
  has_attached_file :avatar,
    :styles => {:small => "300x300>", :thumbnail => "80x80#"},
    :default_url => ActionController::Base.helpers.asset_path('missing_:style.png')
end

Multiple Asset Pipelines

I’m working on a project that needs both mobile and web interfaces. We’re building the mobile interface with Sencha Touch and the web version with good ol’ jQuery.

I setup the app for mobile similar to Ryan Bates’ Mobile Devices RailsCast. This allows us to serve different views to the client depending on whether or not the device is a mobile device.

But what about the javascript and coffescript? We’re going to need different behaviour on the client side depending on which view is rendered and I want it all to take advantage of the Asset Pipeline. So I decided to try and make a parallel asset pipeline