Eventually Consistent

Dispatches from the grey area between correct and working

Blog

Thoughts on web development, programming, and technology. Sharing what I learn along the way.

git

Git Reset

Oh, the usefulness of git reset. It works in two modes: The first mode modifies the "index" and the working-tree, moving around files similarly to git add but in the opposite direction. The second mode affects the tip of the branch, effectively undoing commits.

Read more
node

Streams

Touted as Node.js's best feature, streams are also one of the hardest to comprehend. Some of the mystique that surrounds streams is the lack of good documentation; there are plenty of online examples that show how to use pre-built stream objects (like and http request) but less on how to create custom stream objects that work within an application.

Read more
databases

Amateur MySQL Optimizations

MySQL is not my strongest card. And rightly so. It is its own profession. People who are experts at MySQL are paid to be experts at MySQL. Everybody else just has to be somewhat familiar with the basic functions. However, sometimes these experts are nowhere to be found and you're left alone to design your own schema and perform your own optimizations. These are my experiences doing just that.

Read more
node

Node MySQL

Quick and dirty MySQL hacks: Check one tables entries against a join table, user a subquery in a where, check if an entry exists without actually checking, make a quick array with group_concat

Read more
css

Netflix Star Rating with Sibling Selectors

I was asked to build a Netflix/Amazon like star rating UI at a job interview recently and the interviewer implied that it could be accomplished completely with CSS. Even though I bombed that interview I still pursued this question and Im happy to say we can make a Netflix UI using radio buttons and child selectors.

Read more
css

A Simple, Bootstrap-like Responive Grid

Bootstrap is usually my starting point when I approach a project (and if you have looked at my projects you would see that right away). I use it because it covers pretty much all my CSS bases and that leaves me time to focus on other parts of the project, like the javascript logic or polishing the UI.

Read more
javascript

Knockout Mapping

One thing I really like about Knockout is that it doesn't lock you into using any particular implementation for features that other frameworks might. In fact Knockout is arguably a library in that sense. So to get some functionality you have a choice of plugins (or you could just write your own). This is a look at the Knockout Mapping plugin.

Read more
node

Building an Express Blog Application

I'm in the process of rewiring the backend for Ethernet Bucket using Express. If you don't know what express is, here's a good primer. The goal today is to write something that can take blog entries in MongoDB (that part not covered) and turn them into web pages.

Read more
node

APIs with Node

With a little work, node can be used as a complete web server, but it's probably something you shouldn't do. Node's speed is limited when it comes to traditional web-server applications because it runs inside an interpreter (like all javascript) and just wont be as as fast at things like reading from disk.

Read more
node

HTTP Handler Function

A good jumping-off-point when writing your node server is to use a handler function to route all HTTP requests to their proper functions. If you write functions that are specific to a url such as providing a web service that reads from a database and then writes back XML or JSON you can use an if-else block or a switch block to route the request to the function.

Read more
javascript

Beginning Ajax

Ajax is a method of using Javascript to load resources without causing the page to be refreshed. Traditionally when you click a link on a webpage, the browser asks for that page and renders it in place of the previous page. Ajax offers an alternative for situations when page refreshes aren't ideal.

Read more
html

HTML5 ClassList

It used to be pretty difficult to add and remove classes from page elements. Using vanilla JS required making a regular expression to search the elements class attribute for a match. JS libraries simplified the process but now HTML5 makes it even easier

Read more
html

HTML5 Dataset

Dataset allows for valid use of custom HTML attributes, prefixed with "data-" Before HTML5 you could use custom attributes at will but it would not be valid HTML. One of the things dataset does is make this practice pass validators and it allows for more easy access of custom attributes with javascript.

Read more
node

Node Server

As a web developer, building a node server has a lot of value not only in terms of gaining node programming skill, but also in understanding how web servers and fundamental web technologies such as HTTP work.

Read more