Skip to content

Instantly share code, notes, and snippets.

View markalanevans's full-sized avatar
🎯
Focusing

Mark Evans markalanevans

🎯
Focusing
View GitHub Profile
@markalanevans
markalanevans / .gitbash
Created November 18, 2010 21:03
.gitbash
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@markalanevans
markalanevans / random_password.php
Created March 29, 2011 03:55
Random Password Generator
function generatePassword($length=6,$level=2){
list($usec, $sec) = explode(' ', microtime());
srand((float) $sec + ((float) $usec * 100000));
$validchars[1] = "0123456789abcdfghjkmnpqrstvwxyz";
$validchars[2] = "0123456789abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$validchars[3] = "0123456789_!@#$%&*()-=+/abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_!@#$%&*()-=+/";
@markalanevans
markalanevans / git-config
Created October 6, 2011 02:37
Git Config
[user]
name = Mark Evans
email = my@emailaddress.com
[color]
branch = auto
diff = auto
interactive = auto
status = auto
ui = auto
[color "branch"]
@markalanevans
markalanevans / git-prompt
Last active September 27, 2015 11:58
A Git Prompt which adds the branch you are on to the prompt.
#Description: OSX Git Prompt - make your git repo prompts look pretty
#Installation: In your .bash_profile, add a line: source .gitprompt
#FileName: .gitprompt
#Owner: Mark Evans:
#Stolen From: http://asemanfar.com/Current-Git-Branch-in-Bash-Prompt
#also install git complet: brew install git bash-completion
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
@markalanevans
markalanevans / underscore_array_keys
Created October 21, 2011 22:55
LowerCase and Underscore PHP array
function underscore_array_keys($data){
foreach ($data as $n => $v){
$newKey = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $n));
unset($data[$n]);
if (is_array($v)){
$data[$newKey] = underscore_array_keys($v);
}else{
$data[$newKey] = $v;
}
}
@markalanevans
markalanevans / redis-init-rhel
Created November 3, 2011 03:22
Simple RedHat Redis init.d script
#!/bin/sh
#
# redis Startup script for Redis Server
#
# chkconfig: - 90 10
# description: Redis is an open source, advanced key-value store.
#
# processname: redis-server
# config: /etc/redis.conf
# pidfile: /var/run/redis.pid
set-option -g default-shell /bin/zsh
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind | split-window -h
bind - split-window -v
" Pathogen
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
call pathogen#helptags()
" Disable vi-compatibility
set nocompatible
" Remember more history
set history=1000
#Description: OSX Git Prompt - make your git repo prompts look pretty
#Owner: Mark Evans:
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
parse_git_branch ()
{
#Install Brew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
#Command Line Tools
brew install tmux
brew install macvim --override-system-vim
brew linkapps