PIXELFLOW :: an intergalactic discourse


An Intergalactic Discourse

Parsley.js Error Box

I am Error

Recently while attempting to style a Google Form I needed to do some javascript validations before submission. I came across Parsley.js which makes it super easy, they even work with some standard html5 attributes like type=email and required

Radio Head

The default behavior of Parsley.js is to create a div with a list beneath each item with a validation error. This is fine except for a series of check boxes or radio boxes that are each padded by divs.

Magic Divs

Here is a slight modification of the stock Parsley error wrapper to search up the dom until it finds a parent which has an error div.

Rails Security Updates


To avoid ‘l33t hax0rs’, and generally keep your app purdy like its nice to know when you’ve got a vulnerability.

It’s also super nice when fixes are back ported, so that you can apply fixes without bumping major/minor version numbers.

I had to do so with Rails 3.1.x and all the application specific gems.


Since all my apps are on github, I used gemnasium.com which shows all out of date, and at risk gems in your Gemfile, and which versions contain fixes so you can estimate how much time needs to be spent updating.


Go do it. It’s easy

The colors Duke, the colors!

I’m Basically Obsessed with Graphs

I’ve always enjoyed oggling charts and visualizations. With the maturing of Javascript, SVG, and Canvas in the browsers there are now some great libraries out there. Github just started using D3 for all of their graphs.

Perceived Color INTENSITY

Color schemes for graphs out of excel can be pretty bland, and there are ways to get aesthetically pleasing color sets with predefined palettes like Tango or COLOURlovers which is a huge repository of color schemes.

However these, or just using linear interpolation between two colors or a color and white don’t do your data justice.

The gist is, colorspace doesn’t match your eyeballs, and equidistance colors in HSL don’t have the same lightness intensity. As best explained in this post over at vis4.

The best color system for this was originally the Munsell color system but CIELAB is now much more widely used.

Show me the benefits of the science

You can jump right in to some color palettes (which are also GIS friendly) at Color Brewer

Shiny things

Here are some more graph libraries worth investigating:

And a bunch of random tools here

And this guy does beautiful things in flash

Also. What you really came looking for:

Ruby Module Descendants

I want to track who included me

Module has a built in callback for when it is included in a class. self.included(klass) is called on the module directly after a class declaration which includes it.

But what about sub-classes?

Ruby has ancestors but not a direct way to look at descendant classes. However you can use ObjectSpace to iterate over classes, and use the < comparison or include? to see if a class has your module as an ancestor.

Arduino Rotary Encoder


When using mechanical buttons to trigger events on a micro-controller there can be some voltage spikes that can re-trigger whatever logic you have for that button.

The same goes for rotary encoders, which in case of this one at sparkfun is two ‘buttons’ 90’ out of phase from one another, thus allowing you to detect clockwise or counter clockwise movement.

We can tune it out

There are a few ways to filter out unwanted mechanical noise. Using capacitors to react to the sudden spikes, or in software. In software you can check the values in your main loop, but that can be troublesome if your loop includes a lot of logic.

The other two approaches involve interrupts. You can use a timer to poll the pins at a regular interval, or you can attach an interrupt to the change of each pin.

Lets do it!

Arduino cooking timer has a great example of polling based matching. I really liked his code but wanted to try to code my own since this is a learning experience for me.

By looking at the value of both pins when one of them changes, you can predict the next valid value. By ignoring any other values, you do a good job of filtering out any noisy values that happen during one turn of the knob.

Check out the source over at my git hub

Here’s a video of it in action!