Skip to content

Instantly share code, notes, and snippets.

View ryansechrest's full-sized avatar
👨‍💻
Andiamo

Ryan Sechrest ryansechrest

👨‍💻
Andiamo
View GitHub Profile
@ryansechrest
ryansechrest / php-style-guide.md
Last active April 16, 2024 07:38
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@ryansechrest
ryansechrest / vagrant.md
Last active January 27, 2019 22:18
Various cheat sheets for systems like Vagrant, Puppet, MySQL, etc.

Initialize

vagrant init [box-name] [box-url] — Add box and initialize VM

CentOS 6.5 box with Puppet:

vagrant init centos65p http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-puppet.box

CentOS 6.5 box without Puppet:

vagrant init centos65 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box

@ryansechrest
ryansechrest / server-to-localhost.sh
Created December 23, 2013 07:40
Bash script to synchronize website directory and database between server and localhost or server and server.
#!/bin/bash
# Created on 10/8/13 by Ryan Sechrest
# site (localhost edition)
# Program to mirror a directory and database of a website between two servers.
### Program meta data
@ryansechrest
ryansechrest / vagrantfile-default
Created December 22, 2013 08:34
Default Vagrant box file running CentOS 6.4 x64 with Puppet.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@ryansechrest
ryansechrest / post-receive.sh
Last active February 12, 2017 12:41
Git post-receive hook to deploy WordPress and plugins as submodules. It can also install Node.js modules with npm and vendor packages with Composer.
#!/bin/bash
# Created on 7/17/13 by Ryan Sechrest
# Deploys pushed branch from the origin repository to the web directory
if [[ (-n $1) && (-n $2) && (-n $3) ]]; then
# Set path to project directory
project_path="/var/www/domains/$2/$3"
@ryansechrest
ryansechrest / rewritemap-sample.conf
Last active December 28, 2015 17:09
Virtual host file for port 80 that redirects 'www' alias to main domain, uses 'cronolog' to rotate error and access logs, redirects non-whitelisted hosts to main site, allows access to itself via URL-based cron jobs, and prompts users of permitted group for username and password via basic authentication. Also includes rewrite map to redirect dom…
<VirtualHost *:80>
ServerName domain.com
RewriteEngine On
RewriteMap redirect_map_master txt:vhosts.d/includes/redirect_map_master
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteCond ${redirect_map_master:%2|domain.com} ^(.+)$ [NC]
RewriteRule ^/$ http://%1 [L,R=301]
</VirtualHost>
@ryansechrest
ryansechrest / bash-commands.sh
Last active April 20, 2020 18:15
New and enhanced bash commands for developers on Mac OS X.
#!/bin/bash
# ---------------------------------------------------------------------------
#
# File: .bash_commands
#
# Author: Ryan Sechrest
# Website: ryansechrest.com
#
# Description: New and enhanced bash commands for developers on Mac OS X.