Skip to content

Instantly share code, notes, and snippets.

View gschoppe's full-sized avatar

Greg Schoppe gschoppe

View GitHub Profile
@gschoppe
gschoppe / wp_update_watch.php
Created December 6, 2018 16:35
WordPress Update Watch
<?php
if( !empty($_GET['request']) ) {
$current_version = "";
$url = "https://api.wordpress.org/core/version-check/1.7/";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url
));
$result = curl_exec($curl);
function DB(projectID) {
this.projectID = projectID;
this.types = {
'INT64' : "INT64",
'NUMERIC' : "NUMERIC",
'BIGNUMERIC': "BIGNUMERIC",
'FLOAT64' : "FLOAT64",
'BOOL' : "BOOL",
'STRING' : "STRING",
@gschoppe
gschoppe / Class-IntervalManager.js
Last active January 24, 2021 19:43
Class to simplify management of intervals
function IntervalManager() {
this.intervals = [];
// Public
this.setInterval = function(callback, interval, name) {
if (!name) {
name = "" + Date.now() + "|" + Math.random();
}
var newInterval = {
'name': name,
@gschoppe
gschoppe / Class-ImageScaler.js
Last active January 30, 2021 17:09
A simple JS class to manage client-side cropping. ImageScaler supports setting a focal point for the image, as well as selecting a zoom level for the crop
function ImageScaler(canvas, focus, zoom) {
if (canvas) {
this.canvas = canvas;
} else {
this.canvas = document.createElement("CANVAS");
}
if (focus) {
this.focus = focus;
} else {
this.focus = {x:.5,y:.5};
@gschoppe
gschoppe / Class-CropInterface.js
Last active January 31, 2021 17:21
A simple class to convert a div, or other block-level element, into a zoom and crop interface for images. Sample Implementation: https://codepen.io/gschoppe/pen/xxRxwaO
function CropInterface(el, w, h, resolutionMultiple) {
// handle parameters
this.el = el;
if (!w) { w = 100; }
this.w = w;
if (!h) { h = 100; }
this.h = h;
this.r = w / h;
if (!resolutionMultiple) { resolutionMultiple = 1; }
this.resolutionMultiple = resolutionMultiple;
@gschoppe
gschoppe / bad-matt.php
Last active December 6, 2024 06:24
This is a protest plugin in response to the unacceptable behavior of Matt Mullenweg (BDFL of WordPress). In a propaganda interview, Matt claimed that one of the unacceptable things that WPEngine did was to strip out the stripe partner id from woocommerce's stripe gateway plugin. Not only does this appear to be false, but it is in no way a violat…
<?php defined('ABSPATH') or die();
/*
* Plugin Name: Bad Matt
* Plugin URI: https://gschoppe.com
* Description: A protest plugin that removes (or replaces via filter) the Automattic-owned woocommerce stripe gateway partner id.
* Version: 1.0.0
* Requires at least: 4.0
* Requires PHP: 7.2
* Author: Greg Schoppe
* Author URI: https://gschoppe.com/