Skip to content

Instantly share code, notes, and snippets.

View mikelietz's full-sized avatar

mikelietz mikelietz

  • Columbus, Ohio
View GitHub Profile
groupZeros = function (ar) {
for(var i = ar.length - 1; i > 0; i--) {
if(ar[i] == 0) {
for(var z = 0; z < i - 1; z++) {
if(ar[z] == 0) {
ar.splice(i, 1);
ar.splice(z, 0, 0);
z = i;
}
}
@michaeltwofish
michaeltwofish / gist:1702154
Created January 30, 2012 02:45
Get the last PHP error
lasterror() {
logpath=/usr/local/www-conf/logs/$1-phplog;
error=(${(f)$(awk -F: '/PHP Fatal error|\[error\]/ { lines[last] = NR } END { print lines[last] }' $logpath)});
[[ -n $error ]] && tail -n +$error $logpath
}
@chrismeller
chrismeller / gist:1339633
Created November 4, 2011 15:44
Github Packager
<?php
class Github_Packager {
private static $api_endpoint = 'http://github.com/api/v2/json/';
private static $temp_path = './temp/';
public static function list_branches ( $addon_name, $with_commits = false ) {
$url = self::$api_endpoint . 'repos/show/habari-extras/' . $addon_name . '/branches';