Skip to content

Instantly share code, notes, and snippets.

pryley / Simple Custom Post Order - hook
Last active Aug 29, 2015
This adds a hook to the `Simple Custom Post Order` plugin `update_menu_order()` function.
View Simple Custom Post Order - hook
function update_menu_order() {
global $wpdb;
parse_str( $_POST['order'], $data );
if ( is_array( $data ) ) {
$id_arr = array( );
foreach ( $data as $key => $values ) {
View gruntfile
module.exports = function( grunt )
'use strict';
grunt.initConfig( {
clean: {
dist: [
View gist:eb6e74dce9f38e5598b2
if [ -z $THEPATH ];
then THEPATH="/"
[[ -n "$2" ]] || { echo -en "\n usage: getsize [path] [size (the min size in Mb)]\n example: getsize ~/Downloads 13\n\n"; exit 0 ; }
pryley / optionsframework_on_validate-example.php
Created Dec 1, 2012
Allow Facebook App ID/Secret verification with Options Framework
View optionsframework_on_validate-example.php
/ ================================================================================ */
// Verify Facebook App ID and Secret
add_action( 'admin_notices', 'pr_facebook_verify' );
function pr_facebook_verify() {
if ( get_option( 'fb_token' ) != '' ) {
$screen = get_current_screen();
pryley / gist:7746379
Last active Dec 29, 2015
Frontend google analytics snippet
View gist:7746379
try {
if( $access_token ) {
// Set access token
$client->setAccessToken( $access_token );
// Assign variables
$slug_array = $filter_path_array = $filter_array = $data = array();
pryley / deploy.rb
Created Feb 6, 2016
Capistrano global WP deploy config
View deploy.rb
set :application, 'myapp'
set :repo_url, "{fetch(:application)}.git"
SSHKit.config.command_map[:composer] = '/srv/users/serverpilot/bin/composer'
set :wpcli, '/srv/users/serverpilot/bin/wp'
# Branch options
# Prompts for the branch name (defaults to current branch)
#ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }
View print-r.php
* Plugin Name: print__r()
* Description: print_r() alternative
* Version: 1.0.0
* Author: Paul Ryley
* Author URI:
pryley /
Created May 6, 2016 — forked from scy/
How to delete a file from a Git repository, but not other users' working copies

How to delete a file from a Git repository, but not other users' working copies

Suppose you have, by mistake, added your IDE's project folder (you know, these .idea folders with all kinds of local paths and configuration data and settings in it) to the Git repository of your project. (We're talking about a whole folder here, but the same rules apply to individual files as well.)

Of course, you only realize that two days after the fact and have already pushed it, and your colleagues have already pulled it. They use the same IDE as you do, so whenever they change a setting or fix paths, they can either

  • commit that, causing nasty merge conflicts for you and others or
  • ignore the changes and carry around a modified file until the end of time without ever committing it.

Why .gitignore won't help


Keybase proof

I hereby claim:

  • I am pryley on github.
  • I am pryley ( on keybase.
  • I have a public key ASCIgelMI6dpyCg15fHavShFYmjSZ3ERl3GebPxokuGHOwo

To claim this, I am signing this object:

pryley / phpv
Created Feb 8, 2017
Switch PHP versions for Laravel Valet
View phpv
# Check that homebrew is installed
if [[ "" == "$(command -v brew)" ]]; then
echo "switch-php requires homebrew to manage installed versions of PHP."
exit 1
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then