Face Detection on OS X and iOS

Recently I realized that Apple added support for face detection in OS X Lion and iOS 5. Apple’s face detection is exposed through Core Image, the super-useful image manipulation library. Two classes are important: CIDetector and CIFeature (along with its subclass, CIFaceFeature). With a little experimenting one night, I was able to get a sample …

Gamma Gallery: A Responsive Image Gallery

Gamma Gallery is an experimental responsive image gallery that attempts to provide an adjustable responsive images approach taking its grid layout and the full slideshow view into account. Both the grid and lightbox are responsive. Gamma Gallery: A Responsive Image Gallery Experiment → Gamma Gallery Demo →

A Few New Things Coming To JavaScript (ES6)

ECMAScript 6 contains a few new features. Addy Osmani gives a nice overview of things that are about to come: Modules (which can replace the revealing module pattern we’re familiar with) and Module Loader Classes (which merely is some syntactic sugar) Object.observe() Default Parameter Values (again syntactic sugar as we already know how to work …

Content Security Policy — Preventing XSS Attacks Client-side

An extra measure to preventing Cross-Site Scripting has now become a standard ready to be implemented. It’s as easy as including a Content-Security-Policy header on your sites Content-Security-Policy: script-src ‘self’; img-src ‘none’ With the (example) policy above, external scripts and images won’t be loaded on your site. This new header however doesn’t mean you’re fully …

Logging client-side errors

function logError(details) { $.ajax({ type: ‘POST’, url: ‘http://mydomain.com/api/1/errors’, data: JSON.stringify({context: navigator.userAgent, details: details}), contentType: ‘application/json; charset=utf-8’ }); } window.onerror = function(message, file, line) { logError(file + ‘:’ + line + ‘\n\n’ + message); }; Let’s keep this short. Too few websites log JavaScript errors. Let’s build a simple system to track client-side errors. Makes clever …

PHP 5.5.0 alpha 1

PHP 5.5.0 alpha 1 was released a few days ago. New features include: support for Generators, a new password hashing API, support for finally in try/catch blocks, support for list() in foreach, constant array/string dereferencing, ext/intl improvement More info on these features can be read in Test Drive PHP 5.5: A Sneak Peek and What …