Skip to content

Instantly share code, notes, and snippets.

View dccampbell's full-sized avatar

David C. Campbell dccampbell

View GitHub Profile
<?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'

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 / _install_drupal8.sh
Last active September 7, 2017 16:50
Composer Installer for Drupal 8
#!/usr/bin/env bash
# commands or paths to executables
composer_exec="composer"
drush_exec="bin/drush.launcher --local --root=web/"
# get composer.json (required)
if [ ! -f composer.json ]; then
wget -q -nc https://gist.githubusercontent.com/dccampbell/2c9af0710efe131a0b06804f72c68364/raw/composer.json
fi
@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');
@dccampbell
dccampbell / MagentoStockChecker.php
Created February 28, 2018 04:46
Magento 1.x - Reports the stock status of all configurable products and their associated products to check for discrepancies
<?php
set_time_limit(0);
ini_set('memory_limit', '2G');
// Load Magento
require_once __DIR__.'/app/Mage.php';
Mage::app();
// Get Products
$cfgProducts = Mage::getModel('catalog/product')->getCollection()
@dccampbell
dccampbell / PrintToPDF.php
Created October 1, 2018 07:08
Minimal PHP example of printing HTML to PDF using Headless Chrome
<?php
$chromeExec = 'google-chrome';
$inputFile = __DIR__.'/input.html';
$outputFile = __DIR__.'/output.pdf';
$version = shell_exec($chromeExec . ' --version 2>&1');
if(!strpos($version, 'Google Chrome') === 0) {
throw new Exception('Google Chrome not found at: '.$chromeExec);
@dccampbell
dccampbell / wp-config.php
Last active November 6, 2018 19:49
Wordpress config file w/ env support
<?php
/**
* Dynamic Wordpress Configuration File
*
* This config file is designed to be flexible for use in any environment without need for modification.
* It exposes most configurations to being set externally, such as via SetEnv in Apache/htaccess or PHP's putenv().
*
* It will optionally load a /env.php file. If the file returns an array, the key/values will be loaded using putenv().
*
@dccampbell
dccampbell / FacebookAdvertiserRemover.js
Created February 18, 2019 18:15
A script for selectively batch removing advertisers from your Facebook preferences.
// https://www.facebook.com/ads/preferences/
function loadAllAdvertisers() {
if(!document.querySelector('#interacted ._45ys')) {
document.querySelector('#interacted div[role=button]').click();
}
window.interactedInterval = setInterval(function() {
var moreBtn = document.querySelector('#interacted ._45yr');
if(moreBtn) {
document.querySelector('#interacted ._45yr').click();
# Variables
COMPOSER_HOME="$HOME/.composer"
HOSTS='/etc/hosts'
VHOST='/etc/apache2/sites-available/localdev.conf'
ERRLOG='/var/log/apache2/error.log'
# Fix SSH xterm-256color issue
alias ssh='TERM=xterm-color ssh'
# File Shortcuts