BBG Prepares for The Secret Handshake Conference in NYC

The Secret Handshake conference makes its way to Art Directors Club in Manhattan, NY next week (Oct 2 & 3) and the team here at BBG is anxiously awaiting our trip out to the East Coast to once again meet with talented industry professionals and aspiring designers from all over the country.

Tickets are still available for professionals and students and includes a free three month premium membership on Skillshare among a ton of other perks.

Secret Handshake NYC Poster

The Secret Handshake has previously put on hugely successful conferences in San Francisco at Adobe and in Chicago at Morningstar and we know this year’s event in New York will be no different. The stellar line up of speakers includes designers, illustrators, animators, entrepreneurs, and HR professionals:

BBG is incredibly proud to be involved with such a valuable event for young and aspiring professionals across the creative community. We can’t wait to see those of you who are attending in New York and share insight, inspiration, and ideas.

Hike Conference San Francisco 2014 | Photo by Mona T. Brooks GitHub with Daniel Burka Hike Conference San Francisco 2014 | Photo by Mona T. Brooks

Posted By
Jason Schwartz

WordPress Object Cache

It is not unusual for WordPress to run dozens or even hundreds (yikes!) of database queries when putting together a page. What’s worse, these queries aren’t the sort from children’s bedtime stories. They’re the dirty ones, full of temporary tables, JOINs on JOINs on JOINs, generic data types, and insufficient indexing. They’re the MySQL equivalent of The Wire.

As traffic loads increase, these computationally-heavy operations can quickly lead to a bottleneck, making your site sluggish or bringing it offline altogether.

To get a better idea of your own database use (or abuse), install a plugin like Query Monitor, which puts detailed query stats in the admin toolbar.

If you’re nearing the limit of what MySQL can handle, there are a few basic things you should consider doing:

  1. Go through your plugins and deactivate and delete anything that isn’t being used.
  2. Set reasonable post limits (10 or fewer) for archive pages.
  3. If you have a custom theme, try to minimize the number of secondary queries being run inside The Loop.

Beyond that, well, that’s the purpose of this article: Object Caching!

WordPress has the ability to cache query results (and other key/value data) in memory for later retrieval so it doesn’t have to pester MySQL on repeat requests.

This can dramatically reduce the load on MySQL, while maintaining comparable speed.

The main disadvantage of Object Cache is that objects are, well, cached. This means that changes made in the backend might not be immediately reflected on the front end.

This can be a deal breaker for applications with transactional data like e-commerce sites, unless the code contains strategic calls to wp_cache_flush(). But for content-driven sites like blogs and portfolios, it can be the perfect solution.

Object Cache also takes over handling of “transient” data, which otherwise get stored in the wp_options table. This will both speed up plugins and themes that rely on the transient API, and also reduce bloat in the database (there is no automatic garbage collection process run against wp_options, so data remains forever, and ever, and ever… (unless the same cache key is requested again)).

WordPress Object Caching is designed with extensibility in mind. All it needs is an API for key/value storage and retrieval.

There are innumerable candidates for the job, so let’s just focus on some of the most common:


XCache is my favorite PHP opcode cacher (opcode cache, incidentally, will also speed up the execution of your PHP scripts in general).

It is lightweight, scalable, and supports the latest versions of PHP.

To get started, install the XCache PHP extension (available in most Linux repositories), tweak the INI settings* (variable cache is the relevant feature here), and restart PHP.

After that, you can then enable Object Caching in WordPress by installing XCache Object Cache Backend or a more comprehensive caching solution like W3 Total Cache.

If you have multiple sites running on the same server, you need to ensure you are running version 3.0.3 or later.

The XCache extension comes bundled with admin scripts you can copy to your web root to get an idea of how cache is being utilized. You should install this after it has been running for a while to see if the memory allocations need to be raised or lowered (just make sure you restrict access, and delete it when you’re done!). Remember, the memory settings are per-process, so don’t get carried away.


APC is another PHP opcode cacher, but it is no longer actively developed.

Unless you are running an older version of PHP or your hosting environment comes bundled with it, XCache is a better option.

To get started, install the APC PHP extension, tweak the INI settings, and restart PHP. You can install a standalone plugin like APC Object Cache Backend or, again, go with something like W3TC.

There remains, however, one excellent use case for APC: Facebook’s HHVM engine supports it out of the box! If you have already replaced PHP with HHVM, just install the APC Object Cache Backend plugin and you’re good to go.


Redis is a powerful key/value caching solution with support for multiple servers.

For complex web applications consisting of multiple servers, it is an ideal solution as the cache can be shared across more than one machine.

For more simple setups, it is a bit much, and noticeably slower than XCache or APC.

To get started, install the Redis server and PHP extension (if you are running HHVM instead of PHP, the “extension” is built-in). Once you have that configured, you can install the Redis Object Cache plugin.

Posted By
Josh Stoik

New Work: 4C Insights

BBG is excited to announce the launch of 4C Insights‘ new website.

Just in time for their feature in Crain’s, 4C’s new site gives visitors a complete perspective of the specialized tools and solutions available.

4C is a data science company that’s leading the convergence of TV and digital media with software for advertisers, agencies, media companies, and content owners. See what 4C CMO Aaron Goldman had to say about the project on our testimonials page.

BBG refined 4C’s color palette, designed a new art direction and web presence, and did photography for their leadership team and office. You can get a better feel for the interactions by visiting 4C’s live site.

4C Insights Index


4C mobile


4C internal pages


Chicago river view


4c group work


4c meeting room


4c workstation


4c computer screen

Posted By
Jason Schwartz

How-To: Uncle Goose Create-a-Name

An exciting part of last year’s Uncle Goose redesign was the “Create-a-Name” block generator. This had been the most user-requested feature, so it was important for us to make it happen.

Uncle Goose wanted a simple, intuitive way for customers to order individual blocks from one of three sets, and have each block’s color be customizable.


Here’s a look at how we built it.


First, let’s get our container set up. We need a text input so people can type in the letters they want. We also have an empty div where our letters will be stored.

The class set-* will dictate which set style the letters have. The data-set attribute will store the set information for use in the shopping cart.

<div class="container letters-container">
	<input type="text" class="create-a-name-text" maxlength="26" id="create-a-name-text" placeholder="Enter text" autofocus />
	<div class="letters set-abc clear" data-set="set-abc"></div><!-- /.letters -->
</div><!-- /.container.letters-container -->

We also need a way for the customer to select which set they want:

<div class="set-selector">
	<select id="set-filter">
 		<option selected value="set-abc">Classic ABC</option>
 		<option value="set-upperlower">Upper Lower</option>
 		<option value="set-lower">Lowercase</option>
 </div><!-- /.set-selector -->

We also need to store all the info about which blocks and options the customer has selected. We’re going to use a link with all the data stored in data-* attributes that can be parsed by the cart on submission. Our cart needs a product ID, which is just the WordPress post ID, a block quantity to calculate the price, and all the letter, set, and color details are stored in a product note.

<a href="#" class="add-to-cart btn green icon-cart" data-id="<?=get_the_ID()?>" data-qty="0" data-note="">Add To Cart</a>

Let’s get a template going for our letters. The template letter will be hidden but will be used by our javascript to create new letters on the fly. This is neater and simpler than writing out all this HTML in the javascript. We’re also going to store the color and set information in data attributes so they’re easy to use in our javascript later on.

We’re using PHP to import the SVGs we need for two of the sets. The third set has a solid background color so we can use CSS alone to style it.

<!-- This block serves as a template for any blocks we dynamically create. -->
<div class="letter-wrapper letter-template" data-color="" data-letter="" style="display: none">
 	<div class="letter-inner">
 	 	<?php @include(dirname(__FILE__) . '/img/filigree-abc.svg'); ?>
 	 	<?php @include(dirname(__FILE__) . '/img/filigree-lower.svg'); ?>
 	 	<span class="letter"></span>
 	</div><!-- /.letter-inner -->

 	<div class="color-select">
 	 	<div class="color-option blue" data-color="blue">Blue</div>
 	 	<div class="color-option green" data-color="green">Green</div>
 	 	<div class="color-option orange" data-color="orange">Orange</div>
 	 	<div class="color-option yellow" data-color="yellow">Yellow</div>
 	 </div><!-- /.color-select -->
</div><!-- /.letter-wrapper -->


Now that we have a letter going, we can start styling it. We’re going to use ems for all our size values since eventually the font size of the blocks will change dynamically, and we want the blocks to be sized accordingly.

We need a letter wrapper with a width of 2ems, and a :before with top padding of 100% to both preserve our aspect ratio, and to position the color selection element more easily. The letter wrapper also has an active state for when the color selection tool is active. Let’s set backface-visibility: hidden to avoid repainting issues, and set some basic transition properties. For browsers that support it, we can also warn them that this element is going to have some transforms applied to it.

.letter-wrapper {
 	position: relative;
 	display: inline-block;
 	width: 2em;
 	margin: 0 0 0.5em;
 	z-index: 1;

 	cursor: pointer;

 	transition: all 0.3s;
 	backface-visibility: hidden;
 	will-change: transform;

 	&:before {
 	 	display: block;
 	 	padding-top: 100%;

 	 	content: '';

 	&.is-active {
 	 	z-index: 2;

 	 	transform: translateY(-0.75em);

 	 	transition: all 0.3s;

.letter-inner is going to be our block-looking element. We’re going to position it absolutely in the wrapper, give it a base background color, a box shadow, and a border radius. All styles for elements inside .letter-wrapper are nested inside .letter-wrapper in our Sass file, so we can sanely group together modifications based on the set chosen or any state changes.

.letter-inner {
 	position: absolute;
 	top: 0;
 	left: 0;
 	right: 0;
 	bottom: 0;

 	background: #feedda;
 	box-shadow: 0 -0.1em #feedda;
 	border-radius: 0.075em;

&.bounce .letter-inner {
	animation: bounce 0.5s;

This part of the block also gets a bounce animation during certain interactions. Let’s write that up now.

@keyframes bounce {
 	0% { transform: translateY(0); }
 	33% { transform: translateY(-0.25em); }
 	66% { transform: translateY(0.06em); }
 	100% { transform: translateY(0); }

For the blocks’ filigree, we have two SVGs that we’ll be toggling depending on which set is chosen. In an ideal world, we could use an SVG sprite and change viewBox with CSS, but at this time we can only do that with javascript. We already have a ton going on in javascript so let’s avoid adding more complexity to that file. Since we need to be able to dynamically change the SVG’s fill color, we can’t use one SVG as regular background image sprite either. So two files it is.

svg {
 	position: absolute;
 	top: 0;
 	left: 0;

 	display: none;
 	width: 100%;
 	height: 100%;
 	border-radius: 0.075em;
 	transition: all 0.3s;

Let’s place the actual letter in the middle of our block. We’ll be making some adjustments to individual letters based on the set/x-height later to make sure all letters are always centered, but for now let’s get the basics down.

.letter {
 	position: absolute;
 	top: 50%;
 	left: 50%;

 	text-transform: uppercase;
 	color: #fff;

 	transform: translate(-50%,-50%);
 	transition: color 0.3s;

Now that we have the basics of a block down, we can style the different block colors and different sets. Let’s leverage Sass and set up some color variables so we can easily loop through each one.

// block colors
$blockColors: (
	'blue': #3b83db,
	'green' : #81c81b,
	'orange': #ff900c,
	'yellow': #f5c008

@each $name, $color in $blockColors {
	&.#{$name} {
		svg { fill: $color; }
 		.letter { color: $color; }
 		.set-upperlower & .letter-inner { background: $color; }

.set-abc & {
	.filigree-abc { display: block; }

	.letter {
		top: 49%;
		left: 51%;
		font-family: "Century Schoolbook", sans-serif;

.set-upperlower & {
	.letter {
		top: 48%;

		margin-top: -1px;
		font-family: "Century Gothic", sans-serif;

		color: #feedda;
		font-size: 1.75em;

.set-lower & {
	.filigree-lower { display: block; }

	.letter {
		margin-top: -0.125em;
		font-family: "Century Gothic", sans-serif;
		text-transform: lowercase;

	&.letter-high .letter { margin-top: -0.02em; }
	&.letter-low .letter { margin-top: -0.175em; }
	&.letter-mid .letter { margin-top: -0.1em; }
	&.letter-a .letter { margin-top: -0.12em; }

You may have noticed some letter-based modifications on the lowercase set. Once the letters are all lowercase, while their baselines may line up, they don’t look centered in the block’s face. In our javascript, we will assign classes to the block based on the letter typed and adjust its positioning accordingly.

The last thing we need to style is the color selection tool. It’s a basic menu, with a triangle pointing toward its block and some color indicators.

.color-select {
	position: absolute;
	display: none;
	padding: 5px 0;
	margin-top: 0.4em;
	left: 50%;
	z-index: 1;

	background: $black;

	text-align: left;

	transform: translateX(-50%);
	backface-visibility: hidden;

	// triangle
	&:before {
		position: absolute;
		top: -19px;
		left: 50%;
		margin-left: -10px;

		border: 10px solid transparent;
		border-bottom-color: $black;

		content: '';

	.color-option {
		padding: 5px 15px;

		white-space: nowrap;
		@include font-size(18); // font-size mixin which spits out both px and rem

		transition: background 0.3s;

		// color bullet
		&:before {
			display: inline-block;
			width: 8px;
			height: 8px;
			margin: -5px 10px 0 0;

			border-radius: 50%;

			content: '';
			vertical-align: middle;

		@each $name, $color in $blockColors {
			&.#{$name}:before {  background: $color; }

		&.is-active { background: $grey-darkest; }


Now let’s switch over to javascript. First off, we know a lot is going to happen in this generator, so let’s set up a basic structure to our file. We can fill in the functions later. We’ll need two lock variables for controlling when events can happen, one for resize, and one for the various functions that can happen to a block. We also need functions for interactive, resize, add/edit blocks, opening/closing the color selection UI, color selecting, changing the set, and updating the cart information.

 	var createAName = {

 	 	// Variables

 	 	resizeLock: null,
 	 	blockLock: true,

 	 	// Functions 

 	 	interactive: function() {


 	 	resizeEvents: function() {


 	 	addEditBlock: function(){


 	 	popColorSelection: function() {


 	 	colorSelection: function() {


 	 	changeSet: function() {


 	 	updateCreateAName: function() {



 	 	// bind interactive events

 	 	// resize events
 	 	$(window).resize(function(){ createAName.resizeEvents(); }).resize();


First off, let’s make some blocks. Inside our interactive function, let’s watch for typing on the input we created earlier, and trigger the addEditBlock function when someone types.


Before we can create the blocks, we need to strip out any non-alphabet letters, trim the length of the text if it’s beyond the max length, correct the letter case to match the set, check whether the letters typed have actually changed since the last input, and if there are any valid characters at all.

addEditBlock: function() {
	var name = $(this).val().replace(/[^a-zA-Z]/g, ''),   	//create a nice version of letters to play with
	    block_prototype = $('.letter-template'),          	//html template for a letter
	    block_wrapper = $('.letters'),                    	//the letters wrapper
	    block_set = block_wrapper.attr('data-set'),       	//the set we're using
	    block_colors = ['blue','green','orange','yellow'],	//colors

	    // group letters based on required position modification
	    block_letters_high = ['b', 'd', 'f', 'h', 'i', 'k', 'l', 't', 'B', 'D', 'F', 'H', 'I', 'K', 'L', 'T'],
	    block_letters_low = ['g', 'p', 'q', 'y', 'G', 'P', 'Q', 'Y'];
	    block_letters_mid = ['u', 'v', 'w', 'x', 'U', 'V', 'W', 'X'];

	//keep name short... 26 is plenty
	if(name.length > 26) {
		name = name.substr(0, 26);

	//correct the case
	if(block_set === 'set-lower'){
		name = name.toLowerCase();

	else {
		name = name.toUpperCase();

	//exit if nothing has changed
	if(name === block_wrapper.attr('data-name')) {
		return true;

	//if nothing has been typed, this is easy
	if(!name.length) {

Now for the meat of this function, actually making our blocks. When blocks are initially created, colors are assigned by looping through the color array. But customers can edit their inputted text, so if they’ve already made a color selection for a letter, edit the text, and that letter is still in their edited text, we want to preserve the color selection. And though we haven’t written these functions yet, we know we want to update the cart information, and trigger the resize functions to make sure the blocks are being sized properly.

	//if there are letters, let's figure out how to draw them
	else {
		//some more variables
		var letters = name.split(''),	//each letter
		    block_new = null,        	//new block
		    color_index = -1,        	//color
		    blocks_old = [],         	//all existing blocks
		    blocks_new = [];         	//all new blocks

		//store the old blocks in an array.
		if($('.letter-wrapper', block_wrapper).length) {
			$('.letter-wrapper', block_wrapper).each(function(){

		//cycle through each letter
		$.each(letters, function(k,v){

			//if there is an existing letter matching this one,
			//preferentially use it (this preserves color selections)
			if(blocks_old.length > k && blocks_old[k] !== undefined && blocks_old[k].attr('data-letter') === v){
			//otherwise let's make a new block
			else {
				//start with the prototype
				block_new = block_prototype.clone();

				var xHeight = 'letter-middle';
				//check what x-height based class we should assign to it
				if($.inArray(v, block_letters_high) > -1){
					xHeight = 'letter-high';

				if($.inArray(v, block_letters_low) > -1){
					xHeight = 'letter-low';

				if($.inArray(v, block_letters_mid) > -1){
						xHeight = 'letter-mid';

				//customize it
				$('.letter', block_new).text(v);
				$('.color-option.' + block_colors[color_index], block_new).addClass('is-active');
				block_new.attr({'data-letter': v, 'data-color': block_colors[color_index]});
				block_new.addClass('letter-' + v.toLowerCase());

				//and add to our list

			//and start over with the colors
			if(color_index + 1 === block_colors.length){
				color_index = -1;

		//now add each block to our set!
		$.each(blocks_new, function(k,v){
			//if this is not the last item, add a space
			if(k + 1 < blocks_new.length){
				block_wrapper.append(' ');

	//save the name so we can skip all this work for non-changey-keys
	block_wrapper.attr('data-name', name);

	//and update the cart data

	//one last thing, trigger resize events so the blocks get scaled correctly
	if(createAName.resizeLock) {

	createAName.resizeLock = setTimeout(function(){ createAName.resizeEvents(); }, 100);
}, // end addEditBlock

Let’s tackle the resizing. We want to fit as many blocks on one line as possible while maintaining legibility. We also want to make the blocks as big as possible up to a certain point. So we need a min and a max font size, and figure out what size in that range our blocks should be given the container size and the amount of blocks. Let’s also include a little wiggle room so the blocks aren’t flush up against the container, and we need to account for the fact that the blocks are 2ems wide, so our final font size will actually be half the number we come up with.

resizeEvents: function() {
	var containerWidth = $('.letters').width(),                      // container width
	    letterAmount = $('.letters').find('.letter-wrapper').size(), // how many letters do we have
	    baseSize = containerWidth / letterAmount,                    // how wide can the blocks be to still fit in the container
	    wiggleSize = (baseSize - (baseSize * 0.15),                  // wiggle room
	    fontSize = wiggleSize / 2,                                   // blocks are 2ems wide, so font size is half size of block
	    maxSize =  96,                                               // max font size
	    minSize = 38;                                                // min font size

	if(fontSize > maxSize) {
		fontSize = maxSize;

	if(fontSize < minSize) {
		fontSize = minSize;

	fontSize = Math.floor(fontSize);

	$('.letters').css('font-size', fontSize + 'px');
}; // end resizeEvents and end 

Now that we’ve got the basics of block making and resizing down, we can work on the options. First up, let’s add a triggering mechanism to our interactive function for changing the block set.

$('#set-filter').on('change', function(){
	var oldSet = $('.letters').attr('data-set'),
	    newSet = $(this).val();

	createAName.changeSet(oldSet, newSet);

And let’s fill out our changeSet function. We want to remove the old set’s class and add the new one to all the letters, as well as update the case if necessary, and update the cart information.

changeSet: function(oldSet, newSet){
	$('.letters').removeClass(oldSet).addClass(newSet).attr('data-set', newSet);

	//update data so we're using the right case
	var block_wrapper = $('.letters');

	if(newSet === 'set-lower'){
		block_wrapper.attr('data-name', block_wrapper.attr('data-name').toLowerCase());
	else {
		block_wrapper.attr('data-name', block_wrapper.attr('data-name').toUpperCase());

	$('.letter-wrapper', block_wrapper).each(function(){
		if(newSet === 'set-lower'){
			$('.letter', $(this)).text($('.letter', $(this)).text().toLowerCase());
			$(this).attr('data-letter', $(this).attr('data-letter').toLowerCase());

		else {
			$('.letter', $(this)).text($('.letter', $(this)).text().toUpperCase());
			$(this).attr('data-letter', $(this).attr('data-letter').toUpperCase());

	//and update the cart data
}, // end changeSet

Moving on to color selection. The first step is to actually show the color selection menu when someone clicks on a block. We also want to close it when they click on the same block again, or on a different block. On top of that, we want to close open blocks when they click on anything that isn’t a block. To accomplish this, we’re using jQuery Outside Events to check whether a user has clicked outside an open block. This is also where our blockLock variable comes in. We just want to make sure we’re not triggering any outside events when there isn’t a block open, so we’re going to set blockLock to true initially, and set it to false when a block is open.

Let’s set up a block click event, and monitor outside events in our interactive function. As a note, anytime we’re binding an event to a block, we have to use .on() on the parent element rather than something like .click() on the element itself, since the blocks are dynamically created and .click() only binds to elements that are present when the event is first bound.

$('.letters').on('click', '.letter-inner', function(e){

// close block when you click outside of it
$('.letters').bind( 'clickoutside', function(){
	if(createAName.blockLock === false){
		$(' .letter-inner').click();

And now for our popColorSelection function.

popColorSelection: function(block){
	var parent = block.parents('.letter-wrapper');

	// if there is an active block but it is NOT the block we clicked on, close that block				
	if($('') && !parent.hasClass('is-active')){
		$('.color-select', $('')).fadeOut();

	// toggle active class, fade toggle the menu
	$('.color-select', parent).fadeToggle();

	// set our blockLock appropriately
	if(createAName.blockLock === true){
		createAName.blockLock = false;

	else {
		createAName.blockLock = true;
}, //end popColorSelection

Awesome. Now we can start doing all the things that need doing when someone changes the color. First up, let’s toss an event trigger in our interactive function and pass the block and menu item info to the colorSelection function.

$('.letters').on('click', '.color-option', function(e){
	var block = $(this).parents('.letter-wrapper');	
	createAName.colorSelection(block, $(this));

When someone selects a new color, we need to capture the old color, remove its class, add the new color class, update data-color attribute, and update the cart information. We also need to update the color menu to reflect the active color. The block also gets a little bounce animation when a new color is selected.

colorSelection: function(block, menuItem) {
	var currColor = block.attr('data-color');
	var color = menuItem.attr('data-color');


	block.removeClass(currColor).addClass(color).attr('data-color', color);
	block.addClass('bounce'); // add a bounce animation

	}, 500); // length of our bounce animation

	$('', block).removeClass('is-active');

	//and update the cart data
}, //end colorSelection

The last thing we need to do is build out our function that updates the cart information. It’s pretty simple. We just run through all the blocks and gather all the info we need, and pop it back in the cart button element.

updateCreateAName: function(){
	//build the add-to-cart data
	var block_wrapper = $('.letters'),
	    block_set = block_wrapper.attr('data-set'),
	    blocks = $('.letter-wrapper', block_wrapper),
	    qty = blocks.length,
	    notes = [],
	    button = $('.add-to-cart');

	//no quantity, we're done!
	if(!qty) {
		button.attr({'data-qty': 0, 'data-note': ''});

	//yes quantity
	else {
		notes.push($('#set-filter option[value="' + block_set + '"]').text());
			notes.push('[' + $(this).attr('data-letter') + '] ' + $(this).attr('data-color'));

		button.attr({'data-qty': qty, 'data-note': notes.join(';')});
}, // end updateCreateAName

That’s it. Be sure to check out the Create-a-Name generator on the Uncle Goose website, along with all their other awesome block sets!

Posted By
Tiffany Stoik