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

Test React-Router Previous Params for Component Update

| Comments

Once upon a time, react-router transferred params and query params from the url via props into components. It doesn’t happen this way any more. So, let’s say you have a need in your component like overriding shouldComponentUpdate in your component which only has access to this.props and this.state. How can you use the url data to affect the component re-render or not?

react

Set Cookie on Rack Mock Request

| Comments

Rack apps are generally straightforward to test because of their very basic public interface. But where do we put specific things, in this case, a cookie for the request, on that env argument it takes? Here’s one way.

rack mock request

React-Router With Flux

| Comments

react-router provides great route handling with route params and query params. Flux provides a pattern for building React apps, including a pattern from providing data to your components. Here’s a straightforward way to make route changes trigger data changes in your components.

react