Skip to content

Instantly share code, notes, and snippets.

View lupin72's full-sized avatar

Pier Gorelli lupin72

  • Pierpaolo Gorelli
  • Calle Carteros 76, Valencia
View GitHub Profile
@lupin72
lupin72 / audit-your-codebase.md
Created August 23, 2026 10:09 — forked from aarondfrancis/audit-your-codebase.md
A read-only, agent-orchestrated codebase audit prompt for data structures, state modeling, algorithms, and ownership.

Audit this entire codebase for materially useful simplifications in its data structures, state representation, control flow, algorithms, and ownership.

This is an audit-only exercise. Do not edit files, run tests, implement recommendations, commit, or push. Read-only inspection commands are allowed.

You are the coordinator. Continue until the complete codebase has been reviewed and the final audit is validated.

  1. Establish the coverage contract

Inspect the repository and inventory every identifiable subsystem.

Questions are not from any actual exam!!!
Q: Create a job that calculates pi to 2000 decimal points using the container with the image named perl
and the following commands issued to the container: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
Once the job has completed, check the logs to and export the result to pi-result.txt.
Solution:
@lupin72
lupin72 / gist:d30b90c4f27e6571833ef21bcb4d6e05
Created August 16, 2019 12:51 — forked from mikejolley/gist:2044109
WooCommerce - Update number of items in cart and total after Ajax
<?php
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
function woocommerce_header_add_to_cart_fragment( $fragments ) {
ob_start();
?>
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
<?php
@lupin72
lupin72 / gravity-forms-material-design.css
Created March 14, 2019 13:43
Styling Gravity Forms with Material Design Look
/*** MAIN WRAPPER ***/
.gform_wrapper {
background: #6000AA;
padding: 5%;
}
/*** REMOVE LABEL FOR PLACEHOLDER ONLY ***/
.gform_wrapper .top_label .gfield_label,
.gform_wrapper .field_sublabel_below .ginput_complex.ginput_container label {
display: none;
@lupin72
lupin72 / recalculate-acf-locations.php
Created June 17, 2018 11:50 — forked from RadGH/recalculate-acf-locations.php
Update ACF location fields
<?php
global $ld_recalc;
$ld_recalc = array(
'posts_per_run' => 16,
'post_types' => array( 'distributor' ),
'scan_key' => 'acf-recalc-scan',
'scan_identifier' => '2015-09-23', // Change this if you want to scan again in the future.
@lupin72
lupin72 / gist:91b7f744beb0478c805e9a26b504b753
Created June 2, 2018 15:33
How to block Monterinsights' Google Analytics Cookies with iubenda Cookie Solution for GDPR
function block_monsterinsights_cookies($attr) {
$attr['type'] = "text/plain";
$attr['class'] = '_iub_cs_activate';
return $attr;
}
add_filter('monsterinsights_tracking_analytics_script_attributes', 'block_monsterinsights_cookies', 10);
@lupin72
lupin72 / securepay_standard_gateway.php
Created November 15, 2017 11:07 — forked from wladpaiva/securepay_standard_gateway.php
Add SecurePay as a payment gateway for the givewp wordpress plugin. You just need to require the securepay_standard_gateway file into your functions.php
<?php
/**
* SecurePay Standard Gateway
*
* @package Give
* @subpackage Gateways
* @copyright Copyright (c) 2016, WordImpress
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.0
*/
@lupin72
lupin72 / wordpress-import-update.php
Created July 13, 2017 23:29 — forked from balbuf/wordpress-import-update.php
Force the WordPress importer to update existing posts instead of skipping them
<?php
/**
* When using the WordPress Importer, update existing
* posts instead of skipping them. Updates content according
* to the import file even if the existing post was updated
* more recently.
*
* To use, drop this file into your /mu-plugins/ folder or
* copy this code into your functions.php file.
@lupin72
lupin72 / functions.php
Last active April 26, 2016 12:03
WordPress - Prevent browser from caching authenticated pages
function example_update_nocache_headers($headers) {
$headers['Cache-Control'] = 'no-cache, must-revalidate, max-age=0, no-store';
$headers['Pragma'] = 'no-cache';
return $headers;
}
add_filter('nocache_headers','example_update_nocache_headers');