Skip to content

Instantly share code, notes, and snippets.

View drywall's full-sized avatar

Ben Byrne drywall

View GitHub Profile
<?php
add_filter('rocket_htaccess_mod_expires', 'wp_rocket_remove_html_expire_dreampress');
/**
* Remove expiration on HTML to prevent issue with Varnish cache
*
* @param string $rules htaccess rules.
* @return Updated htaccess rules
*/
function wp_rocket_remove_html_expire_dreampress( $rules ) {
@aschweigert
aschweigert / gist:f5dd03e04bea91797c0c
Last active December 29, 2015 14:29
Standalone WP -> Multisite migration queries
[prefix] is needed to push the new users/usermeta values outside of the range already populated in the database, usually for a site with an ID of 40 using 40,000 will work pretty well (unless some of your sites have a lot of users).
UPDATE wp_users
SET ID = ID + [prefix]
// Add two columns to the end of the wp_users table, spam and deleted. Both are TINYINT(2).
UPDATE wp_usermeta
SET user_id = user_id + [prefix]
@peterjaap
peterjaap / fixtags.php
Last active February 7, 2021 22:22
Replace PHP short open tags with long form open tags - PHP script version. Slightly adapted from https://github.com/danorton/php_replace_short_tags -- usage; find . -type f -iname "*.phtml" | xargs php -d short_open_tag=On fixtags.php --overwrite
#!php-cli
<?php
/**
* php_replace_short_tags
* Copyright © 2010 Weirdmasters, Austin, Texas
*
* License:
* CC-BY-SA v3.0
* http://creativecommons.org/licenses/by-sa/3.0/
*
@gregrickaby
gregrickaby / html5-schema.org-markup.html
Last active August 2, 2022 00:05
Proper SCHEMA.ORG markup
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noodp, noydir" />
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com">
<link rel="canonical" href="http://mysite.com/" />
<link rel="stylesheet" href="http://mysite.com/style.css" type="text/css" />
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active November 25, 2024 14:56
Using Git with Subversion Mirroring for WordPress Plugin Development
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active January 6, 2025 16:01
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@alunny
alunny / file-api-sample.js
Created April 14, 2010 18:41
sample usage of the phonegap file api
var writeData = function (filename, data, callback) {
var writeOutData = function () {
var fw = new FileWriter();
fw.oncomplete = callback;
fw.onerror = function () {
alert("Failed to save update");
}
fw.writeAsText("myDir/" + filename, data);
}