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

D3 Class Operations

| Comments

D3 has operations for class name manipulation that you’re used to from jQuery. These include addClass, removeClass, hasClass, and toggleClass. They just go by different names.

d3 class names

Ideas From the Accidental Creative

| Comments

I just finished a book about becoming a more productive and effective creative person, called “The Accidental Creative”. It was a great book and included some thoughtful ideas that I ended up pondering and have started incorporating into my life.

The Accidental Creative

Destroy Duplicate Tests

| Comments

As soon as we begin to write a test for our code, it is natural for us to think that we are doing a good thing, and often, we are. Yet, I believe there are times that we’re writing tests when we’re hurting more than helping — and, of course, this is not on purpose. To clarify, I’m an advocate for testing in general, and this is a short thought on how to make it better.

Double tests are not fine

Expose HTTP Headers in CORS

| Comments

For APIs, it seems more and more data is making its way into the HTTP headers. Recently, whilst adding a Link header, for paging data, into the HTTP response, I realized that my browser code couldn’t see it. Who was the culprit? CORS, of course.

Cors

Send Props to Children in React

| Comments

In React, you’re always making components. Sometimes components are standalone. Other times, you’ll have components that can nest children components. Sometimes you’ll want to send properties to the children components from the parent as often as a doting parent wants to send packages to a child missionary. It’s possible, it’s simple, and it’s not documented super well. Here’s one method.

React

Set State in Callbacks in React

| Comments

In React, you can setup components that fetch their own data and set their own state with that data. Because of the async nature of data fetching, you’ll have to make sure to keep things cleaned up to avoid the error of trying to set state in an unmounted component.

React