Skip to content

Instantly share code, notes, and snippets.

View dave1010's full-sized avatar

Dave Hulbert dave1010

View GitHub Profile
@dave1010
dave1010 / htaccess
Created December 14, 2011 13:07
HTTP Status Cats Apache (htaccess) config
# HTTP Status Cats
# Apache (htaccess) config created by @dave1010
# Licensed CC BY 2.0
# Images CC BY 2.0, from GirlieMac's photostream:
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/
# Usage: copy save this file as .htaccess or add it to your httpd.conf
ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>'
@UnderpantsGnome
UnderpantsGnome / pre-commit
Last active September 27, 2015 00:47
My pre-commit hook
#!/bin/bash
debug=`git diff --cached | grep -C 2 -E '+\s*And (open|show me the page|save_and_open_page)'`
pry=`git diff --cached | grep -C 2 -E 'binding.pry'`
debugger=`git diff --cached | grep -C 2 debugger`
console_log=`git diff --cached | grep -C 2 console.log`
conflicts=`git diff --cached | grep -C 2 -E '<<<|>>>'`
if [ -n "$debug" ]; then
echo "debugging statements added in this commit"
@dave1010
dave1010 / 00-the-wordpress-way.md
Created August 18, 2011 09:21
The WordPress Way - The 10 rules of WordPress development

The WordPress Way

A tongue-in-cheek look at coding standards in the WordPress core and the average WordPress plugin.

  1. # Declare variables global - in case they're going to be used again
  2. All function/method parameters should be strings (e.g. 'yes'/'no') - for clarity
  3. Functions and methods should return mixed types
  4. No need to separate PHP logic from HTML, JS or CSS
  5. Don't worry about PHP Notices - they're not important
@CHH
CHH / .gitignore
Created August 2, 2011 21:09
PHP Templating Engine with bindable $this support in 53 LOC
vendor/
composer.lock
@subtleGradient
subtleGradient / git-jira
Created December 17, 2010 00:16
Jira CLI with git config support! + stuff
#!/usr/bin/env bash
# Author: Thomas Aylott <thomas@subtlegradient.com>
# Usage:|
# git-jira getIssue
# git-jira getComments
# Notes:|
# This expects you to use branch names like "thomas/HUE-123-Make-Things-Awesomer" or "tom-HUE-321-code-stuff"
BRANCH_NAME="$(git symbolic-ref HEAD|sed 's/refs\/heads\///')"
TICKET_ID="$(echo "$BRANCH_NAME"|sed -E 's/^.*[/-]([A-Z]+-[0-9]+).*$/\1/')"
@ryanb
ryanb / github_tree_slider.js
Created December 6, 2010 17:23
This is how GitHub's new AJAX file browser works.
GitHub.TreeSlider = function () {
if (window.history && window.history.pushState) {
function a() {
if (e.sliding) {
e.sliding = false;
$(".frame-right").hide();
$(".frame-loading:visible").removeClass("frame-loading")
}
}
if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
@dave1010
dave1010 / jQuery.twtShrt.js
Created October 1, 2010 18:07
jQuery.fn.twtShrt
/**
* Make a form field shorten text as you type
* Made for keeping tweets < 140 chrs
* Usage: $('textarea').twtShrt();
* @author dave1010
*/
jQuery.fn.twtShrt = function() {
var o = [
"seriously","have to", "what is", "done", "oh my god", "oh my gosh", "face to face", "for the win", "for the loss", "in real life", "your mileage may vary", "best regards", "joint venture", "let me know", "not safe for work", "are you ok", "tomorrow", "as soon as possible", "be right back", "be back later", "be back soon", "at the moment", "by the way", "in my honest opinion", "tata for now", "as known as", "also known as", "see you later", "see you", "for your information", "in my opinion", "too good to be true", "best friends forever", "best friend forever", "best friends", "best friend", "definitely", "been", "hello", "i am", "night", "when", "some", "to", "speak", "you", "your", "for", "friend", "people", "see", "be", "and", "&", "anyone", "because", "are", "bate", "date", "fate", "great", "hate", "late", "mate",
#!/usr/bin/env ruby
#
# Update JIRA with git commit messages
#
# == Usage ==
#
# To update a JIRA issue, prepend the first line of your git commit message
# with the issue key and a colon:
#
# $ git commit -m "GIT-1: Updates something"