July 19th, 2011

This.Disabled = True Doesn’t Work in Chrome

A common way to prevent duplicate forms submissions caused by the user clicking the submit button twice is to do this: <input type="submit" value="Submit" onclick="this.disabled=true;"> This doesn’t work in Chrome. When the button is disabled, all events associated are halted including the form submission. Instead we had to do this: jQuery.fn.preventDoubleSubmit...

July 19th, 2011

Disallow Bad Robot User Agent in .htaccess

Thanks Guys: http://perishablepress.com/press/2010/08/09/2010-user-agent-blacklist/
July 7th, 2011

Codeigniter – CI Log_Path Problem

So, even though I don’t understand why this is happening, Codeigniter is unable to capture the path to the system/logs folder. Here is a way to set it manually in your config.php file: $config['log_path'] = getcwd() . '/' . SYSDIR . '/logs/';
July 7th, 2011

Set Default Timezone in PHP 5.3

PHP 5.3 throws an error if there is no default timezone set (the server timezone is unacceptable). You can do this from code if can’t get to your php.ini file: date_default_timezone_set('America/Los_Angeles');
June 20th, 2011

Thematic HTML5 child theme template

Here’s an easy way to get started using HTML5 in your thematic child theme. I threw this together on the quick, so it doesn’t cover all of the bases, but you can use it as a starting place for your next project. Download: thematicsamplechildtheme.zip Cool ideas generated from these guys: https://github.com/paulirish/html5-boilerplate https://github.com/sams/Thematic-html5boilerplate http://www.ejhansel.com/thematic-320-and-up/ http://camwebdesign.com/techniques/using-html5-with-your-thematic-child-theme/
June 10th, 2011

Avoid Hardcoded Urls in Javascript Files

var js_base_url = location.protocol + '//' + location.host;
June 10th, 2011

Flush Rewrite Rules in WordPress

Sometime url rewrite rules caching make development tasks unpredictable in wordpress. Here’s how you can force them to flush on every rewrite: //flushes rewrite rules on every page to make sure changes take function flushRules(){     global $wp_rewrite;        $wp_rewrite->flush_rules(); } add_filter('wp_loaded','flushRules');
June 2nd, 2011

Put Code on Forums

Many forums support special tags that allow developers to put sample code in their posts. Try using [code] [/code] and [php] [/php] to open and close code samples and see if you get nice formatting.
June 2nd, 2011

Fancybox Breaks Javascript Jquery or Ajax

Javascript bindings usually happen in the doc ready. Fancybox loads pages after the doc ready so none of the javascript bindings occur. The solution is to wrap the non-working javascript in the jquery .live() function which, will bind on the future loading of the page or iframe in the fancybox frame: $('#all_users .selectit').live('click', function() {    console.log("test");
September 13th, 2010

Enable IS_AJAX in Codeigniter

// Define Ajax Request define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');