Skip to content

Instantly share code, notes, and snippets.

View davidcasey's full-sized avatar

David Casey davidcasey

View GitHub Profile

Workflow using Git with a Gitflow process

This page documents how to use git-flow using Git in a terminal without installing the git-flow plugin.

Developing code

  1. You are editing code and get to a point you have finished something, it is time to commit.
    • Add all files
      • git add -A
    • Add all files from the current filepath
      • git add .
    • Add all files from a select filepath

Git Cheatsheet

This page documents how to use some common Git commands. It does not take into account the use of a workflow process such as GitFlow. Use your workflow as primary directions; use this page to help you with commands not included in the workflow.

Config

Tell git to run misspelled commands:

  • git config --global help.autocorrect 20 Wait 2 seconds and run it
  • git config --global help.autocorrect prompt Ask (y/N)
  • git config --global help.autocorrect immediate Do it now
  • git config --global help.autocorrect never Do it never
@davidcasey
davidcasey / cloudSettings
Created December 6, 2019 23:28
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-12-06T23:28:17.910Z","extensionVersion":"v3.4.3"}
@davidcasey
davidcasey / class.colors.php
Created September 25, 2018 22:23
Use this class to get defined colors, convert color mode, and make color adjustments
<?php
/**
* Colors and color functionality
*
* Use this class to get defined colors, convert color mode, and make color adjustments
*
* @author David R. Casey
* @link https://studiocasey.com/
* @license MIT
*/
@davidcasey
davidcasey / wp title_attribute_in_nav_el
Created December 12, 2013 18:04
menus.php Appends the title attribute to the content. This is a shortcut to creating a custom field in the menu and a custom Walker_Nav_Menu.
function title_attribute_in_nav_el( $item_output, $item, $depth, $args ) {
if ( $args->theme_location == 'front-page-menu' ) {
// Place at front
/* $item_output = preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<h5>{$item->attr_title}</h5><", $item_output );*/
// Place at end
$item_output = preg_replace( '/<\/a>/', "<h5>{$item->attr_title}</h5></a>", $item_output );
// Replace title attribute with actual Title
$item_output = preg_replace( '/(<a[^<]+?title=")[^<]+?("[^<]+?>)/', '$1' . $item->title . '$2', $item_output );
}
return $item_output;
@davidcasey
davidcasey / wp_widget.sublime-snippet
Last active December 30, 2015 08:09
Sublime Snippet: Wordpress Widget Boilerplate. The ClassName has been intentionally left last, so one can use multiple selection and change all the XXXXX at the same time.
<snippet>
<content><![CDATA[
<?php
/**
* Plugin Name: ${1:Name Of The Wordpress Widget}
* Plugin URI: http://${2:www.studiocasey.com/}
* Description: ${3:Widget description}
* Version: ${4:1.0}
* Author: ${5:David R. Casey}
* Author URI: http://${6:www.studiocasey.com/}
@davidcasey
davidcasey / html5boilerplate.sublime-snippet
Created December 27, 2012 22:50
Sublime Snippet: HTML5 Boilerplate
<snippet>
<content><![CDATA[
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@davidcasey
davidcasey / resizeGo
Created November 6, 2012 21:46
Window resize debounce
var resizeGo;
$(window).resize(function(){
clearTimeout(resizeGo);
resizeGo = setTimeout(resizedwindow, 100);
});
function resizedwindow() {
}