Falling Into the Pit of Success with Web Components

Being able to build components (AKA “directives” if you’re in the Angular camp) has changed the way we structure web applications on the front end. This is a big move forward and provides a lot of power in addition to some much needed encapsulation. However, even with the drastically improved tools we have at our disposal for building client side applications, I still see projects going down the wrong path. Code is tightly coupled and maintenance quickly becomes an issue. The [...]

Angular Directive Testing Best Practices

Getting in the habit of testing is hard, but I’ve found that a big turning point for me when I start testing in new languages and tools is to identify patterns in how tests are written. Once I know a pattern for testing something, it’s easier to walk through each step to write my tests. Just like anything else, it’s more approachable when you break it apart into smaller pieces. When testing directives, this is the main pattern I see: Mock Compile Interact Assert An [...]

CoffeeScripters, Have You Tried ES6 Yet?

ES6 is providing a lot of features that I’ve heard CoffeeScripters bragging about for the last few years, but is it enough for people to start considering vanilla JavaScript to be a viable alternative? Let’s take a look at some of the big selling points of CoffeeScript and see how they compare to some of the new hotness in ES6. Classes The first and most obvious of these features is classes. ES6 supports them natively and we even get inheritance and super! Here [...]

Dissecting Angular: Bootstrapping

Continuing on our journey through Angular, today we’re going to cover its bootstrapping process. This is where we’ll take the static contents of a DOM element and turn it into a dynamic Angular app. angular.bootstrap() Last time we left off at angularInit() calling bootstrap() and passing in a DOM element and module name. That element will now be compiled inside bootstrap(). Let’s walk through the code. I’ve added comments to explain what’s happening in context. function bootstrap(element, modules) { var doBootstrap = function() { // [...]

Dissecting Angular: Initializing An App

This is the 2nd post in a series on the internals of Angular. Today we’ll be covering how Angular initializes itself and sets up applications to be bootstrapped. Starting Angular Jumping back into the /src of Angular, the first two files we need to look at to understand how the initialization process works are angular.prefix and angular.suffix. We talked about these last time, but to recap, these files are prepended (prefix) or appended (suffix) during the build process. In angular.prefix we see that it all starts off with an immediately [...]

Dissecting Angular: Code Organization

I’ve been reading a lot about design patterns and building modular JavaScript applications lately, but I wanted to see a real life example. I decided to start dissecting the Angular source to look at how they make use of some popular patterns. This is the first post in a series that looks at what makes Angular tick. Use the src, Luke If you want to understand how Angular works, the first thing you’ll need to look at is how the code [...]

Pimp Your Chrome Dev Tools with Custom Stylesheets

Did you know that Chrome gives you a stylesheet you can use to customize the look of your dev tools? I didn’t either until I looked over at my buddy Zach‘s screen and saw him rockin’ a dark color scheme in his dev tools when we were working at a coffee shop a couple weeks ago. He informed me that you can put custom styles in ~/Library/Application\ Support/Google/Chrome/Default/User\ StyleSheets/Custom.css and these will override the default dev tool styles. Obviously, I spent the next [...]

Lessons Learned from Selling My First Business

We recently sold a coffee shop and I think we did almost everything wrong. Here are a few lessons I learned selling my first business. Hopefully this will help others avoid the mistakes we made. Don’t show your hand We found out a few months ago that my wife is pregnant. She has been putting in 60+ hour weeks and we knew this wasn’t a sustainable thing so we wanted the deal to move quickly. We advertised this to our buyers [...]

Develop Faster with iTerm Profiles and Window Arrangements

My friend, Jon Kinney, was showing me how he’s able to jump into dev mode with his server, Rails console, database console, test suite and Vim all running at once using tmux and the tmuxinator gem. I was obviously jelly and I wanted to find a way to do something similar, but since I don’t really use terminal Vim for regular development I thought tmux was overkill for just starting up my server, consoles and tests so I decided to find a way [...]

Getting Started with Laravel 4

With the release of Laravel 4 just around the corner a lot of people are trying to decide whether to start a new project with a stable 3.2 build or wait for the new version. I found myself in that position earlier this week so I decided to pull down Laravel 4 and work off that since I figured the transition would be smoother once a stable version 4 is released. There isn’t really any documentation on how to get started with [...]