Skip to content

Instantly share code, notes, and snippets.

View tw2113's full-sized avatar
💭
Chunt's up with that?

Michael Beckwith tw2113

💭
Chunt's up with that?
View GitHub Profile
@tw2113
tw2113 / class.WDS_JetPack_Popular_Posts.php
Last active March 28, 2022 18:54
JetPack Popular Posts class.
@tw2113
tw2113 / gist:6920154
Last active January 13, 2024 03:07
Taxonomy Terms in Permalink
<?php
/*
Plugin Name: Enhance Insurance - Taxonomy Term In Permalink
Plugin URI: http://www.webdevstudios.com
Description: Add CPT taxonomy terms to permalink
Version: 1.0.0
Author: WebDevStudios
Author URI: http://www.webdevstudios.com
License: GPLv2
@tw2113
tw2113 / gist:2439397
Created April 21, 2012 20:22
Achoo and the Sneezes Mix CDs Tracklist
/*
Nothing special here. My car still has a CD player, I make mix cds to listen to when driving places. Felt like copying down the tracklist of each one for my fake band "Achoo and the Sneezes". Because I'm a nerd, I jsonified the lists.
*/
{"albums":[{
"album": "33 1/3 Monkeys Without Creativity is Deprivation",
"tracks":[
"James - Out To Get You",
"Pigeonhed - Fire's Coming Down",
"Oingo Boingo - Stay",
"Smashing Pumpkins - 1979",
@tw2113
tw2113 / gist:1804843
Last active January 13, 2024 02:10
Random color on hover
color_classes = ['green','purple','violet','teal','pink'];
(function() {
const initLinks = function() {
const div = document.querySelector('#mydiv');
console.log(div)
div.addEventListener('mouseover',function(){
color_classes.forEach(color =>{
div.classList.remove(color);
});
div.classList.add(randomFrom(color_classes));
//$sec_header is supposed to be $gistgit
$gistgit = wp_remote_retrieve_body( wp_remote_get('https://api.github.com/users/'. $user .'/gists', array('timeout' => 10)));
if( is_wp_error($gistgit)) {
$error_string = $sec_header->get_error_message();
echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
wp_die('');
}
@tw2113
tw2113 / gist:990405
Created May 25, 2011 05:31
Macho Man Randy Savage
<?php //RIP Randall Mario Poffo
function macho_man_randy_savage() {
static $elbow_drops = 3;
if(!$elbow_drops) return 'oooooooooooooooohhhhhhhhhhhhhhhh yeeeeeeeeeeeeeeeeaaaaaaaahhhhhh';
$elbow_drops--;
}
//will show phrase on 4th call and every call after.
echo macho_man_randy_savage();