Skip to content

Instantly share code, notes, and snippets.

View stracker-phil's full-sized avatar

Philipp Stracker stracker-phil

View GitHub Profile
@stracker-phil
stracker-phil / README.md
Created February 23, 2026 19:47
Runs "git log" against two branches to help find out, which one introduced a code change

Resolving Merge Conflicts

The inspect-conflict.sh script compares a single file on two branches to find out which branch introduced a specific code changes. This documentation explains, how the log inside the script evolved and what it does.

Rules

  1. Resolve one file at a time
  2. First, apply the upstream version
  3. Unstage all changes of that file
  4. RESOLVE: Review each change one-by-one and either stage or discard
@stracker-phil
stracker-phil / post-checkout
Created November 25, 2025 15:27
Git Hooks to protect against Sha1-Hulud
#!/usr/bin/env bash
# FILE: .git/hooks/post-checkout
# Updates the DDEV environment after switching a branch.
PREV_HEAD="$1" # Hash of previous HEAD
NEW_HEAD="$2" # Hash of new HEAD
CHECKOUT_TYPE="$3" # 1 if checking out a branch, 0 if checking out something else, such as a file (rollbacks)
@stracker-phil
stracker-phil / translate_with_openai.py
Last active May 31, 2024 14:37
Python script to translate a GlotPress JSON export to another language
#!/usr/bin/env python3
import json
import os
from openai import OpenAI
# URL: https://gist.github.com/stracker-phil/d1d874a299883ff540966a402793f616
#
# Usage:
# 1. Download the current translations as JSON format from the internal GlotPress site.
@stracker-phil
stracker-phil / Hook-Obsidian - New-Item.scpt
Last active March 7, 2024 12:11
Hookmark script: Obsidian | New Item
use framework "Foundation"
use scripting additions
property NSString : a reference to current application's NSString
property NSMutableCharacterSet : a reference to current application's NSMutableCharacterSet
set fileType to ".md"
set prefUrl to ""
try
@stracker-phil
stracker-phil / divi-areas-in-search-results.php
Created May 4, 2023 11:18
Include Divi Areas in WordPress search results
<?php
/**
* How to use this snippet:
*
* 1. Click the "Download ZIP" button (top-right area)
* 2. Open wp-admin > Plugins > Add New
* 3. Click "Upload Plugin" and select the zip file
* 4. After uploading the zip file, activate the plugin
*
* ----------
@stracker-phil
stracker-phil / edd-generate-discount.php
Last active October 21, 2022 11:12
Function to generate a random discount code for Easy Digital Downloads
<?php
/**
* Generate a random discount code that matches the given criteria.
*
* Samples:
* - generate_discount( 10, 'percent', '+7days', 'HI-^^^^' );
* - generate_discount( 5, 'flat', '', '********' );
*
* @param int $amount The discount code value.
* @param string $type The type, either [flat|percent].
@stracker-phil
stracker-phil / trigger-after-delay-1.html
Created September 30, 2022 08:36 — forked from divimode-philipp/trigger-after-delay-1.html
Sample trigger for Popups for Divi / Divi Areas Pro that opens the #contact Popup after 5 seconds
<script>
setTimeout(function () {
DiviArea.show('contact');
}, 5000);
</script>
@stracker-phil
stracker-phil / trigger-after-delay-2.html
Created September 30, 2022 08:36 — forked from divimode-philipp/trigger-after-delay-2.html
Generic trigger snippet for Popups for Divi / Divi Areas Pro to trigger the given Popup after a delay.
<script>
(function () {
// TODO: Adjust the following two lines:
var popup = 'contact'; // Your Popup ID.
var delay = 5; // Delay [in seconds].
setTimeout(function () {
DiviArea.show(popup);
}, delay * 1000);
@stracker-phil
stracker-phil / trigger-on-scroll-1.html
Created September 30, 2022 08:36 — forked from divimode-philipp/trigger-on-scroll-1.html
JS snippet for Popups for Divi / Divi Areas Pro to trigger a Popup after the user scrolled down to a certain point
<script>
(function ($) {
// TODO: Adjust the following to lines to your needs:
var popup = 'contact'; // Your Popup ID.
var distance = 500; // Scroll distance [pixel].
$(window).on('scroll.popup_' + popup, function () {
// Check if the user scrolled far enough.
@stracker-phil
stracker-phil / divi-areas-in-search-results.php
Created September 30, 2022 08:35 — forked from divimode-philipp/divi-areas-in-search-results.php
Include Divi Areas in WordPress search results
<?php
/**
* How to use this snippet:
*
* 1. Click the "Download ZIP" button (top-right area)
* 2. Open wp-admin > Plugins > Add New
* 3. Click "Upload Plugin" and select the zip file
* 4. After uploading the zip file, activate the plugin
*
* ----------