Command Line trash
One of the first commands you learn when experimenting with command line is
rm, the utility for deleting files and directories. Deletion is a core computer UI operation but operating systems use a "Trash" paradigm, where files are stored before truly deleted. With the
rm utility, however, files are immediately, permanently deleted.
If you're like me and afraid to automate permanent file deletion, you can opt for a utility named
trash. This nice Node.js library moves files to the trash instead of instant deletion.
// Install with `yarn add trash`
// Move a file to trash
const trash = require('trash');
There's also a
trash-cli package for using the utility from command line:
yarn add trash-cli
trash unicorn.png rainbow.png
trash '*.png' '!unicorn.png'
rm can be really harsh so having a
trash utility is helpful in providing users a file deletion paradigm that they're used to.
Sooner or later you'll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...
David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...
CSS is a complete conundrum; we all appreciate CSS because of its simplicity but always yearn for the language to do just a bit more. CSS has evolved to accommodate placeholders, animations, and even click events. One problem we always thought...
One of the quickest and easiest website performance optimizations is decreasing image loading. That means a variety of things, including minifying images with tools like ImageOptim and TinyPNG, using data URIs and sprites, and lazy loading images. It's a bit jarring when you're lazy loading images and they just...