I'm an experienced web developer, software engineer, and leader. Welcome to my blog. If you need to reach out you can continue the conversation with a tweet to @geedew. I hope you find what you are looking for here. You can also find me on Github and StackOverflow.

Remove a directory that is not empty in NodeJS

A quick pro-tip for handling this situation.

NodeJS provides an easy to use fs.rmdir command that follows the POSIX standard. This unfortunately means that it will error ENOTEMPTY if there is any file in the directory you are attempting to remove. NodeJS doesn’t have an easy way to force the removal, so you have to get fancy.

By far, the easiest, safest and most cross environment approach is to use rimraf whose source code shows nearly 250 lines of premium quality work.

It’s 2018, use del.

Or if you must, try trash. It’s really neat too.

/ / / Read More

Trimming Strings; Stripping Text in JavaScript

Strings are one of the most basic structures in any development language. Developing with strings happens in common ways across languages. Sometimes languages don’t offer the common gamut of tools and leave the developer to implement their own methods. One of these cases occurs with a proper strip method in JavaScript. JavaScript added the String.Trim[1] with EcmaScript5, which is a specialized version of a generic strip, so that leaves developers to implement it themselves.

/ / / Read More

Advanced button theming on jQuery UI Dialog - Update

Since my previous post, jQueryUI has updated as well as jQuery itself. The code is largely the same, but they did implement some of the usefulness that I proposed. Essentially, they added the ability to pass the name of the button as text, rather then as the key to a key->value pair object.

/ / / Read More

Unicode in Javascript: Closure Compiler blunders

1
> Uncaught SyntaxError: Unexpected token ,

When coding in JavaScript, as an english speaking citizen, unicode is rarely something that I think of. Recently though, I attempted to upgrade an Underscore package to version 1.3.3. This didn’t turn out as well as I hoped, I was immediately met with errors in the Javascript caused by using Closure Compiler in UTF charset mode. This could be avoided in the Underscore code, but it’s not entirely something they are to blame for. It has more to do with encoding a javascript file that has unicode literals in the code. When this is done, the u sequence becomes encoded and could possibly break your code, as I will demonstrate.

/ / / Read More