Skip to content

Instantly share code, notes, and snippets.

Avatar

Greg Schoppe gschoppe

View GitHub Profile
View Class-ImageScaler.js
function ImageScaler(content) {
this.canvas = document.createElement("CANVAS");
this.focus = {x:.5,y:.5};
this.zoom = 1;
this.loadFromContent = function(content) {
var self = this;
return new Promise(function(resolve, reject) {
self.tempImg = document.createElement("IMG");
self.imageToCanvas = function() {
this.canvas.width = self.tempImg.width;
View Class-IntervalManager.js
function IntervalManager() {
this.intervals = [];
// Public
this.setInterval = function(callback, interval, name) {
if (!name) {
name = "" + Date.now() + "|" + Math.random();
}
var newInterval = {
'name': name,
View Class-DB.gs
function DB(projectID) {
this.projectID = projectID;
this.types = {
'INT64' : "INT64",
'NUMERIC' : "NUMERIC",
'BIGNUMERIC': "BIGNUMERIC",
'FLOAT64' : "FLOAT64",
'BOOL' : "BOOL",
'STRING' : "STRING",
@gschoppe
gschoppe / wp_update_watch.php
Created Dec 6, 2018
WordPress Update Watch
View wp_update_watch.php
<?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);
@gschoppe
gschoppe / marvelous-wololo-contact-form.php
Last active Oct 8, 2018 — forked from MarvelousWololo/functions.php
step by step rework of marvelouswololo's contact form code
View marvelous-wololo-contact-form.php
<?php
/*
Plugin Name: Marvelous Wololo Contact Form
Plugin URI: https://gist.github.com/MarvelousWololo/fb6488b1e9ad92c6c8d6fd91ed8b55d4
Description: Adds a custom contact form shortcode
Version: 0.0.1
Author: Marvelous Wololo
Author URI: https://reddit.com/user/MarvelousWololo
*/
@gschoppe
gschoppe / multibox_display_box_dimensions.php
Last active Sep 20, 2018
This function will return formatted HTML to display box dimensions and weights for multibox and non-multibox products
View multibox_display_box_dimensions.php
<?php
function get_multibox_dimension_output( $product_id = false ) {
$product = wc_get_product( $product_id );
if( !$product ) {
return;
}
$output = '';
$boxes = get_post_meta( $product->ID, '_wc-multibox-additional-boxes', true );
@gschoppe
gschoppe / functions.php
Created Aug 21, 2018
Add Featured Image Tag to Timber
View functions.php
<?php
/* populates the twig tag {{ featured_image_tag }} */
add_filter('timber_context', function( $context ){
$context['featured_image_tag'] = get_the_post_thumbnail( null, 'full' );
return $context;
});
@gschoppe
gschoppe / admin-bar-for-weglot.php
Last active Oct 12, 2018
Adds a "Translate" button to the admin bar, on post-edit and front end pages, that links directly to the WeGlot visual editor for that page.
View admin-bar-for-weglot.php
<?php if(!defined('ABSPATH')) { die(); }
/*
Plugin Name: Admin Bar for WeGlot
Plugin URI: https://gschoppe.com
Description: Adds an admin bar link to translate any page on your site
Version: 0.1.0
Author: Greg Schoppe
Author URI: https://gschoppe.com
Text Domain: weglotadminbar
@gschoppe
gschoppe / wp-jslabify-titles.php
Last active Mar 22, 2018
add to functions.php to allow WP jSlabify to slab post titles
View wp-jslabify-titles.php
<?php
add_filter( 'the_title', 'wp_jslabify_title', 10, 2 );
function wp_jslabify_title( $title, $id=0 ) {
$slabbed_post_types = array(
'single' => array( 'post', 'page' ),
'archive' => array(),
'search' => array()
);
$theme = 'ultra';
You can’t perform that action at this time.