jq is useful to slice, filter, map and transform structured json data.
brew install jq
<?php | |
/* | |
Plugin Name: Error For WP backend | |
Plugin URI: https://github.com/Mte90/ | |
Description: Wrap the PHP errors in the WP admin backend with the native notice | |
Author: Mte90 | |
Version: 1.0.0 | |
*/ |
import XCTest | |
extension XCTestCase { | |
/// Simple helper for asynchronous testing. | |
/// Usage in XCTestCase method: | |
/// func testSomething() { | |
/// doAsyncThings() | |
/// eventually { | |
/// /* XCTAssert goes here... */ |
<?php | |
require_once('vendor/autoload.php'); | |
use BitWasp\Bitcoin\Bitcoin; | |
use BitWasp\Bitcoin\Address\AddressCreator; | |
use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\GlobalPrefixConfig; | |
use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig; | |
use BitWasp\Bitcoin\Network\Slip132\BitcoinRegistry; | |
use BitWasp\Bitcoin\Key\Deterministic\Slip132\Slip132; |
<?php | |
function AWS_S3_PresignDownload($AWSAccessKeyId, $AWSSecretAccessKey, $BucketName, $AWSRegion, $canonical_uri, $expires = 8400) { | |
// Creates a signed download link for an AWS S3 file | |
// Based on https://gist.github.com/kelvinmo/d78be66c4f36415a6b80 | |
$encoded_uri = str_replace('%2F', '/', rawurlencode($canonical_uri)); | |
// Specify the hostname for the S3 endpoint | |
if($AWSRegion == 'us-east-1') { |
<?php | |
$user_agent = $_SERVER['HTTP_USER_AGENT']; | |
if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'WP-Rocket' ) === false ) { | |
if ( strpos( $_SERVER['HTTP_X_ROCKET'], 'WP-Rocket' ) === false ) { | |
die( 'BAD_UA_XR: ' . ( isset( $_SERVER['HTTP_USER_AGENT'] ) ? htmlspecialchars( $_SERVER['HTTP_USER_AGENT'] ) : 'not set' ) . ' & ' . ( isset( $_SERVER['HTTP_X_ROCKET'] ) ? htmlspecialchars( $_SERVER['HTTP_X_ROCKET'] ) : 'not set' ) ); | |
} | |
$user_agent = $_SERVER['HTTP_X_ROCKET']; | |
} |