July 15, 2012
Instructor: Angie Meeker (@angiemeeker)
Slides: http://slidesha.re/LZT6T3
Angie's Multisite-mentor: @angela_r
| #!/bin/bash | |
| # | |
| # Backup local databases to Amazon S3. | |
| # | |
| # This script takes a single argument: an S3 bucket name with optional path. | |
| # | |
| # Usage: | |
| # database-backup.sh backup.example.com | |
| # database-backup.sh backup.example.com/some/path | |
| # |
| ### Keybase proof | |
| I hereby claim: | |
| * I am stevegrunwell on github. | |
| * I am stevegrunwell (https://keybase.io/stevegrunwell) on keybase. | |
| * I have a public key whose fingerprint is 56A8 ED6A 4437 6DE0 0EE9 3D74 5435 2694 8DF1 91E1 | |
| To claim this, I am signing this object: |
| <?php | |
| /** | |
| * Email the error log to Eric Mann every time a 404 error occurs. | |
| * | |
| * @param array $report The WP404 report. | |
| * @return array The (untouched) WP404 report. | |
| */ | |
| function mytheme_spam_eric_with_404s( $report ) { | |
| wp_mail( |
| function wp-upgrade-plugins() { | |
| UPDATES=`wp plugin list --update=available --fields=name,title,update_version --format=csv` | |
| i=1 | |
| while IFS="," read -r slug name version | |
| do | |
| test $i -eq 1 && ((i=i+1)) && continue | |
| echo "Upgrading $name to $version..." |
| #! /bin/bash | |
| # Find available updates for WordPress plugins via WP-CLI, then upgrade theme one at a time. | |
| # After each upgrade, commit the changed files to Git. | |
| # | |
| # Requires that WP-CLI be installed and in your path: http://wp-cli.org/ | |
| # | |
| # Currently, it will only work when run from the root of the WordPress installation, and has | |
| # a hard-coded path for wp-content/plugins. | |
| # |
| public function is_available( $package ) { | |
| // Determine if we have any items in the "In-state" shipping class | |
| $restricted_shipping_class_slug = 'in-state'; | |
| $permitted_states_for_restricted_items = array( 'NY' ); | |
| $has_restricted_items = false; | |
| foreach ( $package as $pkg ) { | |
| if ( isset( $pkg['contents'] ) ) { | |
| foreach ( $pkg['contents'] as $contents ) { |
| <?php | |
| /** | |
| * Return an array of restricted shipping locations for WooCommerce | |
| * | |
| * Restricted locations include Alaska, American Samoa, Guam, Hawaii, North Mariana Islands, Puerto Rico, | |
| * US Minor Outlying Islands, and the US Virgin Islands | |
| * | |
| * @return array | |
| */ |
| # Create a bare clone in ~/git_repositories/{slug}.git | |
| # Before running this command ensure that the repo on Bitbucket has an appropriate deploy key. | |
| # You'll also want to set a POST hook (e.g. http://{redmine}/github_hook?project_id={slug}) | |
| # | |
| # Usage: bitbucket-add-repository <slug> | |
| function bitbucket-add-repository { | |
| base=/home/redmine/git_repositories/ | |
| if [ -n "$1" ]; then | |
| path=$base$1.git |
| <?php | |
| /** | |
| * Get the hash of the current git HEAD | |
| * @param str $branch The git branch to check | |
| * @return mixed Either the hash or a boolean false | |
| */ | |
| function get_current_git_commit( $branch='master' ) { | |
| if ( $hash = file_get_contents( sprintf( '.git/refs/heads/%s', $branch ) ) ) { | |
| return $hash; | |
| } else { |
July 15, 2012
Instructor: Angie Meeker (@angiemeeker)
Slides: http://slidesha.re/LZT6T3
Angie's Multisite-mentor: @angela_r