Skip to content

Instantly share code, notes, and snippets.

☕️
Wrapping my head around Hooks and Redux 😬

Peter Tasker ptasker

☕️
Wrapping my head around Hooks and Redux 😬
Block or report user

Report or block ptasker

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
@ptasker
ptasker / rules.php
Created Jan 18, 2019
Wordfence firewall rules
View rules.php
<?php
if ( ! defined( 'WFWAF_VERSION' ) ) {
exit( 'Access denied' );
}
/*
This file is generated automatically. Any changes made will be lost.
*/
$this->failScores['sqli'] = 100;
$this->failScores['xss'] = 100;
@ptasker
ptasker / shelljs.js
Created Nov 29, 2017
Shell JS example
View shelljs.js
const shell = require( 'shelljs' );
shell.echo(
shell.cat('./src/wp-migrate-db-pro/wp-migrate-db-pro.php').grep( /.*\['version'] = '(.*)';/ )
.replace(/.*\['version'] = |'|;|\./g, '')
);
@ptasker
ptasker / backtick-function.js
Created Nov 23, 2017
Invoke function with backticks
View backtick-function.js
const myfunc = () {
console.log('WAT');
}
myfunc``
// WAT
View kickvalet.sh
#!/bin/sh
sudo brew services stop nginx
sudo brew services stop php71
sudo brew services stop dnsmasq
sudo brew services stop mysql
sudo brew services start nginx
sudo brew services start php71
sudo brew services start dnsmasq
sudo brew services start mysql
View zip-test.php
<?php
$PATH = '/your/folder/path';
//ZipArchive
//Test 1
$time_start = microtime( true );
@ptasker
ptasker / curl-test.php
Created Jul 20, 2017
Test PHP cURL connections to the DBI API
View curl-test.php
<?php
$url = 'https://api.deliciousbrains.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
$result = curl_exec($ch);
curl_close($ch);
@ptasker
ptasker / wp-remove-media.sh
Created May 11, 2017
WP CLI remove all media
View wp-remove-media.sh
#!/usr/bin/env bash
DIR="$1"
if [ -z "$1" ]
then
echo "Usage: $0 {WP install dir path}"
exit 1
fi
@ptasker
ptasker / pre-commit.sh
Created May 10, 2017
ESLint pre-commit hook
View pre-commit.sh
#!/bin/bash
lint=$(./node_modules/eslint/bin/eslint.js src/**.js $a)
echo $lint
if [[ "$lint" != *""* ]]; then
echo "ERROR: ESLint failed, check hints"
exit 1 # reject
fi
View annoying-plugin.php
<?php
/*
Plugin Name: Annoying Plugin
Plugin URI:
Description: This is not a plugin
Author: Pete T
Version: 1.0
Author URI:
*/
@ptasker
ptasker / unsplashit-image-importer.sh
Last active Dec 7, 2016
Unsplash.it WordPress image importer
View unsplashit-image-importer.sh
#!/usr/bin/env bash
DIR="$1"
COUNT="$2"
WP_DIR="$3"
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
then
echo "Usage: $0 {photos folder dir path} $1 {number of photos} $2 {Absolute directory where WordPress is installed}"
exit 1
You can’t perform that action at this time.