Skip to content

Instantly share code, notes, and snippets.

View markusvonplunkett's full-sized avatar

Mark Plunkett markusvonplunkett

View GitHub Profile
@markusvonplunkett
markusvonplunkett / identify.php
Created September 6, 2023 08:12 — forked from peterjaap/identify.php
Identify used Magento 2 frontend extensions in a Luma install
<?php
// Run with the URL pointing to a require-config.js as the first argument;
// php identify.php http://magento2demo.firebearstudio.com/pub/static/frontend/Magento/luma/en_US/requirejs-config.js
$content = file_get_contents($argv[1]);
preg_match_all(
'/(?P<quote>\'|")(?P<extension>[[:alnum:]]+_[[:alnum:]]+)\/js\/.+?(?P=quote)/m',
$content,
$matches
@markusvonplunkett
markusvonplunkett / date-form-fields
Created November 28, 2018 12:01
Remove autocomplete from data form fields
add_filter( 'gform_field_content', function($input, $field, $value, $lead_id, $form_id){
if($field->type == 'date'){
$input = preg_replace( '/<(input)/', '<${1} autocomplete="off" ', $input );
}
return $input;
}, 5, 10 );
@markusvonplunkett
markusvonplunkett / logs
Created November 16, 2018 18:37
error log
2018-11-16 18:25:42 - INFO :: MainThread : Starting Tautulli v2.1.25
2018-11-16 18:25:42 - INFO :: MainThread : Windows 10 (10.0.17134)
2018-11-16 18:25:42 - INFO :: MainThread : Europe/London (UTC+0000)
2018-11-16 18:25:42 - INFO :: MainThread : Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
2018-11-16 18:25:42 - INFO :: MainThread : Program Dir: C:\Users\Mark\Desktop\Tautulli-Tautulli-f335ffa
2018-11-16 18:25:42 - INFO :: MainThread : Config File: C:\Users\Mark\Desktop\Tautulli-Tautulli-f335ffa\config.ini
2018-11-16 18:25:42 - INFO :: MainThread : Database File: C:\Users\Mark\Desktop\Tautulli-Tautulli-f335ffa\tautulli.db
2018-11-16 18:25:42 - INFO :: MainThread : Checking if the database upgrades are required...
2018-11-16 18:25:42 - ERROR :: MainThread : Can't connect to the database: database disk image is malformed
2018-11-16 18:25:42 - INFO :: MainThread : Checking if configuration upgrades are required...
@markusvonplunkett
markusvonplunkett / 0. Synology RAID Expansion-Resync Performance.md
Created November 6, 2018 15:07 — forked from fbartho/0. Synology RAID Expansion-Resync Performance.md
Walkthrough of what I did to increase performance on my Synology NAS box during an expansion, and afterwards.

Performance on Synology RAIDs

(especially while expanding)

Warning: The exact commands may not match for your particular linux OS / Synology(NAS) device. I had to customize the commands after exploring my particular system's setup.

If you're new to linux, or this is a new piece of hardware / a new synology device, jump down to the section called "Inspecting a setup"

Contents

/ filter the Gravity Forms button type
function form_submit_button( $button, $form ) {
return "<button class='button' id='gform_submit_button_{$form['id']}'><span>Submit Enquiry</span></button>";
}
add_filter( 'gform_submit_button', __NAMESPACE__ . '\\form_submit_button', 10, 2 );
@markusvonplunkett
markusvonplunkett / gist:600f3519c142ff5271885135c554a1f2
Created October 16, 2018 15:57
Gravity Form Button Customisation
// filter the Gravity Forms button type
add_filter('gform_submit_button', __NAMESPACE__ . '\\form_submit_button', 10, 2);
function form_submit_button($button, $form)
{
// Add custom classes to your button
$classes = 'btn1 form-submit-btn';
// Replace default input tag with button opening tag
$button = str_replace('<input', '<button', $button);
@markusvonplunkett
markusvonplunkett / media-rename-product-title
Created October 15, 2018 11:40
Rename media titles based on the woocommerce product name
function rename_featured_images_to_post_title($post_type){
$posts = get_posts(['post_type' => $post_type, 'posts_per_page' => -1]);
foreach($posts as $post){
$title = $post->post_title;
$name = $post->post_name;
$thumbnail = get_post_thumbnail_id( $post );
if((bool)$thumbnail){
if(get_the_title($thumbnail) != $title){
wp_update_post([
'ID' => $thumbnail,
@markusvonplunkett
markusvonplunkett / nuke stock
Created August 20, 2018 10:53
Find any reference to OS or NS in slug and remove. Amend stock status accordingly
if(isset($_GET['nuke_os'])){
add_action('init', function(){
$products = get_posts(['post_type' => 'product', 'posts_per_page' => -1]);
$q = 0;
foreach($products as $product){
$extension = substr($product->post_name, -3);
if(in_array($extension, ['-os','-ns'])){
$q++;
@markusvonplunkett
markusvonplunkett / meta cat.php
Created September 8, 2017 08:10
Category output Mag1 Fishpig Wordpress
<?php if (count($categories) > 0): ?>
Category:
<?php foreach($categories as $category): ?>
<a href="<?php echo $category->getUrl() ?>"><?php echo $this->escapeHtml($category->getName()) ?></a>
<?php endforeach; ?>
<?php endif; ?>
@markusvonplunkett
markusvonplunkett / footer-js.js
Created August 15, 2017 10:41
Moving JS Files to Footer Wordpress