Skip to content

Instantly share code, notes, and snippets.

Avatar

David Sword davidsword

View GitHub Profile
View vip-remove-old-revisions-command.php
<?php
if ( ! class_exists( 'WPCOM_VIP_CLI_Command' ) || ! ( defined( 'WP_CLI' ) && WP_CLI ) ) {
return;
}
WP_CLI::add_command( 'vip-remove-old-revisions', 'VIP_Remove_Old_Revisions_Command' );
class VIP_Remove_Old_Revisions_Command extends WPCOM_VIP_CLI_Command {
@davidsword
davidsword / terminal-cheatsheet.md
Last active Apr 25, 2018
🔥🍺 Terminal Cheat Sheet
View terminal-cheatsheet.md
@davidsword
davidsword / mysql-cheat-sheet.md
Last active Jan 17, 2021
🔥🍺 MySQL cheat sheet
View mysql-cheat-sheet.md
@davidsword
davidsword / htaccess-cheat-sheet.md
Last active Apr 14, 2018
🔥🍺 HTACCESS CHEAT SHEET
View htaccess-cheat-sheet.md
@davidsword
davidsword / lamp.md
Last active Jul 10, 2018
🔥🍺 CHEAT SHEETS 🍺🔥 - Opens on Alfred keyword: "help"
View lamp.md
@davidsword
davidsword / WP-gravityformshiderecaptcha.php
Last active Feb 8, 2018
Hide the recaptcha field in a gravity form until the user has started entering text.
View WP-gravityformshiderecaptcha.php
<?php
add_action( 'wp_footer', 'ds_gf_footer', 99);
function ds_gf_footer() {
?>
<script>
jQuery(window).load(function() {
jQuery('.gform_wrapper').each(function(){
var recaptcha = jQuery(this).find('.ginput_recaptcha');
if (recaptcha) {
recaptcha.parent().hide();
@cwhittl
cwhittl / fetch_plugin.js
Created Apr 13, 2017
Using Fetch with Wordpress Plugins Ajax
View fetch_plugin.js
fetch(ajax_url, {
method: 'POST',
credentials: 'same-origin',
headers: new Headers({'Content-Type': 'application/x-www-form-urlencoded'}),
body: 'action=zget_profile_user'
})
.then((resp) => resp.json())
.then(function(data) {
if(data.status == "success"){
_this.setState({loaded:true,user:data.user});
@dverbovyi
dverbovyi / gulpfile.js
Last active Jan 19, 2021
ES6 project with Gulp, Sass, Babel & Browserify
View gulpfile.js
/**
* Created by Dmytro on 3/27/2016.
*/
var browserify = require('browserify'),
gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active Jun 10, 2021
Using Git to Manage a Live Web Site
View Using Git to Manage a Live Web Site.md

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@JustThomas
JustThomas / wordpress-multisite-internal-redirect-loop.md
Last active May 7, 2021
WordPress Multisite: How to fix error "too many redirects"
View wordpress-multisite-internal-redirect-loop.md

WordPress Multisite: How to fix error "Request exceeded the limit of 10 internal redirects"

I am running a WordPress multisite network with sub-directory setup. When I check my error.log file, it is full of entries like this one:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'Limit InternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

The problem was, in my case, one specific rewrite rule in the .htaccess file.

Problem description