Skip to content

Instantly share code, notes, and snippets.

🙃
In detached head state

Philip Newcomer philipnewcomer

🙃
In detached head state
Block or report user

Report or block philipnewcomer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@philipnewcomer
philipnewcomer / generate-unique-username.php
Last active Oct 17, 2019
Generate a unique username in WordPress
View generate-unique-username.php
<?php
/**
* Recursive function to generate a unique username.
*
* If the username already exists, will add a numerical suffix which will increase until a unique username is found.
*
* @param string $username
*
* @return string The unique username.
*/
@philipnewcomer
philipnewcomer / .maintenance
Created Jun 6, 2018
Enable WordPress maintenance mode (place in root directory)
View .maintenance
<?php
$upgrading = time();
@philipnewcomer
philipnewcomer / package.json
Created Nov 13, 2017
Request Test (Node CLI App)
View package.json
{
"dependencies": {
"sync-request": "^4.1.0"
}
}
View remoteip.php
<?php
echo 'X-Forwarded-IP: ';
if ( isset( $_SERVER['X-Forwarded-IP'] ) ) {
echo $_SERVER['X-Forwarded-IP'];
}
echo '<br>REMOTE_ADDR: ';
if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
echo $_SERVER['REMOTE_ADDR'];
@philipnewcomer
philipnewcomer / wcs-disable-recurring-billing.php
Created Mar 22, 2017
Disable WooCommerce Subscriptions Recurring Billing (on staging or during migration)
View wcs-disable-recurring-billing.php
<?php
// Place in the mu-plugins dir.
add_filter( 'woocommerce_subscriptions_is_duplicate_site', '__return_true' );
View gist:c1a43637e5953012ae4e62b4e8f1d85b
tell application "System Events"
set hiddenFilesDisplayStatus to do shell script "defaults read com.apple.finder AppleShowAllFiles"
set hiddenFilesNewDisplayStatus to "NO"
if hiddenFilesDisplayStatus is "NO" then
set hiddenFilesNewDisplayStatus to "YES"
end if
do shell script "defaults write com.apple.finder AppleShowAllFiles " & hiddenFilesNewDisplayStatus
@philipnewcomer
philipnewcomer / unrestrict-rest-api.php
Created May 8, 2016
Allow WordPress REST API Requests While Restricted Site Access is Active
View unrestrict-rest-api.php
<?php
/**
* Plugin Name: Unrestrict REST API
* Plugin URI: https://philipnewcomer.net/2016/05/allow-rest-api-restricted-site-access/
* Description: Allows REST API requests while Restricted Site Access is enabled.
* Version: 0.1.0
* Author: Philip Newcomer
* Author URI: https://philipnewcomer.net
*/
View gist:c291b4cc570cbf64bd0f
https://vip-svn.wordpress.com/plugins/
^ install to wp-content/themes/vip/plugins
Jetpack
You can’t perform that action at this time.