Skip to content

Instantly share code, notes, and snippets.

View dccampbell's full-sized avatar

David C. Campbell dccampbell

View GitHub Profile
@dccampbell
dccampbell / GitPHP-AgeSort.js
Last active August 29, 2015 14:26
Tampermonkey-friendly JS for modifying a GitPHP repo list page. Fixes age sorting to work across all repos by removing categories first.
// ==UserScript==
// @name GitPHP - Age Sort w/o Categories
// @version 1.0.0
// @author dccampbell
// @run-at document-end
// @match http*://*/?sort=age
// @require http://code.jquery.com/jquery-latest.js
// @description GitPHP Repo List - Remove categories and sort all repos by last update.
// ==/UserScript==
@dccampbell
dccampbell / laravel-latestdocs.js
Created September 14, 2015 23:03
Tampermonkey: Redirect all Laravel doc pages to their master version.
// ==UserScript==
// @name Laravel Latest Docs
// @description Always redirect to the master version laravel docs.
// @author David C. Campbell
// @match http://laravel.com/docs/*
// ==/UserScript==
var url = window.location.href;
var matches = url.match(/[0-9].[0-9]/);
@dccampbell
dccampbell / git-status-recursive
Last active January 5, 2016 10:25
Scan the current sub-directories for git repositories, recursively, and return the git status for the working tree and all branches. Default max depth is 3. Ignores vendor and modman folders.
#!/usr/bin/env bash
basePath="$PWD"
baseDirs=$(find $basePath -mindepth 1 -maxdepth 1 -type d)
gitPaths=$(find $basePath -mindepth 1 -maxdepth ${1:-3} -name .git -type d -exec dirname {} \; | grep -v '/vendor/\|/.modman/')
unchangedDirs=()
for repo in $gitPaths; do
cd $repo
[[ "$2" = "-f" ]] && git fetch -q &>/dev/null
@dccampbell
dccampbell / installMagerun.sh
Last active February 3, 2016 00:34
Install Magerun, restrict to one user, and create alias.
#!/bin/bash
# Install Magerun, restrict to one user, and create alias.
# Usage: installMagerun.sh [user] [path]
# [user] defaults to current user
# [path] defaults to current ./n98-magerun.phar
# Vars
mrUser="${1:-$(whoami)}"
@dccampbell
dccampbell / savePageToFile.js
Created March 19, 2016 03:12
Functions for getting the page HTML, search/replacing domain strings, and saving text to a file. Tested in Chrome 49 via Tampermonkey.
window.addEventListener('load', function() {
var data = getPageHtml().replaceUrls('foo.com', 'bar.com');
var file = document.location.pathname.basename();
//saveToFile(data, file);
}, false);
/**
<?php
/**
* A generic SoapClient wrapper class with conveniences.
*
* Forces some default SoapClient options (trace/version/cache/etc),
* and provides the ability to set default options, callbacks, and custom response classes.
*
* @author DCCampbell
* @package AdvancedSoapClient
*/
#!/usr/bin/env bash
#https://gist.github.com/dccampbell/50ed62db4cf434abf32ab671720fe6ab
# Download Files
# http://code.activestate.com/komodo/remotedebugging/
dlUrl='http://downloads.activestate.com/Komodo/releases/9.3.2/remotedebugging/Komodo-PythonRemoteDebugging-9.3.2-88191-linux-x86_64.tar.gz'
curl -sS -L $dlUrl -o 'dbgp.tar.gz' || exit 1
# Prepare Path
mkdir 'dbgp'
<?php
function getInput() {
return !empty($_POST['mediawiki']) ? $_POST['mediawiki'] : '';
}
function convertSyntax() {
$mediawiki = getInput();
if(empty($mediawiki)) return '';

Keybase proof

I hereby claim:

  • I am dccampbell on github.
  • I am dccampbell (https://keybase.io/dccampbell) on keybase.
  • I have a public key whose fingerprint is AB19 7B44 B84F 1B7F 098E 8258 4846 A6C3 9A5E D710

To claim this, I am signing this object:

@dccampbell
dccampbell / server-logs-viewer.php
Last active August 9, 2017 01:07 — forked from pixeline/server-logs-viewer.php
This script presents the latest lines of your LAMP server log files, emulating the tail() function.
<?php
/*
* @name Server Logs Viewer
* @description Emulates the tail() function. View latest lines of log files in your browser.
* @author Alexandre Plennevaux (pixeline.be)
*/
/* Absolute local path to your server 'log' directory */
define('LOG_PATH', '/var/log');