Archives For bearfruit

Handlebars.js

“Handlebars” is a nickname for a fancy mustache. This pretty well embodies how Handlebars.js is a superset of the Mustache template library. Superset means that it has all the features of Mustache plus some extras. Like Mustache, Handlebars is a logicless template library. If you use a logicless template system after using tools like ASP or PHP you may feel there is a lot missing. It takes a little adjusting to, and one nice thing about Handlebars vs Mustache is that it makes the transition a little easier and more graceful.

Prior to my research for writing this series, Mustache was my favorite. I do still highly recommend it, but now I will be switching my work to using Handlebars.js. It has everything I like about Mustache, but it has a little better Javascript support, especially on the server side, and the conditional syntax is a little easier to use.

By the way, this is one part of a 5 piece series, so if you want to explore other options, don’t forget to visit the series start where I explain the biases and summary information and link to all of the tutorials.

Continue Reading…

Hogan.js

Mustache is described, simply, as “logicless templates.” The first time I used mustache I was pretty surprised at how minimalistic it was. And by surprised, I mean frustrated. You have extremely basic conditionals, an iterator loop and the ability to display information. There is no “if” (per se), no ability to call functions, mustache is not in any way a programming language.

You may think there is a lot missing, and there is, but this is not bad. It forces you to keep your logic all in one place, in the program. This increases the manageability of your code-base. It also allows Mustache to be easily ported to many programming languages. You can use it with Javascript, via Hogan.js, the library I used in this example, or Java, PHP, Ruby and numerous other languages.

By the way, this is one part of a 5 piece series, so if you want to explore other options, don’t forget to visit the series start where I explain the biases and summary information and link to all of the tutorials. Continue Reading…

jshtml

JSHTML provides an adaption of the razor view engine in Javascript. If you’ve used the Razor view engine for .Net languages then this could be the right template for you and your Node.js project. However, you’ll have to be more tenacious than I am, because the version bundled with Node.js is broken.

As a matter of fact, this will be quite a short review because I couldn’t find enough redeeming qualities to warrant the extra work to get it integrated.

By the way, this is one part of a 5 piece series, so if you want to explore other options, don’t forget to visit the series start where I explain the biases and summary information and link to all of the tutorials.

Continue Reading…

Screen Shot 2014-01-08 at 7.59.38 PM

EJS “cleans the HTML out of client-side templates.” From that description, you’ll quickly realize that EJS was at first a client-side template library. It has been repurposed successfully to also be a good server-side client library for Node.js.

In my opinion, using the word “clean” in the same sentence as EJS is a bit misleading. It does have the benefit of being included as part of the Express library for Node.js, which makes it easy to get started with, however like some other libraries, it lost functionality when Express made the jump to 3.0.

By the way, this is one part of a 5 piece series, so if you want to explore other options, don’t forget to visit the series start where I explain the biases and summary information and link to all of the tutorials.

Continue Reading…

Jade logo

According to the Jade website, “Jade is a terse and simple templating language with a strong focus on performance and powerful features.” Similar to Python, it uses indentation to help keep track of tag nesting which forces you to keep your markup looking clean. Because there are no closing tags, the end result is very concise. I suspect that if you used CoffeScript and Stylus, Jade would feel very comfortable.

Furthermore, it is the default template language enabled in new Express.js apps. Therefore it is commonly featured in beginners tutorials and documentation. At first glance I found it very confusing. The tutorial featured on the homepage is quite trivial, and therefore isn’t very representative of real-world work. However, there is decent documentation that you can dig into. You’ll find that much of the documentation focuses on standard HTML syntax and less on the dynamic capabilities.

By the way, this is one part of a 5 piece series, so if you want to explore other options, don’t forget to visit the series start where I explain the biases and summary information and link to all of the tutorials. Continue Reading…

Standing Ovation for Davey Richards

Recently I was using a Node.js library that incorporated EJS and I wondered what factored into the decision to choose that template engine over some of the others. I realized that because of my familiarity with Mustache, when I started using Node.js I immediately started with Hogan.js (see my tutorial on how to supercharge Hogan with Express) and I hadn’t checked out the other popular options. What are the differences between Jade, EJS, Hogan, Handelbars and JSHTML? I’d never used most of them in a real project.

I decided it was time to change that, and figured that if I were going to do the research I might as well share the results with you. I thought I could just make one long post but wow it turned out to be long so I’ve chosen to split it into 5 separate articles, which I’m linking below. Before we get into the specifics, let me take a moment to explain my biases and tell you what I value so you can use my comparisons to make your own decisions. Continue Reading…

Screen Shot 2014-01-13 at 7.46.06 AM

I have written a lot of non-fiction in my life. Documentation, tutorials, sales brochures, reports and more. Since I was a teenager I’ve wanted to write a novel, and recently I did. That novel is very rough, naive in so many ways, and probably needs a full rewrite.

I am continuing to write non-fiction, but while I am do so, I’m studying writing fiction, and as an exercise I wrote the following as a reason why I want to write: Continue Reading…

320px-Simple-kanban-board-

In the summer of 2013 a TED talk started making its way around the Internet discussing how to apply agile project management practices to the family. Then a Des Moines local agile coach, Kristin Runyan put the idea into action and blogged about it. This December, a coworker reported how he had seen benefits of this idea.

The timing of the December talk coincided nicely with some thoughts I had. For one, my wife and I have been frustrated with our 12 year old son’s lack of interest in doing the things he was supposed to do. Secondly, at work we completed a team member “work style evaluation,” essentially a personality test, and it caused me to realize that I think my son has a different personality and work style than either me or my wife.

We felt that this “agile family” method may work for us. Continue Reading…

stackmob-vs-firebase

Last night Des Moines Web Geeks had a code dojo focusing on Firebase, a tool I’d seen demoed by a few locals, including Brad Dwyer‎ from Hatchlings. In under 2 hours three teams each built a secret santa app using only client-side HTML5, CSS and Javascript. It was awesome.

Firebase makes this possible by providing an abstracted server side component accessible using a pure client-side javascript API. This is called a Backend as a Service (BaaS) or in some cases a Mobile Backend as a Service (mBaaS) platform.

Another BaaS I’ve used, and one that has been in the headlines this week, is Stackmob, which was just acquired by PayPal. I’ve used Stackmob and am quite fond of it. Now, having some exposure to both, I realize that Stackmob and Firebase are very different products offering unique types of services, even though both are considered BaaS products. I thought I’d write up a little comparison of the two. Continue Reading…

jetman

I’ve tried using Jetpack a few times on this blog and failed because whenever I try to enable it I’m unable to activate it with WordPress.com. I get an error xml_rpc-32700 and a message indicating that I’m special.

Well, maybe I am special. I host my website on a server using Nginx and Varnish. I did some searching and found some horribly unuseful suggestions, for example here, which essentially amount to disabling Varnish on the site, either temporarily or permanently. You don’t have to do this, you simply need to create a rule for your Varnish config that prevents caching of POST requests to xmlrpc.php. Here’s the code I used:

Inside of of the sub vcl_recv section of your varnish config add some code like this:


# Don't cache posts to /xmlrpc.php
if (req.request == "POST" && req.url == "/xmlrpc.php") {
    return (pass);
}

What this says is that if the request is a POST and the url is /xmlrpc.php then don’t return the cached version of the page.

Save your changes then restart or reload Varnish and voila, you can now activate your site with WordPress.com. I suspect this will also fix problems with Akismet as well.

And for those of you running a WordPress multisite, this works just fine.