Skip to content

Instantly share code, notes, and snippets.

View Critter's full-sized avatar

Critter Critter

View GitHub Profile
@Critter
Critter / ticketsplus_woocommerce-products.php
Created September 26, 2017 20:37 — forked from theeventscalendar/ticketsplus_woocommerce-products.php
Allows customers to access the WooCommerce product page for tickets with Tickets Plus
<?php
/*
* Causes WooCommerce Ticket product pages to stop redirecting to their event page
* See https://theeventscalendar.com/knowledgebase/selling-tickets-from-the-woocommerce-products-page/
*/
function tribe_wootix_no_hijack() {
if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) return;
$woo_tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'post_type_link', array( $woo_tickets, 'hijack_ticket_link' ), 10, 4 );
@Critter
Critter / functions.php
Created September 26, 2017 20:32 — forked from cliffordp/functions.php
Event Tickets Plus and WooCommerce: Set child input based on forced quantity sync with parent input.
<?php
/**
* Event Tickets Plus and WooCommerce:
* Set child input based on forced quantity sync with parent input.
*
* You need to edit the product IDs (1129 parent and 1128 child in this example code)
*
* From https://gist.github.com/cliffordp/5a769159a2bf64f0b1b1dbbde243d109
* GIF preview: https://cl.ly/1F1N0h211b1w
*
@Critter
Critter / func.php
Created April 26, 2017 14:53
function to add phone number to tickets pro export and split out customer name
function attendee_export_add_phone_split_name( $items ) {
$count = 0;
foreach ( $items as &$attendee_record ) {
// Add the header columns
if ( 1 === ++$count ) {
$attendee_record[] = 'First Name';
$attendee_record[] = 'Last Name';
$attendee_record[] = 'Phone';
}
@Critter
Critter / Workupload Ad-Block Removal.user.js
Last active April 30, 2016 13:41
UserScript to remove the Ad-Block Blocking from workupload.com
// ==UserScript==
// @name Workupload Ad-Block Removal
// @namespace http://tampermonkey.net/
// @version 0.8
// @description Removes the sad crying girl that blocks workupload.com when ad-block is active
// @author Critter
// @match http://tampermonkey.net/index.php?version=4.0&ext=dhdg&updated=true
// @grant none
// @include http://workupload.com/*
// @include http://www.workupload.com/*
@Critter
Critter / FCPrivateBatteryStatus.m
Created January 30, 2016 00:36
How to get raw battery info (mAh remaining, etc.) from iOS using private APIs. For internal testing only, NOT APP STORE DISTRIBUTION!
#import <Foundation/Foundation.h>
#include <dlfcn.h>
NSDictionary *FCPrivateBatteryStatus()
{
static mach_port_t *s_kIOMasterPortDefault;
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options);
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name);

Keybase proof

I hereby claim:

  • I am critter on github.
  • I am critter (https://keybase.io/critter) on keybase.
  • I have a public key whose fingerprint is D192 0005 1829 205C FFB4 734C 5B7F 272A A63B 6BD7

To claim this, I am signing this object:

@Critter
Critter / functions.php
Created June 8, 2015 02:54
Create 2-column forms using gravity forms
function gform_column_splits($content, $field, $value, $lead_id, $form_id) {
if(!is_admin()) { // only perform on the front end
if($field['type'] == 'section') {
$form = RGFormsModel::get_form_meta($form_id, true);
// check for the presence of multi-column form classes
$form_class = explode(' ', $form['cssClass']);
$form_class_matches = array_intersect($form_class, array('two-column', 'three-column'));
// check for the presence of section break column classes
@Critter
Critter / functions.php
Last active August 29, 2015 14:20
prevent posting to Wordpress
add_filter( 'wp_insert_post_data', 'post_publish_filter_wpse_82356' );
function post_publish_filter_wpse_82356( $data ) {
// view/manipulate $data
// we still need to be able to post pages and products so just kill off attempted posts
if ('publish' == $data['post_status'] && 'post' == $data['post_type']) {
$msg = '<pre>' . var_export($data, true) . '</pre>';
wp_die($msg);
}
return $data;
}
@Critter
Critter / node.cmd
Created February 13, 2015 21:21
Install and link node with brew
Critter:lib critter$ brew install node
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/node-0.12.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring node-0.12.0.yosemite.bottle.1.tar.gz
==> Caveats
If you update npm itself, do NOT use the npm update command.
The upstream-recommended way to update npm is:
npm install -g npm@latest
Bash completion has been installed to:
<?php
/*
Plugin Name: Convert Custom Taxonomy to Custom Post Type
Plugin URI: N/A
Description: A plugin to convert a Custom Taxonomy to a Custom Post Type and transfer associated metadata.
Version: 0.1
Author: Strap1
Author URI: http:/www.hiphopinenglish.com
/** Convert Taxonomy '%name%' to CPT '%name%' **/