programming TIL

ExpressJS Mongoose Session Store

So as it happens, I use Express when I need to build a quick webapp in NodeJS, and I sometimes use MongoDB. I always use MongooseJS because I just find it easier to work with than the standard JS driver. So that works well for the most part. The one…

super-casper ghost theme on github

This theme wasn't very difficult to come up with, essentially I took the default Casper theme, found a theme I liked on http://bootswatch.com and combined them into one. Regardless, I figure there might be people even less inclined to do a lot of work on setting up their…

express4 example app

A friend of mine is considering delving into the realm of Node.js, but he like a lot of people can't quite conceptualize how Javascript will run on the server despite having programmed in JS for years now. This seems to be fiarly common and admittedly when I first started…

Port Redirect on Mac OSX Mavericks

For local development on my Mac I wanted to be able to not have to add a port after my development URL for http/https. I've done this on Linux before with iptables but didn't know if that was even a thing for OSX. Turns out the command isn't that…

aton and ntoa functions in node.js

Due to the lack of support for a IP address data type in MongoDB those who want to be able to search IP ranges have to come up with other ways to support this. One of the generally accepted ways to do this is to store the IP address as…

Regex for 24 Hour Time

A friend of mine asked for some help with a regular expression today that just needed to match 24 time that may or may not include minutes. A quick solution I had for JS was: var regexp = /^(?:[0-1]?[0-9]|2[0-3])(?::[0-5][0-9])?$/; If you atually wanted to capture hours…