Skip to content

Instantly share code, notes, and snippets.

View dccampbell's full-sized avatar

David C. Campbell dccampbell

View GitHub Profile
@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
#!/bin/bash
mkdir -pv ./.n98-magerun/modules/ && cd ./.n98-magerun/modules/
git clone --depth=1 https://github.com/kalenjordan/magerun-addons && mv magerun-addons kj-magerun-addons
git clone --depth=1 https://github.com/peterjaap/magerun-addons && mv magerun-addons pj-magerun-addons
git clone --depth=1 https://github.com/creatuity/magerun-creatuity
git clone --depth=1 https://github.com/aoepeople/mpmd
@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 / 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();
@dccampbell
dccampbell / setupFirefoxDev.sh
Last active March 6, 2019 16:04
Install Firefox Developer Edition
#!/usr/bin/env bash
set -e -x
# Variables
INSTALL_DIR="/opt/firefox-dev"
TEMP_FILE="$HOME/Downloads/firefox-dev.tar.bz2"
MENU_FILE="$HOME/.local/share/applications/firefox-dev.desktop"
BIN_DIR="$HOME/bin"
# Prepare
@dccampbell
dccampbell / git_prune_merged_branches.sh
Last active September 16, 2019 18:40
Git: Prune Merged Branches
#!/bin/bash
set -e
git fetch --all --prune
localBranches=$(git branch --merged origin/master | sed 's/^[ *]\+//' | grep -v '^master$' || echo '')
if [[ -z "$localBranches" ]]; then
echo "No local merged branches found."
@dccampbell
dccampbell / setupApache.sh
Last active January 14, 2020 03:10
Install Apache, change user to current, enable macro and rewrite modules, set default server name, add a vhost macro, create a localdev site, add commands for easy add/removal of vhost
#!/usr/bin/env bash
## Apache Setup
# Variables
BIN_DIR="/usr/local/bin"
# Install Apache
#sudo apt install -y apache2
# Change Apache User/Group
[core]
autocrlf = input
eol = lf
[push]
default = current
[pull]
ff = only
[merge]
ff = false
[diff]
@dccampbell
dccampbell / osx_setup_homebrew.sh
Last active January 24, 2020 07:08 — forked from iainconnor/setup.sh
Mac OSX Setup
#!/usr/bin/env bash
# Ask for the administrator password upfront
sudo -v
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || exit 1
# Configure Homebrew
brew doctor