Skip to content

Instantly share code, notes, and snippets.

View mgussekloo's full-sized avatar

Martijn Gussekloo mgussekloo

View GitHub Profile
@mgussekloo
mgussekloo / gist:c682716f9251f6cf44433362ba863c11
Created June 20, 2024 10:43
Plugin that lets you share Wordpress sites through Expose (expose.dev)
<?php
// phpcs:ignoreFile
define( 'EXPOSED_DOMAIN', 'xxx.sharedwithexpose.com' );
define( 'REAL_DOMAIN', 'mydomain.test' );
// Load only if we are running under Expose.
if ( empty( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) || strpos($_SERVER['HTTP_X_ORIGINAL_HOST'], EXPOSED_DOMAIN) === false) {
return;
}
@mgussekloo
mgussekloo / process.sh
Created September 1, 2023 07:09
Cat Park image processing
#!/bin/sh
#files="carmen-alternate carmen-default magnus-alternate-fullsize magnus-default-new marvin-alternate marvin-default cafe_background cybervan vendoralley apartment catpark catpark-damaged madison-default madison-thinking melonie-default melonie-angry"
files=('catpark_logo los')
palette="/tmp/palette.png"
filters="fps=fps=12,scale=500:-1:flags=lanczos"
q=40
# rm -rf opti
# mkdir opti
@mgussekloo
mgussekloo / gist:25e287eed70babc5b5a91ee8ab88a559
Last active March 21, 2022 19:48
Getting $reset in Pinia composition api
export const useLocationStore = defineStore('location', () => {
    const defineState = () => ({
        id: 1,
        backgroundImage: '',
    })

    const state = defineState();
@mgussekloo
mgussekloo / gist:e390396cae57460c09c418d7334c6bc1
Created January 10, 2022 12:14
Prevent Permalink Manager to redirect the current URL to the current URL.
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
add_filter('permalink_manager_filter_redirect', function($correct_permalink, $redirect_type, $queried_object) {
$relative = wp_make_link_relative($correct_permalink);
$old_uri = wp_make_link_relative($_SERVER['REQUEST_URI']);
if ($relative == $old_uri) {
return '';
<script type="application/ld+json">{"@context":"https://schema.org","@type":"JobPosting","title":"Opleiding tot Verkeersregelaar","description":"Vacature gratis opleiding tot verkeersregelaar\r\n\r\nAls je verkeersregelaar wilt worden heb je geen diploma’s of ervaring nodig. Wel is het verplicht om een aanstellingspas te hebben. Nog niet in het bezit? Geen probleem! Via Binck kun je een gratis 4-daagse opleiding tot verkeersregelaar volgen en de aanstellingspas halen. Hierna kan je direct als verkeersregelaar aan het werk! Is dit iets voor jou? Meld je dan snel aan!\r\n\r\n&nbsp;\r\nWat jij van Binck kan verwachten\r\n\r\n \tEen werkgever die het belangrijk vindt, dat jij elke dag met plezier naar je werk gaat\r\n \tWekelijks uitbetaald en 100% reiskostenvergoeding\r\n \tWordt onderdeel van het Binck team met de leukste collega’s\r\n \tPersoonlijke begeleiding en support van jouw eigen vaste teamleider\r\n \tDoorgroeimogelijkheden naar bijvoorbeeld coördinator met eigen auto en telefoon\r\n\r\n&nbsp;\r\nHoe z
<script>
document.addEventListener('click', function(e) {
// If the clicked element doesn't have the right selector, bail
if (!event.target.matches('a[href="#mm"]')) return;
e.preventDefault();
var getparams = {};
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { getparams[key] = value; });
window.location.href = 'https://api.mediamasters.nl/external-game/session-result?sessionId=' + getparams.sessionId;
return;
Step 1 - remove current binlogs
mysql -u forge -p -e "RESET MASTER"
Step 2 - create setting to skip binlogs in the future
vi /etc/mysql/conf.d/disable_binlogs.cnf
[mysqld]
skip-log-bin
Step 3 - restart mysql
@mgussekloo
mgussekloo / gist:c0e508b93e32d0dbf8ff2966050766a0
Last active August 12, 2021 11:56
Using Webpack ifdef-loader with Laravel Mix
1. Install ifdef-loader
```bash
yarn add ifdef-loader
```
2. Add the loader to Webpack through Laravel Mix 'webpackConfig' method. Apparently this doesn't overwrite the defaults but merges it nicely.
```js
mix.webpackConfig({
module: {
rules: [
@mgussekloo
mgussekloo / gist:749e01136b53241ca70bc283e19e880e
Created February 8, 2021 21:25
Preventing PHP from sending mails when using homebrew
Create a file "disablemail.ini" in /opt/homebrew/etc/php/7.4/conf.d
sendmail_path="cat > ~/Sendmail/mail.log"
@mgussekloo
mgussekloo / webpack.mix.js
Created April 20, 2020 08:56 — forked from viirre/webpack.mix.js
Using different Tailwind config files (eg. one for admin and one for front) for Laravel Mix
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');
mix
.js('resources/js/admin/admin.js', 'public/js')
.js('resources/js/front/front.js', 'public/js')
// Admin
.sass(