As I Solve

Bulletproof solutions for the savvy developer.

Month: July 2013

  • Preload an array of images by data attribute

    View the code on Gist.

  • Interview for upcoming book

    Here’s a transcript of my interview with Lance Redgrave for his upcoming book, Cunningly Clever Business Online. Engineering for the web – why is it important? What are the most important factors that should be considered when engineering a website/platform? First you need to determine the balance between features and budget. Maintainability, extensibility, performance, and […]

  • Disallow File Uploads over 2Mb (or any size)

    A quick and easy jQuery snippet to find all file upload inputs & make sure users don’t upload files that are too large. Just include in your $(function(){ }); function $(‘input[type=file]’).each(function(){ $(this).on(‘change’, function() { //this.files[0].size gets the size of your file. if (this.files[0].size > 2097152 || this.files[0].filesize > 2097152) { alert(‘Your file is too large […]