Skip to content

Instantly share code, notes, and snippets.

@sheldon
sheldon / pre-commit
Last active December 27, 2015 14:19 — forked from Simbul/pre-commit
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit to forbidden branches
# (by default, "staging" and "production").
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
FORBIDDEN_BRANCHES = ["staging", "production", "master"]
@sheldon
sheldon / gist:4140527
Created November 24, 2012 17:03 — forked from phpwax/gist:4140042
Trait for defaults and settings
<?php
trait StaticDefaults{
protected static $_defaults = [];
public function __get($key){
if(is_callable($func = self::$_defaults[$key])) return $func();
return $func;
}
static public function defaults($defaults){