Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View codfish's full-sized avatar

Chris O'Donnell codfish

View GitHub Profile
sudo dseditgroup -o edit -a <username> -t user <groupname>
@codfish
codfish / wp-cli.local.yml
Last active August 29, 2015 14:04
With commands you'll be using regularly, you can store your standard arguments in your wp-cli.local.yml file. Given a wp-cli.local.yml file like this, a command like this: `wp core install --title="WordPress Trunk" --url=http://wordpress-trunk.dev --admin_user=daniel --admin_password=daniel --admin_email=daniel@handbuilt.co` ... becomes as easy …
# source: https://github.com/danielbachhuber/wp-dev-docs/blob/master/performance/migrations.md
core install:
title: WordPress Trunk
url: http://wordpress-trunk.dev
admin_user: daniel
admin_password: daniel
admin_email: daniel@handbuilt.co
@codfish
codfish / rerun_as_sudo.sh
Created August 4, 2014 13:42
Ever type a command and forget/didn't know you need sudo, and get a permission denied error? Rather than re-type, or press up and go to front of the line, here's a slightly quicker way to rerun the last command as sudo.
$ sudo !!
@codfish
codfish / cur_file_directory.sh
Created August 8, 2014 13:23
Get the directory in bash of the script that's running. It's a useful one-liner which will give you the full directory name of the script no matter where it is being called from.
# source: http://stackoverflow.com/a/246128
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@codfish
codfish / wp_search_replace.sh
Created August 12, 2014 13:20
Search & replace strings in Wordpress databases easily with wp-cli (http://wp-cli.org/)
wp search-replace 'local.example.com' 'www.example.com'
@codfish
codfish / mysql_import.sh
Created August 12, 2014 15:19
Import mysql dump file via command line
mysql -u<username> -p<password> <dbname> < /path/to/sqldumpfile.sql
@codfish
codfish / apache_RewriteCond.conf
Created August 14, 2014 19:06
The RewriteCond directive just describes an additional condition for a RewriteRule directive. So RewriteCond must always be associated with a RewriteRule. Source: http://stackoverflow.com/a/2102189
; Now this rule is applied if the pattern of the RewriteRule matches the current request
; URL (per-directory path stripped before) and if the condition is fulfilled.
;
; In this case the condition is only true if when mapping the request URL
; to the filesystem it matches either an existing file with the file size
; greater than 0 (-s), or a symbolic link (-l) or a directory (d). So your rule will
; be applied for any URL (^.*$ matches anything) that can be mapped to something
; existing in your filesystem. The substitution - just means to not change anything.
; And the NC (no case, case insensitive, useless in this context) and L (last rule if applied)
; are flags that modify either the pattern, replacement or the execution of the rule.
@codfish
codfish / app.js
Last active August 29, 2015 14:06
AngularJS Breadcrumbs leveraging ui-router's states. Based off http://goo.gl/w0zFou
'use strict';
/**
* App Module
*
* @note
* ui-router setup is def incomplete. this is just to show an
* example of the breadcrumb setup
*
* @ngInject
@codfish
codfish / unload_apache.sh
Last active August 29, 2015 14:06
Stop apache permanently on mac Mavericks. This will stop a running instance of Apache, and record that it should not be restarted. It records your preference in /private/var/db/launchd.db/com.apple.launchd/overrides.plist. http://goo.gl/J26slP
# ** you need to have an apache instance running already for this command to work.
sudo apachectl start
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
@codfish
codfish / uiEqualHeights.js
Last active February 12, 2018 09:02
AngularJS Equal Height columns directive.
'use strict';
/**
* Equal Heights
*
* Attach this directive to the parent/wrapping element of
* a bunch of elements that are columns. This directive will
* calculate the height of every direct child (one level down)
* then set all of them to be the height of the tallest one.
*