Skip to content

Instantly share code, notes, and snippets.

<<<<<<< HEAD
filterLists.init($('.filter-list-item'), function (o) {
for (var i = 0; i < o.length; i++) {
var closestBucket = $('.filter-'+o[i]+'-bucket').parents('.filter-bucket').find('.filter-toggle-btn');
filterCollapse.closed(closestBucket);
}
$('.sidebar .filter-bucket').slideDown();
});
=======
<?php
class Some_Child_Theme {
public function __construct() {
$this->hooks();
}
public function hooks() {
@technosailor
technosailor / gist:5365754
Last active December 16, 2015 02:49
When moving a WordPress Multisite blog to a standalone WordPress install that will then be converted to Multisite with new subsites... we can't have users having capabilities and other usermeta that are iodentified for a particular blog id that will change in the future. So this monstrosity selects everything except options that are prefixed wp_…
CREATE OR REPLACE
VIEW v AS
SELECT DISTINCT(meta_key)
FROM wp_usermeta
WHERE NOT( meta_key REGEXP '^wp_5_{1}')
AND (meta_key REGEXP '^wp_(.)+');
DELETE FROM wp_usermeta
WHERE meta_key IN
(SELECT * FROM v);
UPDATE wp_usermeta
@technosailor
technosailor / gist:5298174
Last active March 11, 2016 19:38
Integration of Google Maps with N number of coordinates mapped to a Letter pin Sprite. This code killed me for days before I got it right. Offering it up to anyone who can use it. Support neither offered nor implied. YMMV.
var pin_sprite = '{"A":{"x":0,"y":0},"B":{"x":0,"y":84},"C":{"x":0,"y":168},"D":{"x":0,"y":252},"E":{"x":0,"y":336},"F":{"x":0,"y":420},"G":{"x":0,"y":504},"H":{"x":0,"y":588},"I":{"x":0,"y":672},"J":{"x":0,"y":756},"K":{"x":0,"y":840},"L":{"x":0,"y":924},"M":{"x":0,"y":1008},"N":{"x":0,"y":1092},"O":{"x":0,"y":1176},"P":{"x":0,"y":1260},"Q":{"x":0,"y":1344},"R":{"x":0,"y":1428},"S":{"x":0,"y":1512},"T":{"x":0,"y":1596},"U":{"x":0,"y":1680},"V":{"x":0,"y":1764},"W":{"x":0,"y":1848},"X":{"x":0,"y":1932},"Y":{"x":70,"y":0},"Z":{"x":70,"y":84}}';
pin_sprite = jQuery.parseJSON(pin_sprite);
function initialize() {
var mapOptions = {
zoom: 10,
center: new google.maps.LatLng(0,0),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
@technosailor
technosailor / ab-duplicate-blog-ms.php
Last active December 14, 2015 12:59
Class to duplicate one Multisite blog to another
<?php
/*
Plugin Name: AB Duplicate Blog
Author: Aaron Brazell
Version: 1.0-beta
Description: Duplicate a WordPress Multisite blog into a new one, transferring options, taxonomies, etc
*/
class AB_Duplicate_Blog {
<?php
class AF_Metaboxes {
public function __construct() {
$this->hooks();
}
public function hooks() {
add_action( 'add_meta_boxes', array( $this, 'metaboxes' ) );
<?php
class Example_Plugin_Class {
public function __construct()
{
$this->hooks();
}
protected function hooks()
{
<?php
/*
Plugin Name: Pop Up Once
Plugin URI: https://gist.github.com/4394411
Description: Quick plugin to create a modal popup form
Author: Aaron Brazell
Author URI: http://technosailor.com
Version: 1.0
*/
@technosailor
technosailor / ab-bp-retroactiveusers.php
Created October 25, 2012 16:41
Populate WordPress User Meta so that even users who have never logged in will display on the Members BP page
<?php
/*
Plugin Name: Retroactive BP User Acticity
Plugin URI: https://gist.github.com/3953927
Description: Makes all BuddyPress users visible immediately on user creation and retroactively adjust users to allow for their display before logging in.
Author: Aaron Brazell
Version: 1.0
Author URI: http://technosailor.com
License: MIT
License URI: http://opensource.org/licenses/MIT
<?php
/**
* Logs messages/variables/data to browser console from within php
*
* @param $name: message to be shown for optional data/vars
* @param $data: variable (scalar/mixed) arrays/objects, etc to be logged
* @param $jsEval: whether to apply JS eval() to arrays/objects
*
* @return none
* @author Sarfraz