Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Hartman joshhartman

View GitHub Profile
@joshhartman
joshhartman / gist:fce56971dcac1438f56b14ea9f8ac4d9
Created Jan 11, 2021
Windows Icon Resource EXE/DLLs for use with shortcuts, etc.
View gist:fce56971dcac1438f56b14ea9f8ac4d9
C:\Windows\Explorer.Exe
C:\Windows\System32\AccessibilityCpl.Dll
C:\Windows\System32\compstui.dll
C:\Windows\System32\Ddores.Dll
C:\Windows\System32\DDORes.dll
C:\Windows\System32\GameUx.Dll
C:\Windows\System32\imageres.dll
C:\Windows\System32\mmcndmgr.dll
C:\Windows\System32\mmRes.Dll
C:\Windows\System32\MorIcons.Dll
@joshhartman
joshhartman / functions.php
Created Aug 13, 2020
Override FreeSSL WordPress plugin domain exclusion list
View functions.php
<?php
// Override FreeSSL plugin domain exclusion list
add_filter('option_exclude_domains_auto_install_free_ssl', function ($data) {
$custom_data = array('domains_to_exclude' => array('mail.mydomain.com'));
if(isset($data['domains_to_exclude'])){
$data['domains_to_exclude'] = array_merge($data['domains_to_exclude'], $custom_data['domains_to_exclude']);
return $data;
}
return $custom_data;
});
@joshhartman
joshhartman / functions.php
Last active Aug 3, 2020
Disable specific WordPress shortcodes when editing with Beaver Builder
View functions.php
<?php
function shortcode_compatibility_bb_fix() {
if ( FLBuilderModel::is_builder_active() ) {
remove_shortcode( 'team-members' );
}
}
add_action( 'wp', 'shortcode_compatibility_bb_fix' );
@joshhartman
joshhartman / functions.php
Created Mar 13, 2020
WordPress Admin Login Custom Styling
View functions.php
<?php
function my_custom_login_styles() { ?>
<style type="text/css">
body.login {
background-color: #114892 !important;
}
body.login div#login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri() ?>/images/site-login-logo.png);
padding-bottom: 15px;
@joshhartman
joshhartman / gist:68bb189fc13ed604a73eb5a7a3d9cb68
Created Mar 5, 2020
ImageMagick -- Resize large images recursively and preserve the aspect ratio -- Windows Command Prompt
View gist:68bb189fc13ed604a73eb5a7a3d9cb68
FOR /R %f IN (*.jpg) DO magick "%f" -resize 3000x3000^> -quality 85 "%f"
@joshhartman
joshhartman / .htaccess
Created Dec 6, 2018
Simple Let's Encrypt AutoSSL Rewrite Rule
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^\.well-known - [L]
</IfModule>
@joshhartman
joshhartman / .htaccess
Last active Nov 16, 2018
Redirect to HTTPS
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@joshhartman
joshhartman / gist:2c0f3b2f81a3e8d5a1853dd54333206e
Created Jul 28, 2018
cPanel AutoSSL Let's Encrypt mod_rewrite rules to add immediately before each RewriteRule line in your .htaccess
View gist:2c0f3b2f81a3e8d5a1853dd54333206e
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
@joshhartman
joshhartman / .htaccess
Last active May 18, 2018
Leverage browser caching and GZip compression (Apache)
View .htaccess
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
View unzip.php
<?php
$zip = new ZipArchive;
if ($zip->open('archive.zip') === TRUE) {
$zip->extractTo('.');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}