Tuesday, June 28, 2011
Javascript Array Sort Custom Comparator
Javascript Array.sort() allows you to define custom comparators!
var numbers = [10, 20, 5, -10, 30];
// Sorting in ascending order.
// Sorting in descending order
var numbers = [10, 20, 5, -10, 30];
// Sorting in ascending order.
numbers.sort(function(a, b){return a-b;});
// Sorting in descending order
numbers.sort(function(a, b){return b-a;});
Tuesday, June 14, 2011
i18n-translator: makes it easy to translate and verify
Translating strings using online-services for providing internalization support might be a fun job. However, you could end up with inconsistent translation. Verifying the translation across different services would helpful. i18n-translator could be handy tool for it.
Wednesday, June 01, 2011
PHP Performance Tuning: Watch out for notices, warnings, errors...
PHP error reporting like notices, warnings... adds performance overhead and would make it hard to trace. During development make sure to turn-on error_reporting (E_ALL) and fix the issues logged, it helps your code to reach production quality.