Converting base64 to an Image

A very long time ago, I wrote a post about Getting base64 of an Image. Today, I needed to do the inverse of that. I had a text file with base64 data that needed to be converted into a JPEG file. How to proceed? Well, first, check the docs: >…

Use Browser's Console Temporary Local Variables in React Native

Have you ever used console.log on a complex object and gone to inspect it in the browser's inspector? Maybe it's so complex you wanted to run JSON.stringify on it so you could analyze it more easily? You can normally do this quite easily by right clicking on the…

Understanding Lodash Memoize

I work on a team that has some really great developers. A few days ago in a PR review, I came across: const formatNumberFull = memoize(number => numeral(number).format("0,0")); Ummm... what? The Lodash docs gave me a little better understanding of what memoize does, but I didn't…

Dismissing Keyboards in React Native Views

When using a View in React Native, you don't have any control over the keyboard. So, if the view has an input field and the user taps away from the input field, the keyboard will remain visible. The user has no way to get rid of the keyboard. { failureMessage } { !loggingIn…

Partially Stashing Files in Git

Imagine that to run an app locally, you need to change a configuration file. No matter what branch you are currently on, this configuration file will need to remain the same. Let's call it config.js. Now, you're working on a topic branch feature-a and have 2 edited files (a…

Adding to Redux-form FieldArray

Imagine you're creating a form that needs multiple discount codes for a checkout process. In React/React Native, you might use a FieldArray from the redux-form library. It could look something like this: Submit export const discounts = ({ fields }) => ( {fields.map((code, index) => ( fields.remove(index)}> × ))} fields.push()}> Add {!fields…