The other day I was working on generating a handlebars template from an object of objects and came across a small but annoying issue. I needed to create a list of items, and each item template needed to be slightly different. Since handlebars conditionals only check a variable for being true, we can't use operators to divide the items into little "subtemplates".
For instance, let's say we have an object of menu items divided up into three types that each need a slightly different handlebars template.
Ideally, I would pass that object into a template like this:
Unfortunately this isn't an option with vanilla handlebars, instead you can only test a property's truthfulness, like:
As an example, let's use this JSON response as the data we want to use for our template.
If we want our menu item template to be populated by these mealItems in our object then appended to a div, we can send them through like this:
Now each mealItem will be passed to the template with it's food type as a property, so we now use it in our handlebars conditionals without forcing handlebars to fit our data.
A few days ago my ExpressionEngine install went haywire and I needed to get a quick blog up to avoid having a site full of broken links. I've used plenty of heavy CMS's for my blog before, and instead of a system to do the work for me I wanted something open that I could use as my "breakable toy". It didn't take me long to settle on Jekyll, the static-site generator created by Github founder Tom Preston-Werner.
I was happy to write an article for Smashing Magazine that describes basics of polygonal modeling as well as modeling on the web with ThreeJS.
Esquire recently released an article detailing the author of Proof of Heaven and his questionable claims and background. To supplement this type of story, they have implemented a per-article paywall. Unfortunately, it is not well implemented, easily passed, and ends up only charging the misinformed.
The Flexible Boxes (or Flexbox) specification in CSS3 is one of the newest solutions for making the development of responsive layouts easier and much more sane. The goal of the specification is to accomodate websites on a variety of screen sizes and resolutions, and be able to maintain structural integrity through switching between portrait and landscape modes, or other changes that may be out of the developer's control.
After finally transitioning away from using Codekit for my workflow and deciding on Gulp over Grunt for my task running due to its modularity and easy of use. I really love it so far, but as with any change in workflow there's always bound to be some kinks.
Here's a great article by Brad Frost about the new float label trend for forms. Unfortunately it seems it isn't so well supported in browsers yet and the possible accessibility issues make it a no-go for my current projects, but this is the kind of thing that can create some really clever UI for sites that only target those with the newest tech or if you're just looking to make some fun proof of concept demos.
I was happy to write an article for the fantastic Smashing Magazine that delves into the basics of polygonal modeling and bridging into modeling on the web with ThreeJS.