Skip to content

Instantly share code, notes, and snippets.

View Xtremefaith's full-sized avatar
:bowtie:
I may be slow to respond.

Nick Worth Xtremefaith

:bowtie:
I may be slow to respond.
View GitHub Profile
@Xtremefaith
Xtremefaith / ST2 Snippets.md
Last active December 20, 2015 23:49
Sublime Text Snippets

Inline PHP

<snippet>
    <content><![CDATA[
<?php ${1:${TM_SELECTED_TEXT}} ?>
]]></content>
	<tabTrigger>?</tabTrigger>
	<description>Inline PHP</description>
</snippet>
@Xtremefaith
Xtremefaith / Widget-Form.php
Created December 3, 2013 18:07
This is a quick basic template for WordPress widget forms function. Passing an array through a loop that creates the fields. This can be expanded to included columns, but that is not the intention of this gist. Currently only builds TEXT & SELECT fields
<?php
function form($instance){
/** Merge with defaults */
$instance = wp_parse_args( (array) $instance, $this->defaults ); //Only if you set defaults in constructor (i.e.- $this->defaults = array(); )
extract ( $instance, EXTR_SKIP);
//Create new fields by adding to this array
$fields = array(
'title' => array(
'label' => __( 'Title', 'div' ),
@Xtremefaith
Xtremefaith / ignore_wp-config.md
Last active December 30, 2015 04:59
Developing locally? Here's a quick snippet for ignoring your local wp-config.php settings

Developing locally? Here's a quick snippet for ignoring your local wp-config.php settings

git update-index --assume-unchanged -- wp-config.php

Thanks to Linquize: http://stackoverflow.com/a/14513920/1058371

####Use on other settings files as well

git update-index --assume-unchanged -- wp-content/sftp-config.json

@Xtremefaith
Xtremefaith / Submenu Touch Devices.js
Created December 10, 2013 18:55
Ever have trouble getting hover effects to work on mobile devices that don't have :hover events? Sub-menus are a common area with this problem, here is a snippet of how you can resolve that.
/*!
Fix for iOS touch/hover event with submenus
*/
$('.nav .parent').on('click', function(){
  $(this).find('.submenu').slideToggle('fast');
});
$(document).on('touchstart click', function(){
  if(!$(this).hasClass('.parent')){
    $('.parent .submenu').fadeOut('fast');
  }
@Xtremefaith
Xtremefaith / Spawn SSH Agent
Created December 18, 2013 16:44
Start your SSH as soon as you open your terminal so you don't have to keep entering your passphrase throughout that session. Enter this at the bottom of your .bashrc file
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
@Xtremefaith
Xtremefaith / git_aliases.md
Last active January 4, 2016 07:49
All kinds of helpful aliases and configuration options. Check them out!

##Basics --st: status

git config --global alias.st status 

--ci: commit -m

git config --global alias.ci 'commit -m'

@Xtremefaith
Xtremefaith / Blank-Search.php
Last active August 29, 2015 13:57
Want to redirect a user who enters a blank search request, here is a snippet to help with that.
add_filter( 'request', 'my_request_filter' );
function my_request_filter( $query_vars ) {
if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) {
$query_vars['s'] = " ";
}
return $query_vars;
}
@Xtremefaith
Xtremefaith / Intro to Grunt.md
Last active August 29, 2015 14:10
Grunt Setup
@Xtremefaith
Xtremefaith / div-framework_redirect-navigation-logo.php
Last active October 1, 2015 23:51
By default the Div Framework navigation logo links to the home page, but if you want to redirect it to a custom link you would add this filter in the functions.php of your child theme.
/**
* REDIRECT NAVIGATION LOGO
* Used to redirect the navigation logo to a custom link
*/
add_filter( 'nav_logo', function($s){
$pattern = "/(?<=href=(\"|'))[^\"']+(?=(\"|'))/";
return preg_replace($pattern,$new_url,$s);
});
@Xtremefaith
Xtremefaith / .bash_profile
Created March 14, 2017 03:12 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management