Skip to content

Instantly share code, notes, and snippets.

Avatar

Kurt Zenisek KZeni

View GitHub Profile
@KZeni
KZeni / kurtzenisek_id_rsa.pub
Created Jan 29, 2021
kurtzenisek_id_rsa.pub / kurtzenisek_authorized_keys (Public SSH/SFTP/etc. key for kurtzenisek)
View kurtzenisek_id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDALsG2QVvkcAl17quJAS1SsYLdgIZ9VPPJVMZQl8FxQA2/baxS5FmReB3LK8ljTB0FLrGCmWNKGiiWG/7l2gtC4rlV0RGAwNz4+AIhS938u/WDimB6A6IIK5zMYHYs90rGARPOegD+tdxYhmAvol97o+XvN248j/e0Lu+sO+cDbnXBe1vSIIpznRHtluISPyWiPX2xlDpIWMkfr4IdMgaCMub766hqsi7pYJv2GqwNm0hwTlJjBNpbzrV5Dr38fNCXed5cIWoaJeB3UC98OMi+D08qgXpTIzSq4oWKz2nA8KNZVvPkqkCG9JrHj9pGsvJw+0O4RWrgYja+kySi5vkx
@KZeni
KZeni / edit-1.md
Last active Oct 20, 2020
Gravity Forms - Prevent truncating list of choices on radio & checkbox fields on editor views
View edit-1.md

gravityforms/includes/fields/class-gf-field-radio.php has:

if ( $is_form_editor && $count >= 5 ) {
	$editor_limited = true;
	break;
}

changed into:

$gf_radio_field_editor_choice_limit = apply_filters( 'gf_radio_field_editor_choice_limit', 5); // Default to 5 being the limit but allow a different value to be specified via filter
@KZeni
KZeni / gf-auto-populate-save-continue-email.php
Last active Sep 11, 2020
Gravity Forms auto-populate Save and Continue Later email field with the current user's email address Based on https://docs.gravityforms.com/gform_pre_process/#4-use-a-form-field-as-email-for-the-save-and-continue-confirmation via https://www.gravityforms.com/gravity-forms-v1-9-save-continue/#comment-23296. Call via functions.php or include inline.
View gf-auto-populate-save-continue-email.php
<?php
// Auto-populate Save and Continue Later email field with the current user's email address (on all forms per `gform_pre_process`. Otherwise `gform_pre_process_2`, etc. can be used for specific forms by specifying the ID at the end of the action name. Based on https://docs.gravityforms.com/gform_pre_process/#4-use-a-form-field-as-email-for-the-save-and-continue-confirmation via https://www.gravityforms.com/gravity-forms-v1-9-save-continue/#comment-23296)
// See https://gist.github.com/KZeni/180b2d7378bc6f9fc96da4fa29334709 for latest snippet
add_action( 'gform_pre_process', function ( $form ) {
if ( rgpost( 'gform_save' ) ) {
global $current_user;
get_currentuserinfo();
$current_user_email = $current_user->user_email;
$resume_email = isset( $_POST['gform_resume_email'] ) ? $_POST['gform_resume_email'] : $current_user_email; // Use the supplied resume email if one was specified; otherwise, use the current user's email address as the fallback.
$_POST['gform_resume_email'] = $resume_email;
@KZeni
KZeni / How to create a polygon in WP Google Maps from existing region or boundary data.md
Last active Aug 27, 2020
How to create a polygon in WP Google Maps from existing region/boundary data (countries, states, provinces, counties, regions, etc.) Ex. https://gist.github.com/KZeni/348b6e0a8298a91ed75fd5ec409a49c9 is US States created using this exact process.
View How to create a polygon in WP Google Maps from existing region or boundary data.md

If it shows up as a region when searching via https://nominatim.openstreetmap.org then this process will work. This includes countries, states, counties, cities, parks, and more. OpenStreetMap can be a very valuable tool for map data (the Wikipedia of maps, in a way.)

Free-handing the polygons via the WP Google Maps polygon editor is an option (click to place/remove points, etc. when adding/editing a polygon on a map), but below gets officially detailed & accurate data that prevents overlapping, gaps, and can save time depending on how accurate you want the polygon(s) to be. Below involves a fair number of steps, but this should be the entire process & each step should be rather quick.

https://gis.stackexchange.com/a/192298/151627 and https://gis.stackexchange.com/a/284305/151627 kinda outline the start of things, but here’s the full set of steps.

  1. Do a search for the
@KZeni
KZeni / wpgmza_polygons.csv
Last active Aug 27, 2020
WP Google Maps Polygon Set Data for Individual US States (CSV Export to be used by CSV Import of Polygon Data [adjusting map id, link, etc. as needed]). Otherwise, see the polydata column for the shape data itself to be used by already-created polygon entries in WPGM (or newly-created; just means it wouldn't entail the bulk import tool.) https:/…
View wpgmza_polygons.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
id,map_id,polydata,innerpolydata,linecolor,lineopacity,fillcolor,opacity,title,link,ohfillcolor,ohlinecolor,ohopacity,polyname
1,1,"(70.0187, -141.02049999999997),(70.1292, -141.72910000000002),(70.4515, -144.8163),(70.7471, -148.4583),(70.7923, -151.16089999999997),(71.147, -152.6221),(71.1185, -153.99540000000002),(71.4307, -154.88530000000003),(71.5232, -156.7529),(71.2796, -157.94489999999996),(71.2249, -159.6313),(70.6363, -161.8671),(70.0843, -163.58090000000004),(69.3028, -165.23990000000003),(69.1782, -166.8768),(68.3344, -168.0414),(67.6844, -165.9155),(67.2933, -164.6082),(66.7789, -164.0149),(66.581, -165.7507),(66.2867, -167.5745),(66.0269, -168.9862),(65.497, -168.94780000000003),(65.042, -167.4756),(64.3922, -167.01419999999996),(64.0554, -165.73429999999996),(64.0193, -163.2294),(63.9615, -162.11429999999996),(63.6877, -163.60289999999998),(63.453, -165.37170000000003),(62.4133, -166.37149999999997),(61.6534, -166.98670000000004),(60.8556, -166.4429),(60.5357, -167.8381),(59.5482, -167.71180000
View html-audio-gtm-tracking-script.html
<script>
// This listener is based on David Vallejo's HTML5 video listener, thyngster.com/tracking-html5-videos-gtm/
// Edited by Julius Fedorovicius, analyticsmania.com
// Let's wrap everything inside a function so variables are not defined as globals
(function() {
// This is gonna our percent buckets ( 10%-90% )
var divisor = 10;
// We're going to save our players status on this object.
var audios_status = {};
View EML 2.7.2 WP 5.3 Compatibility Fix Download Info.md
@KZeni
KZeni / modernizr.3.8.0.touchevents.js
Last active Dec 21, 2019
Extracted from Modernizr 3.8.0's touch events / touchevents support detection code.
View modernizr.3.8.0.touchevents.js
var supportsTouch;
if (('ontouchstart' in window) || window.TouchEvent || window.DocumentTouch && document instanceof DocumentTouch) {
supportsTouch = true;
}
View pages-widget.php
<?php
/* Pages Widget */
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'widgets_init', 'pagesinwidgets_pages' );
function pagesinwidgets_pages() {
register_widget( 'pagesinwidgets_page_section' );
}
View eml-media-views.js
window.wp = window.wp || {};
window.eml = window.eml || { l10n: {} };
( function( $, _ ) {
var media = wp.media,
l10n = media.view.l10n,
l10n_defaults = { media_orderby: 'date', media_order: 'DESC' },
mediaTrash = media.view.settings.mediaTrash,