Skip to content

Instantly share code, notes, and snippets.

View mandiwise's full-sized avatar

Mandi Wise mandiwise

  • Edmonton, Canada
View GitHub Profile
@mandiwise
mandiwise / .gitignore
Last active December 4, 2017 19:25
Communit Project .gitignore
# COMMUNITY PROJECT GITIGNORE #
# Ignore OS files #
# =============== #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
@mandiwise
mandiwise / sql.txt
Last active May 29, 2016 19:47
Renaming WP Database Table Preifx
RENAME table `wp_commentmeta` TO `NEWPREFIX_commentmeta`;
RENAME table `wp_comments` TO `NEWPREFIX_comments`;
RENAME table `wp_links` TO `NEWPREFIX_links`;
RENAME table `wp_options` TO `NEWPREFIX_options`;
RENAME table `wp_postmeta` TO `NEWPREFIX_postmeta`;
RENAME table `wp_posts` TO `NEWPREFIX_posts`;
RENAME table `wp_terms` TO `NEWPREFIX_terms`;
RENAME table `wp_termmeta` TO `NEWPREFIX_termmeta`;
RENAME table `wp_term_relationships` TO `NEWPREFIX_term_relationships`;
RENAME table `wp_term_taxonomy` TO `NEWPREFIX_term_taxonomy`;
@mandiwise
mandiwise / .bash_profile
Created February 19, 2016 19:44
Customize bash prompt with highlighted git branch
txtcyn=$'\e[0;36m' # Cyan
txtred=$'\e[0;31m' # Red
txtwht=$'\e[0;37m' # White
txtrst=$'\e[0m' # Text Reset
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[$txtcyn\]\$(parse_git_branch) \[$txtrst\]\$ " # fancify Terminal prompt
@mandiwise
mandiwise / nav.js
Last active November 30, 2015 18:01
A simple nav-bar locking jQuery script.
/**
* Navbar Locking
*/
$(function () {
var $window = $(window),
$mainNav = $('.main-navigation'), // nav wrapper element
stickyNavTop = $mainNav.offset().top;
@mandiwise
mandiwise / hide-default-posts.php
Last active November 30, 2015 04:03
Hide post-related screens in the WordPress admin area, including Categories and Tags.
<?php
/**
* Plugin Name: Hide Default Posts
* Plugin URI: https://gist.github.com/mandiwise/2ea571ae0773b340af5a
* Description: Hide post-related screens in the WP admin area, including Categories and Tags.
* Version: 1.0.0
* Author: Mandi Wise
* Author URI: http://mandiwise.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@mandiwise
mandiwise / functions.php
Last active November 30, 2015 04:15
Customize archive title in WP
<?php
/**
* Customize the Product archive title
*/
function red_archive_title( $title ) {
if ( is_post_type_archive( 'product' ) ) {
$title = 'Our Products Are Made Fresh Daily';
} elseif ( is_tax( 'product-type' ) ) {
$title = sprintf( '%1$s', single_term_title( '', false ) );
} elseif ( is_post_type_archive( 'testimonial' ) ) {
@mandiwise
mandiwise / functions.php
Last active November 30, 2015 04:18
Custom WP excerpts (with allowed HTML tags and custom read more link)
<?php
/**
* Customize excerpt length and style.
*
* @param string The raw post content.
* @return string
*/
function red_wp_trim_excerpt( $text ) {
$raw_excerpt = $text;
@mandiwise
mandiwise / highlighting.bash
Created October 9, 2015 17:36
Use Highlight to copy and paste code with syntax highlight.
pbpaste | highlight -S css -O rtf --style moria | pbcopy
@mandiwise
mandiwise / Update remote repo
Last active April 17, 2024 07:41
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@mandiwise
mandiwise / Stop tracking directory in Git repo
Last active April 11, 2023 16:28
A command to stop tracking and entire directory in a Git repo
// Reference: http://stackoverflow.com/questions/936249/stop-tracking-and-ignore-changes-to-a-file-in-git
$ git rm --cached -r <dir>