Skip to content

Instantly share code, notes, and snippets.

View mkormendy's full-sized avatar
🛠️
Building, fixing, making a living

Mike Kormendy mkormendy

🛠️
Building, fixing, making a living
View GitHub Profile
@mkormendy
mkormendy / export-yoast-redirects.php
Last active April 9, 2024 20:18 — forked from jsoningram/export-yoast-redirects.php
Export Yoast redirects to CSV file
<?php
$array_base = get_option('wpseo-premium-redirects-base');
foreach ( $array_base as $key => $row ) {
file_put_contents( ABSPATH . 'yoast-redirects-base.csv', $key . ',' . $row[ 'url' ] . "\n", FILE_APPEND );
}
$array_plain = get_option('wpseo-premium-redirects-export-plain');
foreach ( $array_plain as $key => $row ) {
file_put_contents( ABSPATH . 'yoast-redirects-export-plain.csv', $key . ',' . $row[ 'url' ] . "\n", FILE_APPEND );
@mkormendy
mkormendy / gforms-merge-tag.php
Created November 3, 2023 06:12 — forked from hereswhatidid/gforms-merge-tag.php
Create a custom Gravity Forms merge tag
<?php
namespace HWID\SampleCode;
class GravityForms {
public static function init() {
add_filter( 'gform_custom_merge_tags', [ 'HWID\SampleCode\GravityForms', 'custom_merge_tags' ], 10, 4 );
add_filter( 'gform_replace_merge_tags', [ 'HWID\SampleCode\GravityForms', 'replace_merge_tags' ], 10, 3 );
}
/**
@mkormendy
mkormendy / setup-unifi-macos.sh
Created March 1, 2021 07:20
UniFi Network Controller Setup for MacOS with Homebrew
#!/bin/sh
brew tap homebrew/cask-drivers
brew install --cask homebrew/cask-versions/adoptopenjdk8
brew install --cask ubiquiti-unifi-controller
@mkormendy
mkormendy / wordpress-cheatsheet.md
Last active February 22, 2021 14:23
WordPress Cheatsheet

##Theme Structure

Template Description
header.php Header Section
index.php Main Section
sidebar.php Sidebar Section
single.php Post Template
page.php Page Template
comments.php Comment Template
@mkormendy
mkormendy / gw-gravity-forms-change-field-id.js
Created December 3, 2020 21:23 — forked from spivurno/gw-gravity-forms-change-field-id.js
Gravity Wiz // Gravity Forms // Change Field ID via Browser Console
/**
* Gravity Wiz // Gravity Forms // Change Field ID via Browser Console
*
* Provides a simple function for changing the ID of a Gravity Forms field via the browser console from the Form Editor page.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/changing-your-gravity-forms-field-ids/
* @video http://www.screencast.com/t/STm1eLZEsR9q
@mkormendy
mkormendy / optimize_images.sh
Last active September 22, 2020 03:27 — forked from julianxhokaxhiu/pagespeed_optimize_images.sh
Recursively optimize all PNG and JPG files from the location of the script.
#!/bin/bash
find /uploads/sites/*/20* -type f -iname "*.png" -exec pngquant --speed 1 --skip-if-larger --strip {} \;
find /uploads/sites/*/20* -type f -iname "*.png" -exec advpng -z4 {} \;
find /uploads/sites/*/20* -type f -iregex .*\.jpe?g$ -exec jpegoptim -f -s -v -m 50 {} \;
touch optimg.flag
# find's -newer command option compares the timestamps of files found against a defined file, in our case optimg.flag
# when we finish optimizing all of the images we touch the optimg.flag file to update its timestamp
@mkormendy
mkormendy / homebridge-logo-loader-animation.markdown
Created July 13, 2020 01:58
Homebridge Logo Loader Animation
@mkormendy
mkormendy / manual-gravity-forms
Created April 29, 2020 00:41 — forked from keithdevon/manual-gravity-forms
Manually create entries and send notifications with Gravity Forms
<?php
// Manually create entries and send notifications with Gravity Forms
$form_id = 10;
// add entry
$entry = array(
"form_id" => $form_id,
"1" => "Entry for field ID 1",
@mkormendy
mkormendy / domain_mapping.php
Created December 3, 2014 08:25
Wordpress MU Domain Mapping 0.5.4.3 Backup
<?php
/*
Plugin Name: WordPress MU Domain Mapping
Plugin URI: http://ocaoimh.ie/wordpress-mu-domain-mapping/
Description: Map any blog on a WordPress website to another domain.
Version: 0.5.5
Author: Donncha O Caoimh
Author URI: http://ocaoimh.ie/
*/
/* Copyright Donncha O Caoimh (http://ocaoimh.ie/)
@mkormendy
mkormendy / download-file-function.php
Last active July 25, 2019 02:34 — forked from trey8611/download-file-function.php
Used to workaround WP All Import's inability to support curl Auth properly
<?php
/*
################### READ ME #################################
You'll pass the URL to your feed/file to this function inside the "Download from URL" option when creating an import.
Image examples: https://d.pr/hCfNek and https://d.pr/MnerNb.
1. [custom_file_download("ftp://username:password@hostname.com/full/path/to/file.csv", "csv")]
2. [custom_file_download("http://example.com/full/path/to/file.csv", "csv")]