lab.joelgillman.com

Sketches, Code Bites and Toys



Friends
Links

Category Archives: Uncategorized

Escape User Input for JavaScript Regex

Escaping strings for regular expressions in JavaScript is pretty easy when you know what you’re doing. But say that the input is dynamic, possibly coming from an inexperienced user. That shit has got to be scrubbed! Unfortunately, there is no built in way to do that. Luckily it’s easy enough to add it in yourself.

Download a huge file using split and cat

I’ve got a decent internet connection at home sitting around 15 Mbps down. Not top of the line, but respectable nonetheless. I have a personal server that I use to store various files that generally range in size from 150 MB to 14 GB. Now if we lived in a perfect world the download would [...]

max-device-width CSS3 Media Query

CSS3 introduces Media Queries which are an extremely powerful way to customize your site depending on the media that is displaying it. Some people have trouble wrapping their head around the max-device-width query which is commonly used to differentiate between a desktop and mobile browser. To target CSS for the iPhone you would use (max-device-width:480px) [...]

Pseudo Work (fwork)

This script takes a text file (any text file should) and displays it one line at a time with short delays in between. In other words, you can run this script to make it look like your computer is actually doing something worthwhile. I had searched around the internet a few times but never really [...]



© 2012 jgillman -¦- Go WordPress! -¦- RSS 2.0 Feed