Introducing QUnit Data Providers

About two years ago at Synacor a couple of teams started using QUnit as our JavaScript unit testing library.  It was well received, and more developers started contributing tests.  As the test suite grew, however, we noticed a missing feature that we utilized in our PHPUnit tests – data providers.  The lack of data providers was forcing us to copy boilerplate between test cases in a particular module.  To fix this we created QUnit Data Providers.

Continue reading

Extending Existing Lo-Dash Functions

I recently wrote a post on how to extend Lo-Dash with new functions using _.mixin. The Lo-Dash docs have code samples that include adding new functions into their namespace, but what can you do to enhance an existing function?

I decided to investigate what patterns could be utilized to add features to existing functions. I also decided to revisit a problem recognized in an earlier post – allowing callbacks triggered by _.result to receive parameters.

Continue reading

5 Lo-Dash Functions for Fun & Profit

(Alliteration somewhat intended)

The event-based and asynchronous architecture of JavaScript creates a number of common patterns in applications that are repetitive, difficult to test, and somewhat sloppy. Every now and again, a solution will arise that changes the way you write code, and it becomes an indispensable part of the programmer’s arsenal. Take jQuery for instance — a library that greatly simplified DOM access and manipulation. Then came promises – the ability to structure asynchronous requests in a synchronous fashion. For functional programming utilities and more intuitive object manipulation, Underscore.JS was created. These three libraries are principal components of almost any JavaScript application.

Today we have Lo-Dash — the younger, more aggressive sibling to the well-established Underscore.JS. Created by John-David Dalton, Kit Cambridge, and Mathias Bynens, the library boasts additional features, bugfixes, and performance improvements over Underscore.JS. These are not trivial boasts, as Lo-Dash comes from some of the same developers behind Benchmark.JS and Let’s look at several features in the Lo-Dash/Underscore arsenal that can help save time when writing your next application.

Continue reading

Introduction to Web Fonts

With the introduction of Web Fonts into the browser mainstream, designers have gained access to a large quantity of design techniques that had only been possible using image replacement.  The CSS3 Web Fonts module offers us an opportunity to rethink the way we style a site, and I for one am quite eager to begin taking advantage of it.

Continue reading

Enabling SSH Connections to a VirtualBox Guest OS

I felt the need to propagate to the interwebs a good resource I found today for setting up SSH to a guest OS using a host-only network:

I am running VirtualBox 4.1.4, but the blog entry is still quite relevant.  The only difference is how to set up a host-only network.  In the VirtualBox Virtual Machine Manager, under menu option File choose Preferences.  Click the “Network” tab in the window that follows, and then you will see an interface for adding host-only network adapters.

The default network address is still, so the everything after that is applicable.