Skip to content

Instantly share code, notes, and snippets.

View herbie4's full-sized avatar
🏠
Working from office

herbert herbie4

🏠
Working from office
View GitHub Profile
@yookoala
yookoala / 90-mac-superdrive.rules
Last active April 10, 2024 20:54
udev rules to use Apple SuperDrive on Linux
#
# Apple SuperDrive initialization rule
#
# See: https://gist.github.com/yookoala/818c1ff057e3d965980b7fd3bf8f77a6
ACTION=="add", ATTRS{idProduct}=="1500", ATTRS{idVendor}=="05ac", DRIVERS=="usb", RUN+="/usr/bin/sg_raw %r/sr%n EA 00 00 00 00 00 01"
@webdados
webdados / remove_wp_54_favicon.php
Last active December 29, 2021 20:42
Do not show WordPress 5.4 default WP blue favicon
<?php
//Inspiration: https://gist.github.com/florianbrinkmann/a879099f3d28c5e1d64f2aeea042becf
add_action( 'do_faviconico', function() {
//Check for icon with no default value
if ( $icon = get_site_icon_url( 32 ) ) {
//Show the icon
wp_redirect( $icon );
} else {
//Show nothing
header( 'Content-Type: image/vnd.microsoft.icon' );
@Dan0sz
Dan0sz / host-anything-locally.php
Last active April 7, 2021 15:06
Script to host any javascript file locally, which can be scheduled using Crontab
<?php
// Script to update any js-file
// Credits go to: Matthew Horne
// Remote file to download
$remoteFile = 'https://www.google-analytics.com/analytics.js';
$localFile = '/path/to/your/webroot/analytics.js';
// Check if directory exists, otherwise create it.
$uploadDir = '/path/to/your/webroot/';
@bogdan-mainwp
bogdan-mainwp / file-uploader-allow-filetypes.php
Last active August 30, 2023 07:00
Custom code snippet that allows you to allow and/or disallow filetyps for the File Uploader extension.
<?php
// Add the following code snippet to the PHP section of the MainWP Custom Dashboard Extension
add_filter('mainwp_file_uploader_allowed_file_types', 'mycustom_mainwp_file_uploader_allowed_file_types');
function mycustom_mainwp_file_uploader_allowed_file_types( $types ) {
$types[] = 'htaccess';
return $types;
}
@lukecav
lukecav / functions.php
Last active November 29, 2021 14:16
Disable background image regeneration in WooCommerce 3.3
add_filter( 'woocommerce_background_image_regeneration', '__return_false' );

Setup

To work on this project locally, you'll need to do the following:

  • Make sure you have a couple prereqs installed on your computer
  • Install Virtualbox, Vagrant, VVV and VV
  • Create a new WP site using VV
  • Download a copy of the live site's db and add it to our local site.
  • Install a couple VIP specific things
  • Start working on the site
@timwhitlock
timwhitlock / loco-loader.php
Last active October 17, 2023 17:28
Standalone version of Loco_hooks_LoadHelper
<?php
/*
Plugin Name: Loco Standalone Loader
Description: Mimics Loco_hooks_LoadHelper without dependency on the main plugin
Author: Tim Whitlock
Version: 1.0
*/
new LocoStandaloneLoadHelper;
@chuckreynolds
chuckreynolds / disable-rest-endpoints.php
Created February 20, 2017 02:03
WordPress: Disable WP REST API JSON endpoints if user not logged in
<?php
/*
* Disable WP REST API JSON endpoints if user not logged in
*/
function chuck_disable_rest_endpoints( $access ) {
if( ! is_user_logged_in() ) {
return new WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'disable-json-api' ), array( 'status' => rest_authorization_required_code() ) );
}
return $access;
}
@xlplugins
xlplugins / gravityxl-scheduled-export-entry.php
Last active July 6, 2023 03:38
Schedule Export for Gravity Forms Entries
<?php
/**
* @package Gravity XL Scheduled Entries Export
* @version 1.0
* @name gravityxl -scheduled-entries-export
* @author Gravity XL
*/
/**
* Schedule gform Entry export
*
@petskratt
petskratt / .htaccess
Last active May 22, 2019 07:10
Perishable Press 6G firewall with slight modifications (archive.org bot enabled, no IP blocking part)
# 6G FIREWALL/BLACKLIST
# @ https://perishablepress.com/6g/
# 6G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} (eval\() [NC,OR]
RewriteCond %{QUERY_STRING} (127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} ([a-z0-9]{2000}) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:)(.*)(;) [NC,OR]