Using JavaScript’s Function Bind

| Comments

JavaScript’s Function object has a very helpful method, bind. It is a great tool to give you control of the ever-squirrely this keyword. Have you ever had trouble predicting what this will be or making equate to what you want? bind will help you do that with more power and consistency. It can also help you with partial function application.

function bind

Testing React on Jsdom

| Comments

React allows you to create components that will render UI for your application. If your UI is of any complexity, you’ll likely want to test that it functions correctly and allows for future refactors. There are numerous ways to do this. One way that you might appreciate is using jsdom, an in-JavaScript implementation of the DOM.

react on jsdom

The Power of Liking

| Comments

When there is a new software product to write, there’s a decision to be made on what to write it in. In other words, what tech should we use? Technologists have technology they “like”. So then, what tech should they choose for the new project? Does it matter what they like?

Like!

List Npm Scripts

| Comments

Tools for storing and then later easily running scripts alias names are awesome. Npm is one of those tools. Rake is another. Rake has a cool feature of allowing you to list the scripts available to you. Npm has not – until now.

npm

“12-Factor App” Summary

| Comments

I recently had a chance to go through the principles of the 12-Factor App as listed on 12factor.net. It’s written by some of the fine folk at Heroku. The principles describe the best practices they see for how to get a modern web app deployed properly. It’s a short read. This summary is even shorter.

12 Factors

Test React componentWillReceiveProps

| Comments

Testing React Components has been easier and more enjoyable than any previous UI unit testing I’ve done in the past. Components that have interesting things happen in lifecycle methods have a little more setup to get tested. Components that use the componentWillReceiveProps method are in this category.

react

Programmer Struggle

| Comments

The life of a programmer is mostly a never-ending struggle. Solving problems in an always-changing technical landscape means that programmers are always learning new things. In this case, “learning new things” is a euphemism for “battling against our own ignorance.” Even if a programmer is just fixing a bug in code that uses a familiar technology, sometimes the software we create is so complex that simply understanding what is going on can take an entire day.

If you write code, you will struggle. Most professional programmers learn to struggle hour after hour, day after day, without getting (too) frustrated. This is another skill that will serve you well.

Sinon Spies vs. Stubs

| Comments

Sinon provides spies, stubs, and mocks. They’re all useful as fakes in tests. They come with essential differences for what they’re helpful in doing and how they work.

spies vs stubs