Skip to content

Instantly share code, notes, and snippets.

sudo /System/Library/Extensions/TMSafetyNet.kext/Helpers/bypass rm -rfv /Volumes/[disk]/Backups.backupdb/[path]
add_filter( 'walker_nav_menu_start_el', 'gt_add_menu_item_description', 10, 4);
function gt_add_menu_item_description( $item_output, $item, $depth, $args ) {
$desc = __( $item->post_content );
return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<small class=\"nav-desc\">{$desc}</small><", $item_output);
}
// expand {{PATTERNS}}
// You can do this serverside. I just did it this way for demonstration purposes.
(function () {
"use strict";
var shares = document.querySelectorAll("ul.share > li > a");
var keywords = document.querySelector('meta[name=keywords]').getAttribute("content");
var description = document.querySelector('meta[name=description]').getAttribute("content");
var params = {
URL: encodeURIComponent(document.querySelector('link[rel=canonical]').getAttribute("href")),
@yumyo
yumyo / deploy.sh
Last active September 7, 2015 09:04
Wordpress plugin GIT -> SNV deploy script
#! /bin/bash
#
# Script to deploy from Github to WordPress.org Plugin Repository
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.
# Source: https://github.com/thenbrent/multisite-user-management/blob/master/deploy.sh
#prompt for plugin slug
echo -e "Plugin Slug: \c"
read PLUGINSLUG
@yumyo
yumyo / toggleClass.js
Created November 13, 2012 15:43
JavaScript toggleClass Function
/**
* @author Joshua Heller
*/
function hasClass(ele, cls) {
return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
}
function addClass(ele, cls) {
if (!this.hasClass(ele, cls))
ele.className += " " + cls;
@yumyo
yumyo / toggleclass.js
Created November 13, 2012 15:43
JavaScript toggleClass() function
/**
* toggleClass()
* Expects parameters
* elem = DOM element (object, instanceof HTMLElement)
* cl = Class name (string)
*/
var toggleClass = function(elem, cl) {
if (elem.className.indexOf(cl) != -1) {
elem.className = elem.className.replace(cl, '');
} else {
@yumyo
yumyo / remove-empty-p.php
Created November 16, 2012 17:10 — forked from ninnypants/remove-empty-p.php
Remove empty p tags from WordPress posts
add_filter('the_content', 'remove_empty_p', 20, 1);
function remove_empty_p($content){
$content = force_balance_tags($content);
return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
}
@yumyo
yumyo / unix
Created November 29, 2012 18:24
Unix Directory search
To find the largest 10 files (linux/bash):
find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
To find the largest 10 directories:
find . -type d -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
Alternatively or a quick view:
@yumyo
yumyo / SassMeister-input-HTML.html
Created October 15, 2015 12:56
Generated by SassMeister.com.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>General Asymmetric Grid</h1>
<div id="asymmetric-general">&nbsp;</div>
@yumyo
yumyo / clean-walker.php
Created October 27, 2015 15:15 — forked from hereswhatidid/clean-walker.php
WordPress nav walker that strips the WP generated styles and IDs from the generated output.
<?php
class Clean_Walker_Nav extends Walker_Nav_Menu {
/**
* Filter used to remove built in WordPress-generated classes
* @param mixed $var The array item to verify
* @return boolean Whether or not the item matches the filter
*/
function filter_builtin_classes( $var ) {
return ( FALSE === strpos( $var, 'item' ) ) ? $var : '';
}