Skip to content

Instantly share code, notes, and snippets.

View benharold's full-sized avatar

Ben Harold benharold

View GitHub Profile
@benharold
benharold / setup-zsh.sh
Created October 23, 2018 19:54
Setup zsh with oh-my-zsh and the spaceship prompt
#!/bin/bash
# Install oh-my-zsh and the spaceship theme.
# This script is to be run by a provisioner as root.
# Change this to the appropriate user.
USER_NAME="vagrant"
ZSH_CUSTOM="/home/$USER_NAME/.oh-my-zsh/custom"
@benharold
benharold / Fix Helix3 for Postgres.diff
Last active January 27, 2017 19:51
Changes needed to get Helix3 template working under PostgreSQL
diff --git a/plugins/system/helix3.php b/plugins/system/helix3.php
index ac6c71e..3ccf4b7 100644
--- a/plugins/system/helix3.php
+++ b/plugins/system/helix3.php
@@ -179,7 +179,7 @@ class plgSystemHelix3 extends JPlugin
$query->select($db->quoteName(array('template')));
$query->from($db->quoteName('#__template_styles'));
$query->where($db->quoteName('client_id') . ' = 0');
- $query->where($db->quoteName('home') . ' = 1');
+ $query->where($db->quoteName('home') . ' = ' . $db->quote(1));
@benharold
benharold / ping.php
Last active January 9, 2017 18:41
Ping script for PHP/MySQL application that uses dotenv
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$dotenv = new Dotenv\Dotenv(dirname(__FILE__));
$dotenv->load();
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASS', getenv('DB_PASS'));
@benharold
benharold / iterm2-solarized.md
Created November 16, 2016 17:37 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font (OS X / macOS)

Solarized

@benharold
benharold / .bash_aliases
Created November 16, 2016 16:53
Bash aliases that I use constantly
alias l='ls -lah'
alias ..='cd ..'
@benharold
benharold / xdebug
Created June 17, 2016 17:50
Bash script to toggle xdebug on/off on Mac OS X running PHP installed from Homebrew
#!/bin/bash
XDEBUG_INI_PATH="/usr/local/etc/php/7.0/conf.d/ext-xdebug.ini"
function turn_off {
`sed -i '' 's/^zend_extension/#zend_extension/g' $XDEBUG_INI_PATH`
}
function turn_on {
`sed -i '' 's/^#zend_extension/zend_extension/g' $XDEBUG_INI_PATH`
@benharold
benharold / backupdb.sh
Last active May 16, 2017 18:29
Basic Database Backup Script
#!/bin/bash
# This script backs-up a MySQL or MariaDB database, compresses it and uploads it to Amazon S3.
#
# MySQL 5.6+:
# Use `mysql_config_editor` to store authentication credentials in an encrypted login path file named .mylogin.cnf.
# `mysql_config_editor set --login-path=local --host=localhost --user=USERNAME --password`
#
# MariaDB and MySQL <= 5.5:
# Uncomment the following variable declarations and add the appropriate database credentials.
"require": [
"laravelbook/ardent": "dev-master"
],
"repositories": [
{
"type": "package",
"package": {
"name": "laravelbook/ardent",
"version": "dev-master",
"source": {
@benharold
benharold / nxinx site configuration file
Created January 21, 2014 23:31
nginx site config file setup for use the way I usually do it
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
@benharold
benharold / Vagrantfile
Created January 20, 2014 23:52
Precise64 based Vagrantfile for Nginx, MySQL, PHP 5.5.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# precise64 based
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
# location of the source directory for the project