Skip to content

Instantly share code, notes, and snippets.

View cwonrails's full-sized avatar

Chris Watson cwonrails

View GitHub Profile
@cwonrails
cwonrails / git-aliases.md
Created December 28, 2016 14:49 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@cwonrails
cwonrails / docker-wordpress.sh
Created November 21, 2016 15:43 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@cwonrails
cwonrails / osx_uninstall_mysql_install_mariadb_homebrew.md
Created November 3, 2016 23:03 — forked from brandonsimpson/osx_uninstall_mysql_install_mariadb_homebrew.md
OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

This is a short overview on how to completely remove any old mysql server installs in OSX and upgrade to MariaDB without conflicts. Things can get a bit weird when you have various old installs of MySQL server floating around, and utilizing homebrew to install and upgrade MariaDB as a drop in replacement for MySQL has worked well, especially if you're used to managing MySQL installs via yum in linux.

First: Backup Your Data!

Backup all of your current databases with mysqldump

This isn't a tutorial on backups, and there are many ways to do it. You should know how to backup your data anyway. For this example, we'll do a full backup of our InnoDB databases.

@cwonrails
cwonrails / troubleshooting.md
Created November 3, 2016 14:36 — forked from adamwathan/troubleshooting.md
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
@cwonrails
cwonrails / bash_prompt.sh
Created October 27, 2016 14:24 — forked from insin/bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@cwonrails
cwonrails / git.sh
Created October 27, 2016 13:14 — forked from dpaluy/git.sh
Remove trailing whitespace of all files recursively
# Git repository-specific solution
# Source: http://unix.stackexchange.com/questions/36233/how-to-skip-file-in-sed-if-it-contains-regex/36240#36240
git grep -I --name-only -z -e '' | xargs -0 sed -i -e 's/[ \t]\+\(\r\?\)$/\1/'
@cwonrails
cwonrails / .macos
Last active October 26, 2016 18:10
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
@cwonrails
cwonrails / sublime-settings-osx.json
Created October 25, 2016 14:42 — forked from arvi/sublime-settings-osx.json
Sublime Settings OSX
{
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
{
"characters": ".",
"selector": "source.js"
#!/usr/bin/env bash
rm -rf ~/example.com;
mkdir ~/example.com;
cd ~/example.com;
# git clone --depth=1 git@github.com:roots/trellis.git;
git clone --depth=1 git@github.com:cwonrails/trellis.git;
rm -rf trellis/.git;
git clone --depth=1 git@github.com:roots/bedrock.git site;
rm -rf site/.git;
if &compatible
set nocompatible
end
let s:darwin = has('mac')
call plug#begin('~/.vim/plugged')
Plug 'ajh17/VimCompletesMe'
Plug 'airblade/vim-gitgutter'