Skip to content

Instantly share code, notes, and snippets.

View SchneiderSam's full-sized avatar

Samuel Schneider SchneiderSam

View GitHub Profile
@SchneiderSam
SchneiderSam / gist:5f0fecd31fc4c74ae51ececce4ea6d3a
Last active November 13, 2024 13:30
Convert sqlite to Markdown
import sqlite3
import os
# Hier den Pfad zur SQLite-Datenbank festlegen
database_path = "nwtsty-X.sqlite" # Pfad zur Datenbank
output_folder = ".\\Output" # Pfad zum Ausgabeordner
# Zuordnung der Bibelbuchnummern zu ihren Namen
@SchneiderSam
SchneiderSam / gist:6c3af18d5d5a4a9b9024d9f6f02f888a
Last active November 12, 2024 09:42
Markdown Note Exporter: Recursively Scan and Extract Document IDs and Headings to Create Notes
import os
import re
# Alias-Wörterbuch für Bibelbücher
bible_aliases = {
"1. Mose": ["1. Mose", "1Mo", "1. Mo", "1 Mo", "Genesis"],
"2. Mose": ["2. Mose", "2Mo", "2. Mo", "2 Mo", "Exodus"],
"3. Mose": ["3. Mose", "3Mo", "3. Mo", "3 Mo", "Levitikus"],
"4. Mose": ["4. Mose", "4Mo", "4. Mo", "4 Mo", "Numeri"],
"5. Mose": ["5. Mose", "5Mo", "5. Mo", "5 Mo", "Deuteronomium"],
@SchneiderSam
SchneiderSam / gist:73e66ea55d8a04b18af82d2c15ae0c6d
Last active April 18, 2024 08:29
Load Both Customizer and style.css into WordPress Block Editor
<?php
// Load CSS Variables in Editor
add_filter('block_editor_settings_all', function($editor_settings) {
$style_path = get_stylesheet_directory() . '/style.css';
if (file_exists($style_path)) {
$css_style = file_get_contents($style_path);
$editor_settings['styles'][] = ['css' => $css_style];
}
$customizer_css = wp_get_custom_css_post();
@SchneiderSam
SchneiderSam / gist:1d432f34e13a4934a1482e01a732b5af
Created September 19, 2023 07:15
Dynamic Content Replacement in WordPress with Jet Engine and GenerateBlocks
function replace_jet_engine_option_in_content($content) {
// Regular expression to detect all occurrences of {{any-slug::any-name}}
preg_match_all('/{{(.*?)::(.*?)}}/', $content, $matches);
if (!empty($matches) && isset($matches[0])) {
foreach ($matches[0] as $index => $match) {
// Get the slug and the option name
$page_slug = $matches[1][$index];
$option_name = $matches[2][$index];
@SchneiderSam
SchneiderSam / gp-mega-menu.php
Last active May 7, 2025 01:26 — forked from diggeddy/gp-mega-menu.php
Create a sub menu item container with action hook (Mega Menu with GeneratePress and GenerateBlocks)
<?php
add_filter( 'walker_nav_menu_start_el', 'db_sub_menu_item_hook', 10, 4 );
function db_sub_menu_item_hook( $item_output, $item, $depth, $args ) {
// Specify menu item class to target
$class_string = 'gp_mega_item';
$menu_item_classes = $item->classes;
if ( empty( $menu_item_classes ) || !in_array( $class_string , $menu_item_classes ) ) {
return $item_output;