Skip to content

Instantly share code, notes, and snippets.

View philipnewcomer's full-sized avatar
👨‍💻
"Things aren’t always #000000 and #FFFFFF." — undefined

Philip Newcomer philipnewcomer

👨‍💻
"Things aren’t always #000000 and #FFFFFF." — undefined
View GitHub Profile
@philipnewcomer
philipnewcomer / gist:c291b4cc570cbf64bd0f
Created January 27, 2016 18:54
VIP Site Setup in VVV
https://vip-svn.wordpress.com/plugins/
^ install to wp-content/themes/vip/plugins
Jetpack
@philipnewcomer
philipnewcomer / unrestrict-rest-api.php
Created May 8, 2016 12:04
Allow WordPress REST API Requests While Restricted Site Access is Active
<?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
*/
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 / wcs-disable-recurring-billing.php
Created March 22, 2017 00:18
Disable WooCommerce Subscriptions Recurring Billing (on staging or during migration)
<?php
// Place in the mu-plugins dir.
add_filter( 'woocommerce_subscriptions_is_duplicate_site', '__return_true' );
<?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 / generate-unique-username.php
Last active February 11, 2023 19:05
Generate a unique username in WordPress
<?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 / package.json
Created November 13, 2017 00:50
Request Test (Node CLI App)
{
"dependencies": {
"sync-request": "^4.1.0"
}
}
@philipnewcomer
philipnewcomer / .maintenance
Created June 6, 2018 12:54
Enable WordPress maintenance mode (place in root directory)
<?php
$upgrading = time();