Skip to content

Instantly share code, notes, and snippets.

View gjportegies's full-sized avatar

Guus gjportegies

  • Amsterdam
View GitHub Profile
@gjportegies
gjportegies / wp-seo-tweaks.php
Created February 16, 2026 15:39 — forked from theJasonJones/wp-seo-tweaks.php
Had to a few tweaks to the WP-SEO breadcrumbs. This is what I did.
<?php
// Remove the last link in breadcrumbs
// WHY? Because it an span tag that contains the title of the page
// But you're already on the page, so what's the point?
add_filter( 'wpseo_breadcrumb_links', 'jj_wpseo_breadcrumb_links' );
function jj_wpseo_breadcrumb_links( $links ) {
//pk_print( sizeof($links) );
if( sizeof($links) > 1 ){
array_pop($links);
@gjportegies
gjportegies / magento-2-category-collection-cheatsheet.md
Created January 8, 2026 13:59 — forked from DominicWatts/magento-2-category-collection-cheatsheet.md
magento 2 : category collection cheatsheet #magento2

Category Collection Cheatsheet

Import statement

use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;

/**
 * @var CategoryCollectionFactory
 */
@gjportegies
gjportegies / instructions.md
Created March 25, 2025 15:18 — forked from michielgerritsen/instructions.md
Find old Luma code so you can convert it to Hyvä Alpine.js code

Introduction

The goal of this script is to help you migrate you old Magento Luma code to Hyvä compliant code. Luma used to rely on Require.js to manage it's javascript components. Hyvä relies on Alpine.js for this. For a lot of modules there are already compatibility modules available. Custom code you have to convert yourself.

Usage

There are several ways to use this code:

  • Using Tampermonkey (Chrome) or Greasemonkey (Firefox). If you have that installed just click on "Raw" by the requirejs-finder.user.js file.
  • (Temporary) By injecting it into Magento's head. Open the admin and navigate to Content -> Design -> Click your theme -> HTML -> Head -> Add `` and place the code above between the two script tags.
@gjportegies
gjportegies / [WordPress] Automated setup with Bedrock, Sage and Valet
Created September 4, 2024 15:32 — forked from studiocaro/[WordPress] Automated setup with Bedrock, Sage and Valet
My workflow contains Bedrock, Sage and Valet from Laravel. The latter is something you'll have to install first, otherwise this script won't work!
#!/bin/sh
echo "🎉 👏 Congrats with the new project! 🎉 👏
I'm setting up your fresh WordPress install for you."
# Make new folder
printf "Enter folder name of your choice -> "
read FOLDER
mkdir $FOLDER
cd $FOLDER
@gjportegies
gjportegies / claudebot_ips.txt
Last active April 30, 2024 06:25
ClaudeBot (ips)
13.58.112.1
13.58.121.131
13.58.137.218
13.58.150.59
13.58.216.18
13.58.244.216
13.58.247.31
13.58.252.8
13.58.39.23
13.58.60.192
@gjportegies
gjportegies / external-video.liquid
Created April 10, 2024 08:07 — forked from liamgriffin/external-video.liquid
Shopify theme section that displays an externally hosted video
<div class="video-section">
<h2>{{ section.settings.heading }}</h2>
{%- if section.settings.video_url.type == 'youtube' -%}
<iframe src="https://www.youtube.com/embed/{{ section.settings.video_url.id }}" class="youtube" allow="autoplay; encrypted-media" title="{{ section.settings.description | escape }}"></iframe>
{%- else -%}
<iframe src="https://player.vimeo.com/video/{{ section.settings.video_url.id }}" class="vimeo" allow="autoplay; encrypted-media" title="{{ section.settings.description | escape }}"></iframe>
{%- endif -%}
</div>
{% schema %}
@gjportegies
gjportegies / server.blacklist
Last active March 29, 2024 14:25
Nginx bad bots config file
# Main list
if ($http_user_agent ~* (360Spider|80legs.com|Abonti|AcoonBot|Acunetix|adbeat_bot|AddThis.com|adidxbot|ADmantX|AhrefsBot|AngloINFO|Antelope|Applebot|BaiduSpider|BeetleBot|billigerbot|binlar|bitlybot|BlackWidow|BLP_bbot|BoardReader|Bolt\ 0|BOT\ for\ JCE|Bot\ mailto\:craftbot@yahoo\.com|casper|CazoodleBot|CCBot|checkprivacy|ChinaClaw|chromeframe|Clerkbot|Cliqzbot|clshttp|CommonCrawler|comodo|CPython|crawler4j|Crawlera|CRAZYWEBCRAWLER|Curious|Curl|Custo|CWS_proxy|Default\ Browser\ 0|diavol|DigExt|Digincore|DIIbot|DISCo|discobot|DoCoMo|DotBot|Download\ Demon|DTS.Agent|EasouSpider|eCatch|ecxi|EirGrabber|Elmer|EmailCollector|EmailSiphon|EmailWolf|Exabot|ExaleadCloudView|ExpertSearch|ExpertSearchSpider|Express\ WebPictures|extract|ExtractorPro|EyeNetIE|Ezooms|F2S|FastSeek|feedfinder|FeedlyBot|FHscan|finbot|Flamingo_SearchEngine|FlappyBot|FlashGet|flicky|Flipboard|g00g1e|genieo|Genieo|GetRight|GetWeb\!|GigablastOpenSource|Go\-Ahead\-Got\-It|Go\!Zilla|GozaikBot|grab|GrabNet|Grafula|GrapeshotCrawler|GT\:\:
@gjportegies
gjportegies / 001-fail2ban-notes.md
Last active September 22, 2025 07:26
WP Fail2ban

For newer fail2ban versions

Add backend = auto to the jail for newer fail2ban versions

@gjportegies
gjportegies / identify.php
Created July 10, 2023 14:47 — 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