Skip to content

Instantly share code, notes, and snippets.

View jenkoian's full-sized avatar
👨‍💻
Works on my machine

Ian Jenkins jenkoian

👨‍💻
Works on my machine
View GitHub Profile
@jenkoian
jenkoian / wp-plugin-mutation-test.sh
Created December 23, 2021 17:06
Small bash script to do some _very_ basic plugin mutation testing against a website. i.e. check the site doesn't fall over if a random plugin is deactivated.
#!/usr/bin/env bash
URL_TO_CHECK=${1}
if [ -z "$URL_TO_CHECK" ]; then
echo 'Please supply a URL'
exit 1;
fi
WP="wp"
@jenkoian
jenkoian / uk-robtober-single-line.js
Last active October 21, 2021 10:40
Bookmarklet code to make all the 'Where to watch' links on Robtober point to the UK version and removes the links to buy tickets for US shows (create a new bookmark in your bookmark bar and replace the url with the code below) - https://v6.robweychert.com/blog/2021/10/robtober
javascript:(function(){const links = document.getElementsByClassName('film__link');for (const link of links) {if (link.textContent.toLowerCase().includes("where to watch")) {console.log('Replacing ' + link.getAttribute('href'));link.setAttribute('href', link.getAttribute('href').replace('/us/', '/uk/'));if (link.getAttribute('href').includes('malignant-2021')) {link.setAttribute('href', link.getAttribute('href').replace('malignant-2021', 'malignant'));}console.log(' with ' + link.getAttribute('href'));}}for (const link of links) {if (link.textContent.toLowerCase().includes( "tickets" )) {console.log('Remove tickets link from ' + link.closest('.film__description').querySelector('.film__title').textContent);link.parentNode.remove();}}})();
@jenkoian
jenkoian / full_list_of_wp_globals.php
Created July 22, 2021 15:53 — forked from kagg-design/full_list_of_wp_globals.php
Full list of WordPress global variables, extracted from WP Coding Standards
<?php
/**
* List of global WP variables.
*
* @since 0.3.0
* @since 0.11.0 Changed visibility from public to protected.
* @since 0.12.0 Renamed from `$globals` to `$wp_globals` to be more descriptive.
* @since 0.12.0 Moved from WordPress_Sniffs_Variables_GlobalVariablesSniff to WordPress_Sniff
*
* @var array

Languages on a WordPress project

The setup

We have a WP multi-site with two distinct languages, it doesn't really matter what those languages are, but in this case it was English GB (:uk:) and Welsh (:wales:).

We tend to develop custom code via mu-plugins, this means we can often have a lot of mu-plugins but we would like to share a text domain. This is because we have a single client, all of the mu-plugins are for this client and thus it makes sense to have a single text domain for all of their custom code. This is analagous, from a text domain point of view, to if you just did everything within a single theme. Similarly, we'd use the same text domain for the custom theme we have built for the client.

So the setup I'm trying to achieve is as such:

@jenkoian
jenkoian / glassdoor.txt
Last active October 20, 2021 15:43 — forked from se79419ed/glassdoor.txt
bookmarklet to remove hardsell overlay from glassdoor.com
javascript:(function(){
document.getElementById('ContentWallHardsell').remove();
document.getElementsByTagName("body")[0].style.overflow = "scroll";
let style = document.createElement('style');
style.innerHTML = `
#LoginModal {
display: none!important;
}
`;
document.head.appendChild(style);

Box UK are hiring PHP devs

We have some big projects and things coming up so looking to expand our dev team, I'll link to the 'official' job ads at the end but as a Principal Developer @ Box UK, here's my take.

What's the salary? 💵

Although the ad stipulates the dreaded 'competitive salary' I can hopefully give you a rough idea based on my experience:

@jenkoian
jenkoian / class-wc-settings-overrider.php
Created August 14, 2019 12:38
WooCommerce settings overrides.
<?php
/**
* For overriding woocommerce settings.
*/
declare( strict_types=1 );
namespace Acme\Client\Mu\Plugins\Woocommerce\Overrides;
/**
@jenkoian
jenkoian / cv.md
Last active August 24, 2018 08:13
Example CV

Joe Bloggs

https://link.to.blog.or.github.if.applicable

Summary

Talk about what makes you the best candidate for the job here, try and make it relevant to the job ad. Link out to blog posts, open source projects, case studies etc. if you're able to.

Skills

@jenkoian
jenkoian / workwithme.md
Last active May 13, 2019 13:16
Box UK Job PHP

Box UK are hiring PHP devs

We have some big projects and things coming up so looking to expand our dev team, I'll link to the 'official' job ads at the end but as a Principal Developer @ Box UK, here's my take.

What's the salary? 💵

Although the ad stipulates the dreaded 'competitive salary' I can hopefully give you a rough idea based on my experience:

@jenkoian
jenkoian / RewindableGenerator.php
Created July 24, 2017 13:35
Generators are non rewindable by default, you can wrap them in this to make them rewindable.
<?php
namespace Jenko;
/**
* Usage:
* $rewindableGenerator = new RewindableGenerator(function() {
* reset($this->cursor);
* while ($row = $this->fetch()) {
* yield $row;