I accidentally swap to a European keyboard layout. A lot.
[code]Left Alt + Shift[/code]
I accidentally swap to a European keyboard layout. A lot.
[code]Left Alt + Shift[/code]
Via Ryan McCue.
[php title="functions.php"] register_shutdown_function(function () { var_dump($GLOBALS['wp_current_filter']); });[/php]
If your gulp.js has a “watch” it’ll continue running to monitor changed files.
To exit back to the command prompt press Ctrl+C
In addition to cloning from Git and installing via Composer Laravel can now be installed via a PHAR file.
The documentation is currently a little Linux centric.
On Windows download the laravel.phar file, open a command prompt in its location and run:
[code]
php laravel.phar new my-project-name
[/code]
That will create a new directory called my-project-nameĀ and install Laravel in there. This is a lot faster thanĀ installing via composer.
PHP 5.4 came with APC (Alternative PHP Caching) which acted as both a byte-code cache (reducing the work of compiling the PHP files at runtime) and an in-memory object cache allowing the PHP app to store and retrieve arbitrary data.
PHP 5.5 is moving to Zend’s OpCache (bundled, but not enabled by default) which will replace APC’s function as a byte code cache. The gotcha is that OpCache does not (yet?) provide object caching that your app can use to store its own data.
So if you’re moving to PHP 5.5 you may find a bit of a black spot when it comes to an automatically included memory cache. APCu looks to provide the object caching of APC, but it does require extra installation.
Some WordPress sites aren’t for public consumption.
Chuck this in your functions.php
add_action('init', function() {
$uri = $_SERVER['REQUEST_URI'];
if(!preg_match('/wp\-(admin|login)/', $uri) AND !is_user_logged_in()) {
header("Location:" . get_bloginfo('url').'/wp-admin/');
exit;
}
});
The handy window.matchMedia JavaScript method lets you test a media query against the current viewport.
I made a little tool to test a batch of media queries at once. It simply iterates an array and reports success/failure.
Note that results won’t be accurate when a vendor prefixed media query is unsupported.
Write email addresses like this in your source to (hopefully) make them a little harder to scrape and spam:
[js]Need info? Email me: <span class="obs">info [at] example [dot] com</span>[/js]
Use jQuery like this to convert back to regular mailto links:
(Alter the selector as needed)
[js](function() {
var address;
jQuery(‘#content span.obs’).each(function(i, el) {
address = el.innerHTML.replace(/\[ ?at ?\]/g, ‘@’);
address = address.replace(/ /g, ”);
address = address.replace(/\[ ?dot ?\]/g, ‘.’);
jQuery(el).html("<a href=’mailto:" + address + "’>" + address + "</a>");
});
})();[/js]
I recently switched to Komodo Edit for coding. Like most editors it auto-detects the file language, however when editing a file with PHP and HTML Komodo will default to HTML4 which produces a lot of errors if you’re using new HTML5 elements.
Simply change the default HTML language:
Edit > Preferences > Languages > HTML