Skip to content

Instantly share code, notes, and snippets.

@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

Keybase proof

I hereby claim:

  • I am technosailor on github.
  • I am technosailor (https://keybase.io/technosailor) on keybase.
  • I have a public key ASBukfKyoQ_Yb6W8_3tRYnyku9tkjleiNYSZ7xGRbKQCiQo

To claim this, I am signing this object:

dist: trusty
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3
add_filter( 'request' function( $query_vars ) {
if( isset( $query_vars['feed'] ) ) {
$query_vars['post_type'] = [
'post',
'page'
];
}
return $query_vars;
} );
@technosailor
technosailor / update-mysql56.sh
Created February 24, 2016 19:05
Updates VVV MySQL 5.5 to 5.6 -- Ubuntu 14.04
#!/bin/bash
# Usage: ./update-mysql56.sh
# Backup of all databases... JUST IN CASE
mysqldump --all-databases --single-transaction --events --user=root --password > ~/all_database_backup.sql
# Remove MySQL 5.5
sudo apt-get remove mysql-server
sudo apt-get autoremove
@technosailor
technosailor / check-plugin-vuln.sh
Created November 23, 2016 20:18
Check all plugins for vulnerabilities via wp-vulnerability-scanner. Requires WP-CLI.
for plugin in `wp plugin list --format=csv | cut -d , -f 1`;
do
wp vuln plugin-check $plugin;
done
<?php
/*
Plugin Name: Test
*/
class My_Like_Button {
function __construct()
{
$this->hooks();
}
@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);
<?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 / gist:8358491
Created January 10, 2014 17:21
Nothing fancy. Just a way to get your external IP. Useful for dealing with services that you have to have a white listed IP and maybe you have a lot of servers in a cluster and need to know what the external service is seeing. It's like I'm describing my own personal hell right now...
<?php
$json = file_get_contents( 'http://ifconfig.me/all.json' );
$data = json_decode( $json );
echo $data->ip_addr;