Skip to content

Instantly share code, notes, and snippets.

@glueckpress
glueckpress / wp-rocket-disable-preload.php
Last active August 15, 2025 20:25
[WordPress][WP Rocket] Prevents WP Rocket’s preload bot from visiting your site.
<?php
/**
* Plugin Name: WP Rocket | Disable Cache Preloading
* Description: Prevents WP Rocket’s preload bot from visiting your site.
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* Plugin URI: https://gist.github.com/glueckpress/a6c1f7a22a92e8e8bb10
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
@chriscct7
chriscct7 / gist:d7d077afb01011b1839d
Last active January 24, 2024 04:20
Plugins that need to be updated to be ready for the move to PHP 5 constructors

Important Notice for WordPress Plugins Using PHP 4 Style Constructors

The ability to use PHP 4 style constructors is getting removed from PHP. Without an update, many plugins will eventually no longer work (this is PHP breaking this backwards compatibility, not WordPress)

One of the more common uses of the PHP 4 style constructor (as opposed to PHP 5 style __construct() ) are plugins with widgets calling WP_Widget::WP_Widget() and/or parent::WP_Widget() and/or {object}->WP_Widget()

Note: Starting in WordPress 4.3, regardless of the PHP version in use on a server, WordPress will throw a deprecated notice when one of the PHP 4 style constructors is called specifically for widgets.

Basically instead of doing these:

@toddheslin
toddheslin / wufooUrlParams.js
Last active December 22, 2016 15:27
Setting url params as variables in Wufoo embed form
/*
// The following code is from @dorward answering a stackoverflow question.
// Like the Wufoo embed, it doesn't rely on jQuery. Thanks @dorward!
*/
<div id="wufoo-m2oq9xw0yusu89"></div>
<script type="text/javascript">
var QueryString = function () {
/*
This function is anonymous, is executed immediately and
@pbojinov
pbojinov / parseAnalyticsCookie.js
Last active August 8, 2019 09:32
Parse Google Analytics __utmz cookie
// inspiration from http://stackoverflow.com/questions/1688657/how-do-i-extract-google-analytics-campaign-data-from-their-cookie-with-javascript
// readCookie is from // http://www.quirksmode.org/js/cookies.html
// utmcsr = utm_source
// utmccn = utm_campaign
// utmcmd = utm_medium
// utmctr = utm_term
// utmcct = utm_content
var parseAnalyticsCookie = function() {
var values = {};
@bradp
bradp / setup.sh
Last active August 21, 2025 15:06
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active September 30, 2025 20:46
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@TheHiddenHaku
TheHiddenHaku / console_log.php
Last active August 29, 2015 14:06
PHP - Function to log data in javascript console
<?php
//UTILITY TO CONSOLE LOG DEBUG OUTPUT
function console_log($data, $table = 0) {
$verb = $table ? 'table' : 'log';
if(is_array($data) || is_object($data)) {
echo "<script>console.".$verb."(".json_encode($data).");</script>" ;
} else {
echo "<script>console.".$verb."(".$data.");</script>" ;
}
}
class MercatorProjection
TILE_SIZE = 256
constructor: ->
@pixelOrigin_ = new google.maps.Point(TILE_SIZE / 2, TILE_SIZE / 2)
@pixelsPerLonDegree_ = TILE_SIZE / 360
@pixelsPerLonRadian_ = TILE_SIZE / (2 * Math.PI)
bound: (value, opt_min, opt_max) ->
value = Math.max(value, opt_min) if opt_min is not null
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 8, 2025 15:03
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.