Skip to content

Instantly share code, notes, and snippets.

View andrezrv's full-sized avatar

Andrés Villarreal andrezrv

View GitHub Profile
<?php // Ignore this line.
add_action( 'save_post', 'nice_fix_yoast_seo_loading', -999 );
add_action( 'delete_post', 'nice_fix_yoast_seo_loading', -999 );
function nice_fix_yoast_seo_loading() {
if ( ! class_exists( 'WPSEO_Link_Watcher' ) ) {
return;
}
nice_loader( 'includes/public/theming/' );
@andrezrv
andrezrv / upload-public-key.sh
Created December 26, 2013 12:00
Upload your public key to a remote server without using ssh-copy-id (i.e. for Windows/MINGW32 systems).
# Create ssh directory if it doesn't exist
mkdir -p ~/.ssh
# Go to ssh directory
cd !$
# Create public and private keys
ssh-keygen
# Upload your publick key to some server
cat ~/.ssh/id_rsa.pub | ssh user@host -p 22 "cat - >> ~/.ssh/authorized_keys"
@andrezrv
andrezrv / tar-examples.sh
Created December 24, 2013 19:03
Examples on how to compress and uncompress using Tar.
###################
# Compress a folder
###################
tar czfv test.tar.gz test/
# "czfv" stands for "Compress Zip File Verbose"
# If you want bzip files, use "j" instead of "z".
###################
# Uncompress a file
###################
@andrezrv
andrezrv / varnish-purge-cache.sh
Created November 2, 2013 06:07
Purge all Varnish cache.
# Purge all Varnish cache
varnishadm "ban req.url ~ /"
@andrezrv
andrezrv / submodules.sh
Created July 3, 2014 15:15
Using Git submodules.
# CREATE: On the root folder of a Git repository:
$ git submodule add git@bitbucket.org:nicethemes/<repo>.git location/of/submodule
# Cloning a repo that contains submodules:
$ git clone --recursive git@bitbucket.org:nicethemes/<repo>.git location/of/repo
# Or:
$ git clone git@bitbucket.org:nicethemes/<repo>.git location/of/repo
$ git submodule init
$ git submodule update
@andrezrv
andrezrv / get-admin-path.php
Created October 30, 2014 21:18
Obtain path to wp-admin directory in WordPress.
<?php
/**
* Obtain the path to the admin directory.
*
* @return string
*/
function my_plugin_get_admin_path() {
// Replace the site base URL with the absolute path to its installation directory.
$admin_path = str_replace( get_bloginfo( 'url' ) . '/', ABSPATH, get_admin_url() );