Skip to content

Instantly share code, notes, and snippets.

View drock's full-sized avatar

D-Rock drock

  • EverFi
  • Port Orange, FL
View GitHub Profile
@drock
drock / git-branch-bash.sh
Created September 15, 2011 13:57
Bash prompt that will show the current branch you are on and its status against its remote tracking branch if necessary
#Add git information to the bash prompt
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
branch=$(git status -sb 2> /dev/null | head -1)
echo "($branch)"
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
@drock
drock / .bash_profile
Created October 8, 2012 21:31
Bash prompt to show current git status and branch
#Install git-core +bash_completion
#sudo port install git-core +bash_completion
#paste this into your .bash_profile
#customize the PS1 variable as desired
GIT_PS1_SHOWUPSTREAM="verbose"
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
. /opt/local/etc/profile.d/bash_completion.sh
fi
@drock
drock / OptionTrait.php
Created July 24, 2013 17:18
Trait for php classes to provide some boilerplate option/config functionality for the class
<?php
/**
* Trait OptionTrait
*
* A trait that will apply option configuration functionality to a class.
* Typical use would be to define a constructor which takes in an array
* of options and sets them with defaults like so:
*
@drock
drock / Enum.php
Created July 26, 2013 12:04
A PHP class to mimick the php SPL-Types extension's SPLEnum but in vanilla PHP. Use to create an enumeration and guarantee that the set value is one of the possible enumerations.
<?php
/**
* Class Enum
*
* Encapsulates (as best as PHP can, Enums as a type)
* Extend the class and define constants for the valid values
*
* This class basically mimics SPLEnum from the SPL-Types PECL
@drock
drock / DateTimeComparator.php
Last active September 8, 2022 15:46
A comparator object for PHPUnit to support asserting that two DateTime objects are logically equaly.
<?php
/**
* Class DateTimeComparator
*
* Custom Comparator for PHPUnit to compare two DateTime objects
* The default object comparator will report some DateTime object pairs
* as not equal even if they are canonically equal because the object
* comparator looks a exact object field values. A DateTime object
* can have multiple timezone values that represent the same timezone
* however. This comparator compares the object's UTC timestamps
@drock
drock / gist:1d424720db5647b7b5de
Created July 24, 2014 21:04
How to get on the leaderboard of Github's Pulse feature
while true; do
git commit --allow-empty
git push
done
#Sample circle.yml for deploying a rails app to deis
machine:
pre:
# install the deis cli
- curl -sSL http://deis.io/deis-cli/install-v2.sh | bash
- sudo mv $PWD/deis /usr/local/bin/deis
deployment:
staging:
branch: master
commands: