Skip to content

Instantly share code, notes, and snippets.

View daviddarke's full-sized avatar
🚀

David Darke daviddarke

🚀
View GitHub Profile
#!/usr/bin/env bash
#
# Scan a WordPress uploads directory for suspicious files / code.
#
# Usage:
# bash scan_wp_uploads.sh /path/to/wp-content/uploads
# # or if run from WP root:
# bash scan_wp_uploads.sh wp-content/uploads
#
#!/usr/bin/env bash
#
# Scan a WordPress theme (or themes directory) for suspicious code.
#
# Usage examples:
# # from WP root, scan ALL themes:
# bash scan_wp_theme.sh wp-content/themes
#
# # scan a specific theme:
# bash scan_wp_theme.sh wp-content/themes/twentytwentyfive
#!/usr/bin/env bash
#
# Scan a WordPress database for suspicious content.
#
# Usage (from WP root):
# bash scan_wp_db.sh
#
# Or specify a path to the WP root:
# bash scan_wp_db.sh /var/www/html
#
@daviddarke
daviddarke / gitlab-ci.yml
Last active May 21, 2024 14:17
Gitlab pipeline to push to WP Engine
stages:
- deploy
Deploy:
before_script:
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
## Create the SSH directory and give it the right permissions
@daviddarke
daviddarke / update-woo-subscriptions-pricing
Last active October 2, 2019 10:51
Update WooCommerce subscription pricing for future subscription orders
if ( defined( 'WP_CLI' ) && WP_CLI ) {
class Woo_Subs_Cli extends WP_CLI_Command {
public function update_sub_pricing( $args ){
// Quick check to make sure all the require args are available
if( count( $args ) != 2 && is_numeric( $args[1] ) && floor( $args[1] ) != $args[1] ){
WP_CLI::line( 'Please provide 1 subscription ID and new price in this format:' );
WP_CLI::line( 'woosubscriptions update_sub_pricing 1111 30' );
echo "-> Getting rid of local SQL file"
mkdir data
rm -rf data/development.sql
touch data/development.sql
echo "-> Booting Docker"
docker-compose up --build -d
echo "-> Removing vendor folder"
rm -rf vendor
echo "-> Updating composer"
docker-compose exec php composer update
// Check that required variables exist
if( ( process.argv[2] == undefined ) || ( process.argv[3] == undefined ) ){
console.log('Missing variables')
console.log('1, local path to coverage file. 2, url to target css file')
return;
}
(async () => {
var fs = require("fs");
$(".header .user__menu a[href*='/students/sign_out']").on({
'click' : function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "https://app.examfit.co.uk/students/sign_out",
crossDomain: true,
success: function( data, textStatus, jQxhr ){
alert('hi');
}
function gdpr_fields( $subscription_data ) {
$subscription_data['marketing_permissions'][0]['marketing_permission_id'] = '45e116b06';
$subscription_data['marketing_permissions'][0]['enabled'] = true;
$subscription_data['marketing_permissions'][1]['marketing_permission_id'] = '188d4ee19';
$subscription_data['marketing_permissions'][1]['enabled'] = false;
$subscription_data['marketing_permissions'][2]['marketing_permission_id'] = '2af3be3ab';
$subscription_data['marketing_permissions'][2]['enabled'] = true;
return $subscription_data;
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Bootstrap</title>