Skip to content

Instantly share code, notes, and snippets.

View KZeni's full-sized avatar

Kurt Zenisek KZeni

View GitHub Profile
@KZeni
KZeni / gist:6735287
Created September 27, 2013 21:14
Prevent memory limit crash in Mobile Safari (and other mobile browsers) when viewing an Impress.JS presentation with a lot of images and/or 3d elements by only showing the current, next, and previous slide on mobile devices.
<script>
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){ // Detect mobile browsers & use memory optimized styling if on mobile (hide all but the previous & next slides). Can prevent crashes when presentation contains many images and/or 3d elements.
var root = document.documentElement;
root.className += ' mobile';
}else{
var root = document.documentElement;
root.className += ' desktop';
}
function getPreviousSibling(element){
var p = element;
@KZeni
KZeni / content-download-url-only.php
Last active October 1, 2018 08:00
Make Download Monitor's native download permalinks (which some search services grab instead of the custom endpoint in the plugin's settings) resolve to the correct download on the site. Add the `content-download-url-only.php` file to your WordPress theme and add the `functions snippet.txt` code snippet to your theme's `functions.php` file.
<?php
/**
* Simply outputs the URL for the download
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
?>
<?php $dlm_download->the_download_link(); ?>
@andrasguseo
andrasguseo / modify-imported-event-timezones.php
Last active November 1, 2019 21:51
Modify timezone and time when importing with EA (The Events Calendar)
<?php
/*
* Description: Modifies the timezone and the time of imported events, if the source
* feed timezone is UTC
*
* Usage: Copy the snippet into your theme's (preferably child theme's) functions.php file.
* Modify the URL and the timezone at the end of the code based on your needs
* Timzone name list: the TZ* column on this page
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
*
@claygriffiths
claygriffiths / gppa-list-users-from-entire-ms-network.php
Created November 29, 2019 20:58
GP Populate Anything: List users from entire Multisite Network
<?php
/**
* See https://gravitywiz.com/documentation/how-do-i-install-a-snippet/ for details on how to install snippets like these.
*
* Requires GP Populate Anything 1.0-beta-3.38 or newer
*/
add_filter( 'gppa_object_type_user_limit_to_current_site', '__return_false' );

Tools to choose from

The official SASS site has a list of possible options here: https://sass-lang.com/install

There are paid options, free options, and even open source options. These are then available on Windows, Mac, and/or Linux. They’re also inter-operable so it’s not a requirement that we use the same tool (though some consistency might be nice when it comes to sharing settings, discussing things, etc.)

I’ve personally used https://codekitapp.com (paid & Mac only; my current app of choice), and http://livereload.com (has paid options for helping further development & support, but it is provided 100% free per it being fully open source [Windows option is fully free even from the main download option]).

There’s then also http://koala-app.com (free & open source), https://prepros.io (paid), https://scout-app.io (free & open source), and others.

What’s nice is that you can really use the tool of your choice and it should play nice (I know Kaitlyn uses a different tool from me) since it’s still just

function disableWPGMPolygonLineOpacityOnInteraction(){
if(window.location.href.indexOf("communities") > -1 || window.location.href.indexOf("community") > -1){
$(WPGM_Path_Polygon).each(function(i){
if(this !== window){
google.maps.event.addListener(WPGM_Path_Polygon[i], "mouseover", function(event) {
this.setOptions({strokeOpacity: 0});
});
google.maps.event.addListener(WPGM_Path_Polygon[i], "click", function(event) {
this.setOptions({strokeOpacity: 0});
});
if(isset($_GET['location']) && $_GET['location'] != ''){
$location = sanitize_text_field($_GET['location']);
}else{
$location = 'Wausau';
}
$output = '
<div id="zillow-large-search-box-widget-container" style="width:432px;overflow:hidden;background-color:#e7f1fd;color:#555; font: normal normal normal 13px verdana,arial,sans-serif;line-height:13px;margin:0 auto;padding:0;text-align:center;border:1px solid #adcfff;letter-spacing:0;text-transform:none;">
<h2 style="color:#d61;text-align:left;font-size:20px;line-height:20px;font-weight:normal;float:left;width:200px;margin-left:10px;margin-top:5px;letter-spacing:0;text-transform:none;">Find Homes</h2>
<div style="float:right;">
<a href="https://www.zillow.com/" target="_blank" rel="nofollow"><img alt="Zillow Real Estate Information" style="border:0;" src="https://www.zillow.com/widgets/GetVersionedResource.htm?path=%2Fstatic%2Fimages%2Fpowered-by-zillow.gif"></img>
@KZeni
KZeni / wpgmza_polygons.csv
Last active August 27, 2020 21:37
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:/…
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
@KZeni
KZeni / gf-auto-populate-save-continue-email.php
Last active September 11, 2020 20:14
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.
<?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;