Git-fu: List all commit messages from the last two weeks

git

Sometimes you want to see all of your commit messages based on time. This is one way to do it.

Which will output this

This example uses --since, you can also use --after, --until/--before, as well as formatted dates like --since="2011-06-1"

Editing in place with Backbone.js views

Backbone.js CoffeeScript JavaScript

Backbone.js is incredibly agnostic when it comes to…well…almost everything. You can persist your models any way you like at any time. You can use templates or not. You can bind Views to DOM objects or you can make a view render a DOM fragment and append it later.

The problem

With so many options you eventually end up writing a lot of boilerplate just to get things started. At that point, we start to abstract the common useful elements from our classes into a super class we can inherit from. This is the result of one such abstraction.

One solution

backbone-edit-in-place

With EditView, you can allow your users to quickly edit your model’s attributes and minimize overhead.

Continue reading

WordFinder 9000

CoffeeScript JavaScript

I don’t often get the chance or pleasure to use software to help my wife. One day while she was doing literacy work in Haiti, she presented me with a problem that seemed like my cup of tea.

The problem

We have a list of letters that should be known to students at various times throughout the year: through first grade, second grade, etc.

We also have a list of words from children’s books that contain more or less age appropriate words in stories.

What we need is a list of age appropriate words that are possible with the letters they’re learning.

— my wife

In addition to being really useful (think of the kids), the problem was interesting enough to keep me awake a little longer and boring enough for me to make it really interesting. Thus began the Word Finder 9000.

Continue reading

Success and error callbacks

CoffeeScript

I’ve heard some developers [who?] complain that writing error handlers isn’t ideal.

You can imagine if the success handler contains more logic and goes on to call other asynchronous functions it gets a bit hairy. But what if we simply started putting the error handler first? That would be a bit of a drag.

It’s not much in terms of work involved but it does take a process that handles errors as more than just a simple non-success.

Another way to go about it would be to define a default ajaxError handler via $.ajaxError(handlerFunction).

Create dynamic key javascript object with one line

CoffeeScript JavaScript

How many times have you done this?

man failing to use measuring tape

Continue reading

“Cut” and Paste files in Mac OSX finder

OSX UX

tldr;

Do this instead.

Copy with cmdc.
Paste with optioncmdv

Continue reading

Constant 403 error with nginx on osx

OSX

Problem

Despite checking permissions, nginx will return nothing but a 403 error page.

Solution

Added this line

Background

I installed nginx on my mac like everyone else using this guide, and it worked for my site until I changed the configuration to a different directory a second time. Something was different.

I started to get 403 errors, so I checked the logs and didn’t find anything more helpful than this.

After about 2 hours burned changing permissions on everything imaginable I found this guy, who figured out /usr/local/etc/nginx/nginx.conf, needs the user line to read

It was that simple!