Skip to content

Instantly share code, notes, and snippets.

View mwender's full-sized avatar
👨‍💻

Michael Wender mwender

👨‍💻
View GitHub Profile
@mwender
mwender / resize-images.sh
Created December 9, 2015 13:56
Resize images of a specified size and file type.
# Credit: http://unix.stackexchange.com/questions/38943/use-mogrify-to-resize-large-files-while-ignoring-small-ones
identify -format '%w %h %i\n' ./*.jpg |
awk '$1 > 1200 || $2 > 1200 {sub(/^[^ ]* [^ ]* /, ""); print}' |
tr '\n' '\0' |
xargs -0 mogrify -quality 55 -resize '1200x1200'
@mwender
mwender / htaccess-http-to-https
Created August 6, 2015 18:55
Redirect http to https
# http to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
@mwender
mwender / htaccess-alias-redirect
Created June 17, 2015 14:10
Redirect all domain aliases to one with these .htaccess rules.
RewriteEngine On
# If the hostname is NOT www.domain.com
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
# 301 redirect to the same resource on www.domain.com
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
@mwender
mwender / visual-composer-html-id-option.php
Last active November 23, 2017 07:11
Add an HTML ID option to Visual Composer rows in the X Theme
<?php
function x_child_visual_composer_update_existing_shortcodes(){
if ( function_exists( 'vc_add_param' ) ) {
vc_add_param( 'vc_row', array(
'type' => 'textfield',
'heading' => "HTML ID",
'param_name' => 'element_id',
'value' => '',
'description' => __( "Assign an ID to the row", "discprofile" ),
) );
@mwender
mwender / hidpi-email-header-image.php
Last active December 13, 2018 15:32
Filter for displaying a HiDPI image in the header of the WP HTML Email plugin for WordPress
<?php
namespace Functions\htmlemail;
/**
* Filters the WP HTML Email header
*
* The following works with a graphic sized at 1200x300px. The
* final display is shown @2X pixel density as the image is
* scaled down to 600x150px.
@mwender
mwender / dropbox-uploader-backups-with-deletion.sh
Last active October 27, 2019 02:23
Dropbox Uploader database backups with deletion of older files on Dropbox
#!/bin/bash
# Dropbox Config
dropboxconfig=".dropbox_uploader"
# Database Credentials
dbuser=""
dbpass=""
dbname=""
# Other options
@mwender
mwender / multi-user-nginx-http-proxy.conf
Created October 27, 2016 14:33
Multi user NGINX HTTP proxy
#Analyst 1
location /E0922BB0-684B-4ED3-967E-85D08880CFD5/ {
proxy_redirect off;
#Empire
location /E0922BB0-684B-4ED3-967E-85D08880CFD5/e/ {
proxy_pass https://205.232.71.92:443;
}
#Metasploit
location /E0922BB0-684B-4ED3-967E-85D08880CFD5/m/ {
#Metasploit exploit/multi/script/web_delivery
@mwender
mwender / replace-hamburger-icon-with-text.css
Last active January 17, 2024 17:27
Use the following CSS to replace the Elementor Nav Widget's mobile dropdown hamburger icon with the word "Menu". #elementor
/* Use "Menu" for mobile menu */
selector .elementor-menu-toggle:not(.elementor-active) .elementor-menu-toggle__icon--open.eicon-menu-bar{
display: flex;
padding: 6px;
}
selector .elementor-menu-toggle:not(.elementor-active) .elementor-menu-toggle__icon--open.eicon-menu-bar:before{
content: 'Menu';
font-family: Roboto;
font-size: 18px;
}
@mwender
mwender / close-tabs-on-mobile.js
Last active January 17, 2024 17:28
Loads Elementor's tab widget on mobile with all tabs collapsed. #elementor
let intViewportWidth = window.innerWidth;
console.log('🔔 intViewportWidth = ', intViewportWidth );
const activeClass = 'ele-active';
const mobileBreakpoint = '767'; // Our breakpoint ensures this code only runs on small screens.
const mobileTabButtons = document.querySelectorAll('.elementor-tab-mobile-title');
if( intViewportWidth <= mobileBreakpoint ){
/**
* Click handling for Tab buttons.
@mwender
mwender / README.md
Last active January 17, 2024 18:53
[ACF Unsafe Content Shortcode] Provides "acf_field_unsafe" for echoing ACF field content that hasn't been run through wp_kses_post(). #wordpress #shortcode #acf

The [acf_field_unsafe/] Shortcode

On January 16, 2024, the ACF 6.2.5 security release fixed a security issue whereby the output of the [acf field="[...]"/] shortcode has its content run through wp_kses(). This removes all <script> and <iframe> tags. However, there are still situations where you may need to echo these tags when you have a site where you're confident you can trust every user on your site with contributor or higher access. Hence, this shortcode allows you to do this.

Shortcode Documentation

Retrieves the value of a specified Advanced Custom Field (ACF) based on given attributes.

This function is designed to be used as a shortcode handler for retrieving ACF field values.