View ssh-connections.sh
#!/bin/bash
ss -tnpa |grep ESTAB |grep ssh
View clone-git-submodules
cat .gitmodules|grep url|cut -d = -f 2 | xargs -L1 git clone
View disable-LongConditionClosingCommentSniff.xml
<rule ref="Squiz">
<exclude name="Squiz.Commenting.LongConditionClosingCommentSniff"/>
</rule>
View htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_NAME} localhost
RewriteRule ^wp-content/uploads/(.+)$ http://www.example.com/wp-content/uploads/$1 [R=301,L]
</IfModule>
View woocommerce-add-to-cart
?add-to-cart=PRODUCT_ID&variation_id=VARIATION_ID&attribute_ATTRIBUTE_NAME=ATTRIBUTE_SLUG&attribute_ATTRIBUTE_NAME2=ATTRIBUTE_SLUG2&quantity=1
View gist:e6fee1798b9118bf9bd69626501bb1b1
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
View exclude-commenting.xml
<rule ref="Squiz.Commenting">
<exclude name="Squiz.Commenting.ClassComment"/>
<exclude name="Squiz.Commenting.FileComment"/>
<exclude name="Squiz.Commenting.FunctionComment"/>
<exclude name="Squiz.Commenting.VariableComment"/>
</rule>
View deactivate-active-plugins.sql
UPDATE `wp_options` SET
`option_value` = 'a:0:{}'
WHERE `option_name` = 'active_plugins';
View delete-orphan.sql
-- Delete orphan postmeta
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts p ON pm.post_id = p.ID
WHERE p.ID IS NULL
;
-- Delete orphan attachment
DELETE p1
FROM wp_posts p1
View git-fork-update.md

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd YOUR-FORKED-REPO
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream