Skip to content

Instantly share code, notes, and snippets.

Craig Wayne craigiswayne

Block or report user

Report or block craigiswayne

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
@craigiswayne
craigiswayne / wp-plugin-audit.js
Created Jun 8, 2017
WordPress Plugin Audit Snippet (Markdown)
View wp-plugin-audit.js
var $ = jQuery;
var plugin_rows = $("table.wp-list-table.plugins tbody tr").not(".plugin-update-tr");
var plugins = [];
var markdown = "";
if( $(plugin_rows).length > 0 ){
markdown = "| Name | Version | Status |";
markdown += "\n";
markdown += "| --- | --- | --- |";
@craigiswayne
craigiswayne / README.md
Created Jun 16, 2017
Create an Off Canvas Menu with WordPress and UIKIT
View README.md

Create an Off Canvas Menu with WordPress and UIKIT

Add the following to your functions.php file

add_action ( 'init', function(){
  $menu_locations = [
    'off_canvas' => __( 'Off Canvas' )
  ];
  register_nav_menus( $menu_locations );
@craigiswayne
craigiswayne / snippet.js
Created Jul 15, 2017
WordPress Javascript REST API Example
View snippet.js
var collection = new wp.api.collections.Posts();
collection.fetch().done(function(response) {
console.log(response);
console.log('| ID | Author | Date | Title |');
console.log('|-------|--------|---------------------|--------|');
for ( var i = 0; i < response.length; i++) {
@craigiswayne
craigiswayne / find_woo_options_used.sh
Last active Oct 17, 2017
Find all woo_options used in directory files
View find_woo_options_used.sh
grep -R -E "(?:woo_options\['(.*)'\])" ./ --include='*.php' -ohw
@craigiswayne
craigiswayne / pi_ngrok.sh
Last active Dec 13, 2017
Ngrok on Raspberry PI
View pi_ngrok.sh
###########################
# NGROK DOCS:
# https://ngrok.com/docs
###########################
cd ~/
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
unzip ngrok-stable-linux-arm.zip
sudo mv ngrok /usr/local/bin/
ngrok http 80
@craigiswayne
craigiswayne / setup.sh
Last active May 20, 2018
Raspberry PI 3, OSMC and Plex Setup
View setup.sh
###
# References https://craigiswayne.wordpress.com/2018/01/20/my-media-centre/
###
####
# Variables
####
PI_IP=192.168.8.112;
PI_USERNAME=osmc;
@craigiswayne
craigiswayne / README.md
Created May 22, 2018
Nginx Verbose Access Log Format
View README.md

The snippet below outputs a verbose version of the nginx access log

To use it, simply copy the contents of verbose-access.conf and paste it into your http block.

NB:

make sure to remove / comment out any existing access_log definitions such as access_log /var/log/nginx/access.log;

Example output:

@craigiswayne
craigiswayne / follow_url.sh
Created May 29, 2018
Follow Redirects on URL
View follow_url.sh
URL=www.google.com
curl -sILk $URL;
@craigiswayne
craigiswayne / README.md
Created Jun 8, 2018
How i tried to test my Travis Build Locally (for PHP)
View README.md

How i tried to test my Travis Build Locally (for PHP)

TLDR; didn't work

docker run --name travis-debug -dit travisci/ci-garnet:packer-1512502276-986baf0 /sbin/init
docker exec -it travis-debug bash -l

From inside the docker container

@craigiswayne
craigiswayne / window.open.debug.js
Last active Jun 25, 2018
Debugging the window.open function
View window.open.debug.js
/**
* Debugging window.open function
* Overwrites the origin window.open function so that you can see the call stack
* And debug variables
* @see https://www.w3schools.com/Jsref/met_win_open.asp
*/
window.open = function( URL, name, specs, replace ){
console.group("Debugging the window.open function");
console.log("URL : " + URL);
console.log("name : " + name);
You can’t perform that action at this time.