Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Timothy Wood codearachnid

🎯
Focusing
View GitHub Profile
@skyshab
skyshab / example.php
Last active Aug 2, 2021
Add organizer email to ticket emails
View example.php
<?php
function modify_woo_ticket_headers( $headers, $id ) {
remove_filter( 'woocommerce_email_headers', 'modify_woo_ticket_headers' );
$organizer_email = tribe_get_organizer_email( $id, false );
// add organizer email if it's a valid email address
if ( is_email( $organizer_email ) ) {
$headers[] = sprintf( 'Cc: %s', $organizer_email );
}
@wpscholar
wpscholar / array-insert-after.php
Created Nov 7, 2015
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
View array-insert-after.php
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*
@stsibel
stsibel / MySQL_zipcodes_within_radius.sql
Last active Aug 27, 2021
MySQL query to find zip-codes within given radius from any point (or zip-code)
View MySQL_zipcodes_within_radius.sql
/* Given table 'zipcodes' with columns:
zipcode, latitude, longitude.
Find zipcodes within radius from given zipcode.
EXAMPLE:
Coordinates for zip 91326 and radius 25 mi:
*/
SET @location_lat = 34.2766,
@location_lon = -118.544;
SELECT zipcode, ( 3959 * acos( cos( radians(@location_lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(@location_lon) ) + sin( radians(@location_lat) ) * sin( radians( latitude ) ) ) ) AS distance
@jonahcoyote
jonahcoyote / export.sql
Last active Jan 8, 2019
Sabai Directory Export SQL
View export.sql
/*
Intro:
Here are some export examples you can use to export Sabai directory data. I'm no MySQL expert and there's probably better ways to run these queries but this worked for my purposes. I hope this helps!
Note, this is going to export all columns and you'll need to manually go in and remove columns you don't need in Excel or Numbers or whatever spreadsheet program you have.
Usage:
This is meant to be run in phpMyAdmin. Look at your own table structure and modify as necessary for any custom fields, table prefix, and custom bundle. Custom fields are storedin their own tables and cross linked via entity_id which is the id of a listing.
*/
@NateWr
NateWr / imager-for-wp.php
Created Mar 12, 2014
Integrate Imager.js with WordPress
View imager-for-wp.php
<?php
/**
* Integrate Imager.js with WordPress
*
* Imager.js is BBC's solution for serving responsive and retina images, without
* the double payload issues that affect other solutions. For more information:
*
* https://github.com/BBC-News/Imager.js/
*
* This collection of functions modifies the output of WordPress's
@spivurno
spivurno / gw-gravity-forms-unrequire-required-fields-usage.php
Last active Feb 27, 2021
Gravity Wiz // Gravity Forms Unrequire Required Fields for Speedy Testing
View gw-gravity-forms-unrequire-required-fields-usage.php
<?php
# Basic Usage
# requires that the user be logged in as an administrator and that a 'gwunrequire' parameter be added to the query string
# http://youurl.com/your-form-page/?gwunrequire=1
new GWUnrequire();
# Enable for All Users (Including Visitors)
# still requires the 'gwunrequire' parameter be added to the query string
new GWUnrequire( array(
@nekman
nekman / jquery.attrMatcher.js
Last active Jan 4, 2016
jQuery attribute matcher.
View jquery.attrMatcher.js
/**
* http://plnkr.co/edit/Mou8b94hzmuIVjd7b63w?p=preview
*/
(function(global, factory) {
// CommonJS
if (typeof module === 'object') {
module.exports = factory(require('jquery'));
} else if (typeof global.define === 'function') {
// AMD
define(['jquery'], factory);
@codearachnid
codearachnid / tribe-admin-events-list.class.php
Created Nov 19, 2013
The Events Calendar: Fixed bug with improper column name when in admin main event list. Applies to TEC Pro 3.2. Notes: recently, while updating a client's website to the 3.2 plugin suite for Tribe's The Events Calendar I found that in the admin event list all the disappeared. After the normal, deactivating plugins, default theme etc I took the s…
View tribe-admin-events-list.class.php
<?php
/**
* update ~line 26 to include 2 argument params as such:
*/
add_filter( 'posts_orderby', array( __CLASS__, 'events_search_orderby' ), 10, 2 );
/**
* update static function `events_search_orderby` (replace with the following method starting at ~line 159)
*/
@spivurno
spivurno / gw-field-info-tab.php
Created Oct 25, 2013
Gravity Wiz // Gravity Forms Field Info Tab
View gw-field-info-tab.php
<?php
/**
* Gravity Forms Field Info Tab
* http://gravitywiz.com
*
* Adds a summary of your fields as a tab on the form settings screen; includes field ID, label and field type.
*
*/
class GWFieldInfo {