Part time hacker, full time dad.

Last week in Menlo Park was the first ReactJS conference, hosted by Facebook. I had the honor of being on the Flux Panel with some amazing developers. Bill Fisher did an excellent job preparing us for the panel and moderating, and it is chock full of nuggets of wisdom from those of us building some of the largest React+Flux apps. Topics include Relay vs Flux, isomorphic apps, maintainability, and approaches to data fetching.

Ever wish for hg diff in side-by-side view? I find it much easier to scan, assuming you have the horizontal real-estate in your terminal. Here is a simple guide to setting up side-by-side diffs in Mercurial on Linux/OSX: (more…)

The following demo pretty prints the entered text to the desired line width by making the lines as even as possible. The demo uses a dynamic programming algorithm to choose line breaks in such a way that the sum of the squares of the slack is minimized.

The purpose of the code is to find elements that can be translated, but haven’t been already. My suspicion was on the .not() addition, and lo and behold, inlining the clause into the first selector dramatically increased performance:

Following is a function that given a string and a search query will wrap bold tags around search terms that were found in the query:

Example:

text = “The theory of the big bang was proposed in…”
query = “Big Bang Theory”
result = “The <b>theory</b> of the <b>big</b> <b>bang</b> was proposed in…”
result as html = The theory of the bigbang was proposed in….(more…)

For my first post on TypeScript, I included many code samples, and found the Javascript highlighting to be lacking since TypeScript introduces a number of new keywords. To remedy, I’ve put together a simple plugin that adds a TypeScript brush to the SyntaxHighlighter Evolved plugin, using this excellent tutorial. Once installed, you can use the new tags to highlight your TypeScript code, either [ts][/ts] or [typescript][/typescript].

Microsoft recently released a new, open source language called TypeScript. It is a strict superset of Javascript, and compiles directly to Javascript. The compiler is open source, and written in TypeScript itself. My team at Microsoft has been dogfooding TypeScript for several months now, and I thought I’d share a few of my favorite parts of the language.

While debugging an MVC4 app, I ran into the following error: System.MissingMethodException: Cannot create an abstract class. It was only happening for a single Action, and I wasn’t able to set a breakpoint in that action. After some trial and error, I was able to find the issue in the code:

The goal was to have an T4MVC style helper for passing in an ActionResult instead of an untyped path. This was a bad idea, as ActionResult is an abstract class. When I hit http://localhost:2995/Account/Login, the MVC framework tried to instantiate ActionResult to fill in the default value for redirectAction. I simply reverted the parameter back to a string, and all was well.