Skip to content

Instantly share code, notes, and snippets.

View trulycool's full-sized avatar

Morgan Leininger trulycool

View GitHub Profile
@chrisguitarguy
chrisguitarguy / menu-order.php
Created October 20, 2011 15:57
Add menu order to WordPress posts
<?php
/*
Plugin Name: Add Menu Order to Posts
Plugin URI: http://pmg.co/category/wordpress
Description: Adds menu order and template to post types.
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
parse_git_tag () {
git describe --tags 2> /dev/null
}
parse_git_branch_or_tag() {
local OUT="$(parse_git_branch)"
@goldhand
goldhand / :nth-child React Component Factory .js
Created June 9, 2016 19:56
Factory for creating React components with nth-child css selector like properties.
import React, {Component, PropTypes} from 'react';
/**
* createNthChild is a factory for NthChild components.
*
* Can set conditional styling meant to simulate css's nth-child pseudo selector
*
* @param {object} [options] - styles options to pass into the icon panel
* @param {function} [styleFirst] - if isFirst, invoke styleLast(options.styles)
@davemac
davemac / pullprod
Last active July 10, 2021 03:42
bash alias using WP-CLI to pull a remote WP database into a local site
# pull a production WP database to an existing local site
# uses current directory as theme path and ssh alias
pullprod() {
START=$(date +%s)
# get current directory name, used for database and URL
# TODO: use echo get_template_directory() and get characters from right to first /
current=${PWD##*/}
cd ~/Sites/$current
# make a backup of the current local database
wp db export _db.sql
@dan-dr
dan-dr / .zshrc
Last active July 26, 2021 22:44
Kill webpack-dev-server with babun on windows
# usage: killwebpack [port]
# if no port is supplied then default port is 3000
function killwebpack() {
PORT=3000
if [ -n "$1" ]
then
PORT=$1
fi