Skip to content

Instantly share code, notes, and snippets.

# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# Custom tasks
require 'capistrano/composer'
require 'capistrano/npm'
<?php
if (!is_blog_installed()) { return; }
if ('http://' . $_SERVER['SERVER_NAME'] . '/wp' == get_option('home')) {
update_option('siteurl', 'http://' . $_SERVER['SERVER_NAME'] . '/wp');
update_option('home', 'http://' . $_SERVER['SERVER_NAME']);
update_option('upload_path', $_SERVER['DOCUMENT_ROOT'] . '/media');
update_option('upload_url_path', 'http://' . $_SERVER['SERVER_NAME'] . '/media');
update_option('permalink_structure', '/%postname%/');
}
@swalkinshaw
swalkinshaw / wp.log
Last active December 20, 2015 21:18
WP Logger output
[2013-08-09 19:40:52] WP.INFO: Started GET /download/ for 192.168.50.1 at 2013-08-09 19:40:52 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'stylesheet_root' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT * FROM wp_users WHERE user_login = 'admin' [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (1) [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_pages' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_calendar' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_tag_cloud' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_nav_menu' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Quer
@swalkinshaw
swalkinshaw / Gruntfile.coffee
Created July 8, 2013 20:36
Grunt connect-livereload with pushState rewrites
'use strict'
path = require 'path'
parse = require('url').parse;
module.exports = (grunt) ->
grunt.initConfig
qunit:
all: ['tests/**/*.html']
clean:
<?php
/*
Plugin Name: Image Optimizer
Plugin URI:
Description: Automatically optimizes images using jpegtran and optipng on upload
Version: 0.1
Author: Scott Walkinshaw
Author URI:
Support URI:
*/
@swalkinshaw
swalkinshaw / _mixin_2ximages.scss
Created January 8, 2013 16:06 — forked from replete/_mixin_2ximages.scss
SASS mixin for retina background images. Requires Compass for the image-width and image-height functions.
@mixin image-2x($image1, $image2) {
background-image: url($image1);
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: url($image2);
background-size: image-width($image1) image-height($image1);
}
@swalkinshaw
swalkinshaw / gist:2695510
Created May 14, 2012 18:25
WordPress: Mandatory Excerpt
<?
function mandatory_excerpt($data) {
$excerpt = $data['post_excerpt'];
if (empty($excerpt)) {
if ($data['post_status'] === 'publish') {
add_filter('redirect_post_location', 'excerpt_error_message_redirect', '99');
}
@swalkinshaw
swalkinshaw / vimrc
Created August 2, 2011 17:40
vimrc
" Tabs and Spaces
set tabstop=2
set shiftwidth=2
set softtabstop=2
set backspace=indent,eol,start
set expandtab
set autoindent
set smartindent
set smarttab
/usr/bin/gcc
Your gcc 4.2.x version is older than the recommended version. It may be advisable
to upgrade to the latest release of Xcode.
We couldn't detect any version of Xcode.
If you downloaded Xcode 4.1 from the App Store, you may need to run the installer.
@swalkinshaw
swalkinshaw / brewconfig.txt
Created July 27, 2011 18:28
brew --config
brew --config
/usr/bin/gcc
HOMEBREW_VERSION: 0.8
HEAD: 1e472655c6b764c79f1056c956c6da2453214aba
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: dual-core 64-bit penryn
OS X: 10.7