ding!

By  on  

I've been working with beefy virtual machines, docker containers, and build processes lately.  Believe it or not, working on projects aimed at making Mozilla developers more productive can mean executing code that can take anywhere from a minute to an hour, which in itself can hit how productive I can be.  For the longer tasks, I often get away from my desk, make a cup of coffee, and check in to see how the rest of the Walsh clan is doing.

When I walk away, however, it would be nice to know when the task is done, so I can jet back to my desk and get back to work.  My awesome Mozilla colleague Byron "glob" Jones recently showed me his script for task completion notification and I forced him to put it up on GitHub so you all can get it too;  it's called ding!

Once you have ding, you can do cools stuff like:

# ding somecommand
ding docker-machine start default
ding ./start-local-environment
ding ./refresh-environment

If the task completes successfully, you'll hear a positive sound; if the command fails, you'll hear a more negative sound -- a simple, yet useful and meaningful detail.

There's not much to explain except that ding is awesome and should check it out!

Recent Features

  • By
    Create a CSS Flipping Animation

    CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there's...

  • By
    JavaScript Promise API

    While synchronous code is easier to follow and debug, async is generally better for performance and flexibility. Why "hold up the show" when you can trigger numerous requests at once and then handle them when each is ready?  Promises are becoming a big part of the JavaScript world...

Incredible Demos

  • By
    MooTools 1.2 Image Protector: dwProtector

    Image protection is a hot topic on the net these days, and why shouldn't it be? If you spent two hours designing an awesome graphic, would you want it ripped of in matter of seconds? Hell no! That's why I've created an image...

  • By
    Google Extension Effect with CSS or jQuery or MooTools JavaScript

    Both of the two great browser vendors, Google and Mozilla, have Extensions pages that utilize simple but classy animation effects to enhance the page. One of the extensions used by Google is a basic margin-top animation to switch between two panes: a graphic pane...

Discussion

  1. I wonder if an even better solution would be to use macOS’s “say” command since this is macOS specific script and “say” is always available. That way you wouldn’t have the requirement of keeping those two .mp3 files in the directory as the script.

    It’d be awesome if he made this brew installable as well :)

  2. Scott Rippey

    What a great idea! I’ve been using the say command as an audible indicator when my Docker builds finish, but this is way more convenient, and even reports errors!
    So here’s an alternative, which I put in my .bash_profile, and has no dependencies (other than macOS):

    ding() {
    	EXIT_CODE=$?
    	if [ $# -gt 0 ]; then
    		time $@
    		EXIT_CODE=$?
    	fi
    	if [ $EXIT_CODE = 0 ]; then
    		say Hooray
    	else
    		say We\'ve had a problem
    	fi
    }
    
    

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!