Notes on designing, developing and delivering great products

Gettin’ Freaky Functional w/Curried JavaScript

By on in Web

Partial application refers to the practice of filling in a functions parameters with arguments, deferring others to be provided at a later time. JavaScript libraries like Underscore facilitate partial function application – but the API isn’t for everyone. I, for one, feel icky sprinkling calls to _.partial and _.bind throughout my application.

Curried functions (found in Haskell and supported by Scala, among others) can be partially-applied with little ceremony; no special call format is required. In this blog post, I’ll demonstrate an approach to currying JavaScript functions at the time of their definition in a way that enables partial function application without introducing lots of annoying parens and nested function expressions.

Continue reading …

Vintage Terminal Effect in CSS3

By on in Web

Recently I revamped my personal website. For the most part I kept it simple, having it generated by Middleman with styling and layout provided by Bootstrap. However, I wanted my header to reflect my love of the command-line and 80s nostalgia by having it act like a vintage terminal similar to Cathode app: scanlines, screen burn, green glow, with blinking cursor. Most importantly, I wanted to do it with CSS3 animations and no Javascript to minimize the impact on browsers. Building on the work of Lea Verou and Anders Evenrud, here’s how I did it. Continue reading …

Tidying Up a JavaScript Application with Higher-Order Functions

By on in Web

Higher-order functions are functions that can do one or both of the following:

  1. Take a function or functions as arguments
  2. Return a function as an argument

Most programmers by now are familiar with higher-order functions such as map, reduce, and filter. These functions abstract away the boilerplate when processing collections. For example…

Given a string-capitalizing function and an array of arrays of strings:

function capitalize(s) {
  return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();

var fruitsOfTheWorld = [
  ["apple", "pineapple", "pear"],
  ["manzana", "pera", "piña"],
  ["poma", "perera", "ananàs"]

…we can turn this:

var results = [], 
    i = fruitsOfTheWorld.length;

while (i--) {
  var j = fruitsOfTheWorld[i].length;
  while (j--) {

return results;

…into this:

return {

In this post, I’ll demonstrate the usage of higher-order functions outside of a collection-processing context – with the ultimate goal of reducing boilerplate code in your real-world applications (as filter did above). We’ll start with partial function application (facilitated by Underscore’s _.partial) and move on to writing our own higher-order functions.

Continue reading …

Composing Data Pipelines: (Mostly) Stateless Web Applications in Clojure

By on in Web

I describe building an application in a functional style as the act of composing many smaller, context-free functions into pipelines of data transformations which map from system inputs to outputs.


Compojure (a Clojure web application library similar to Bottle and Sinatra) represents this input as a simple, immutable hash map which is transformed through a pipeline of middleware functions to a new hash map representing an HTTP response. The code of the resulting application resembles one in which we’re applying a mapping function to values in a static collection rather than ones in which we’re working with HTTP requests. By favoring expressions over statements, immutable data and functions over mutable objects and methods, our web application will share many of the positive characteristics of its static sequence-mapping cousins – in terms of simplicity (we can think about each transformation step independently from others) and robustness (our functions are small; their behavior easy to reason about and test).

Continue reading …

How to write an RFP

By on in Everything Else

Requirements lemonade stand

You’ve got a software projectyou just need the resources to do it.

So you start writing an RFP (Request for proposal). You put down the budget, timeline and deliverables in an effort to properly scope the initiative. After all, you need to find the best qualified team which means you need to be as specific as possible.

Then, you sit back and read what you’ve outlined.

After your brain gets back to its normal speed, you realize that if you can’t keep yourself awake, you have little hope of keeping potential teams engaged long enough to gain interest in your project. Continue reading …

Adventures in Searching with Postgres: Part 1

By on in Database, Rails, Ruby

For a recent project, we built a live-search for over 60,000 records which used both simple pattern matching and full-text search. The records we needed to search were diagnoses that are used to assign patients to a therapy. I had never done full-text search or anything real-time with that many records, so I ended up doing a lot of experimentation. These posts will cover my experience, and I hope they’ll be of value to anyone implementing their own Postgres search.


The Problem

The records we were searching were International Statistical Classification of Diseases (ICD) codes. Each record consists of a 3-7 character code, a short description averaging 11 words, and a few other data and association fields (for this post, I generated 100,000 records matching the real ICD format). We needed to be able to search by code and description, and users would be changing their search query quickly to find the right record, so it needed to be responsive. In part one, I’ll cover the code search where a user enters one or more codes (which may be partial).

Continue reading …

Come hang with Carbon Five at Techweek LA

By on in Events

Interested in the current state of tech in LA and meeting key leaders in development, startups, media, fashion and more? Join myself and several Carbon Fivers from our Santa Monica office at Techweek LA, Nov 20-21st to hear from top thought leaders in LA and attend a variety of events and networking opportunities.

Register for the event through our City Partnership and get a 15% discount.

Techweek Los Angeles

Carbon Five will be participating in the judging of the Launch competition and hackathon where we see what next big thing will shape the future of LA and beyond. Interested in competing? Rally your team and apply today!

Techweek LA runs from Nov 20th – 21st in a custom built tent on the Santa Monica pier. Check out the full schedule and contact us if you want to meet up with one of our developers and designers at the event.


WebRTC Made Simple

By on in Web

WebRTC is a set of JavaScript APIs that enable peer-to-peer, realtime communication between web browsers. It offers some pretty amazing capabilities, but getting through even a basic introduction to it can be daunting. The variety of new APIs and protocols is a lot to digest. This post is a simple guide to getting up-and-running with WebRTC.


Continue reading …