Tilo Mitra

Front-end Engineering | UI Development

March 7, 2014

Quotes from Rework

back-coverI finished reading Rework by Jason Fried and David Heinemeier Hansson a few days ago. It’s a great book – easily the best business book that I’ve read. Here are a few quotes from the book that I saved:

On Building Things

When good enough gets the job done, go for it. It’s way better than wasting resources or, even worse, doing nothing because you can’t afford the complex solution. And remember, you can usually turn good enough into great later.

The way you build momentum is by getting something done and then moving on to the next thing.

The real world isn’t a place, it’s an excuse. It’s a justification for not trying. It has nothing to do with you.

The perfect time never arrives. You’re always too young or old or busy or broke or something else. If you constantly fret about timing things perfectly, they’ll never happen.

Just because you’ve still got a list of things to do doesn’t mean it’s not done. Don’t hold everything else up because of a few leftovers. You can do them later. And doing them later may mean doing them better, too.

Is there an easier way? Whenever you’re working on something, ask, “Is there an easier way?

On timelines

The longer something takes, the less likely it is that you’re going to finish it.

Ask yourself, “What can we do in two weeks?” And then do it. Get it out there and let people use it, taste it, play it, or whatever. The quicker it’s in the hands of customers, the better off you’ll be.

Keep breaking your time frames down into smaller chunks. Instead of one twelve-week project, structure it as twelve one-week projects.

If you want to do something, you’ve got to do it now. You can’t put it on a shelf and wait two months to get around to it. You can’t just say you’ll do it later. Later, you won’t be pumped up about it anymore.

Give up on the guesswork. Decide what you’re going to do this week, not this year. Figure out the next most important thing and do that. Make decisions right before you do something, not far in advance.

There’s always enough time if you spend it right. And don’t think you have to quit your day job, either. Hang onto it and start work on your project at night.

On Products

Build half a product, not a half-assed product.

Pour yourself into your product and everything around your product too: how you sell it, how you support it, how you explain it, and how you deliver it. Competitors can never copy the you in your product.

Don’t shy away from the fact that your product or service does less. Highlight it. Be proud of it. Sell it as aggressively as competitors sell their extensive feature lists.

Emulate drug dealers. Make your product so good, so addictive, so “can’t miss” that giving customers a small, free taste makes them come back with cash in hand.

rework-imagesWhen you start anything new, there are forces pulling you in a variety of directions. There’s the stuff you could do, the stuff you want to do, and the stuff you have to do. The stuff you have to do is where you should begin. Start at the epicenter. The way to find the epicenter is to ask yourself this question: “If I took this away, would what I’m selling still exist?”

What problem are you solving? What’s the problem? Are customers confused? Are you confused? Is something not clear enough? Was something not possible before that should be possible now? Is this actually useful? Are you making something useful or just making something? It’s easy to confuse enthusiasm with usefulness.

On Customers:

When you stick with your current customers come hell or high water, you wind up cutting yourself off from new ones. Your product or service becomes so tailored to your current customers that it stops appealing to fresh blood. And that’s how your company starts to die.

People and situations change. You can’t be everything to everyone. Companies need to be true to a type of customer more than a specific individual customer with changing needs.

Earning their [your customers'] loyalty by teaching them forms a whole different connection. They’ll trust you more. They’ll respect you more. Even if they don’t use your product, they can still be your fans.

You want your customers to say, “This makes my life better.” You want to feel that if you stopped doing what you do, people would notice.

The core of your business should be built around things that won’t change. Things that people are going to want today and ten years from now. Those are the things you should invest in.

On Competitors

Instead of trying to outspend, outsell, or outsponsor competitors, try to out-teach them. Teaching probably isn’t something your competitors are even thinking about. Most businesses focus on selling or servicing, but teaching never even occurs to them.

On Pitching

What do you call a generic pitch sent out to hundreds of strangers hoping that one will bite? Spam.

On Learning

Another common misconception: You need to learn from your mistakes. What do you really learn from mistakes? You might learn what not to do again, but how valuable is that? You still don’t know what you should do next. Contrast that with learning from your successes. Success gives you real ammunition. When something succeeds, you know what worked–and you can do it again. And the next time, you’ll probably do it even better.

Rework is a great book and I highly recommend buying it. There’s a lot more inspiration between the covers. Go to the Rework website or the iTunes BookStore and pick up a copy.

March 6, 2014

SailsJS with Handlebars

Sails and Handlebars sitting in a tree

The Problem

I like SailsJS. I’ve been using it for a pet project recently and it’s a great way to create all the boilerplate for a webserver. I definitely prefer it over starting an ExpressJS server from scratch.

Sails has a lot of pros. I love the model/controller scaffolding, Waterline, using middleware as policies, and enforcing API-driven development. However, I’m a big fan of Handlebars and I really don’t like EJS so I thought that was going to be a blocker for me.

Fortunately, I have a little hack which lets me use Handlebars with Sails. Before starting down this path, I took a look at the StackOverflow answers on how to get SailsJS working with Handlebars. None of the replies seemed suitable to me. Most require you to pass in your layout and partials properties to every res.view() call. There isn’t much information on using Handlebars Helpers either. What I wanted was to just do this:


res.view();

And I want it to pull the correct layout and all the available partials. I also want it to be able to read in the correct Handlebars Helpers. All the benefits that Sails + EJS gives you, except using Handlebars instead.

The Solution

The solution was hidden inside Christopher Pappas’ closed pull request. I used his code to modify Sails Core to use express3-handlebars. If you want to use Handlebars as your view engine, modify your config/views.js to this:


module.exports = {
  engine: 'handlebars',
  layout: 'main.handlebars', //whatever your default layout is
  helpers: require('./helpers') //pull in your helpers (I store it in config/helpers.js)
}

Here’s how you should structure your views/ directory:


views/
  layouts/
    main.handlebars

  partials/
    partial1.handlebars
    partial2.handlebars

  controller1/
    action1.handlebars
    action2.handlebars

All the partials within the root partials/ directory will be available for use in any view.

Installation

Remember that this is a hack that has only been tested in Sails 0.9.9. Sails 0.10+ introduces some changes to how view engines are created, so this code won’t work there as-is, but it shouldn’t be hard to port over.

In terms of installation, I am pulling in Sails from my Handlebars branch. Here’s what my package.json looks like:


//within package.json
"sails": "git://github.com/tilomitra/sails.git#handlebars"

Then, instead of installing Sails globally via npm -g install sails, I install it locally via npm install sails. This pulls in my Handlebars-enabled version of Sails from GitHub.

I know this isn’t acceptable for a lot of people, but it did the job for me. One notable flaw is the inability to update as Sails updates. However, the only file that I modified was hooks/views/index.js, so it’s not hard to port it over. I will be trying out Sails 0.10.x eventually because it has support for model associations (something which I badly need), so I’ll post an update to this post if I am able to get Handlebars working with Sails 0.10.x.

Happy Coding!


Credit to Christopher Pappas who wrote the original code that made this possible, and to Balderdash for creating Sails.

December 14, 2013

Installing NodeJS on a DigitalOcean VPS

Lately, I have been hosting a bunch of NodeJS apps on DigitalOcean’s latest Ubuntu VPS. There are a bunch of articles online on how to set up NodeJS and npm on a VPS, but some of these articles are now outdated and others make things unnecessarily complicated. It’s actually pretty simple!

I used this guide to help me set up NodeJS and it’s worked flawlessly both times and was super-easy to set up. I recommend it to all the other newbies who are setting up Node for the first time.

I’ve been very impressed with DigitalOcean thus far and I recommend it to anyone who is interested in setting up a VPS.

Older Posts