Skip to content

Instantly share code, notes, and snippets.

function mamptowordpress {
dir=/Applications/MAMP/conf/apache
rm $dir/httpd.conf
ln -s $dir/httpd-wordpress.conf $dir/httpd.conf
stopMAMP
# startMAMP
echo "Happy Wordpress Developing!"
}
function cdtheme {
dir=${PWD##*/}
cd wp-content/themes/$dir
}
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}
$(window).resize(function(){
waitForFinalEvent(function(){
yourFunction();
}, 500, "unique id");
});
/**************************************
*// Wait For It...
**************************************/
var waitForFinalEvent = (function () {
/**************************************
*// Dynamic Word Wrapping
**************************************/
function wrapWords() {
var element = document.getElementById('element-id'); // grab entry-title element
if (element != null) { // make sure it is on this page
var string = element.innerHTML; // grab its contents
string = string.replace(/<(?:.|\n)*?>/gm, ''); // strip it of any html elements (i.e. a <br> from previous run through)
var array = string.split(" "); // break the string into an array of words
element.innerHTML = ""; // delete the element's contents
@zachfedor
zachfedor / git-get-big.sh
Created March 31, 2015 12:44
Get the biggest objects in a Git repo
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output
@zachfedor
zachfedor / wp-complete.sh
Created March 31, 2015 12:46
Bash completion for WP-CLI
# bash completion for the `wp` command
_wp_complete() {
local cur=${COMP_WORDS[COMP_CWORD]}
IFS=$'\n'; # want to preserve spaces at the end
local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
if [[ "$opts" =~ \<file\>\s* ]]
then
@zachfedor
zachfedor / git-prompt
Created June 3, 2015 13:45
Bash Prompt featuring colors, username, working directory, git branch, and a new line for the prompt.
# Grabs the current git branch for prompt
function current_git_branch {
BRANCH="$(git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})"
if [ "$BRANCH" == "" ]
then
echo "-"
else
echo "$BRANCH"
fi
}
@zachfedor
zachfedor / npm dist-tag failure
Created June 15, 2015 14:53
npm debug log when npm dist-tag add fails with non-unique package name
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'dist-tag',
1 verbose cli 'add',
1 verbose cli 'how-to-node@1.0.1',
1 verbose cli 'testing' ]
2 info using npm@2.11.2
3 info using node@v0.12.2
4 verbose dist-tag add testing to how-to-node@1.0.1
@zachfedor
zachfedor / init.lua
Created September 21, 2015 12:49
Hammerspoon Config File
------------------------
-- Hammerspoon Init --
------------------------
-- Global Variables
gutter = 20
editor = "Atom"
-- Welcome Messages
hs.hotkey.bind({"cmd", "ctrl"}, "W", function()