Skip to content

Instantly share code, notes, and snippets.

@shadyvb
shadyvb / vip-server.sh
Created March 1, 2014 13:15
vip-quickstart --server
# sudo apt-get update && sudo apt-get install git puppet -y && git clone https://github.com/Automattic/vip-quickstart.git /srv && cd /srv && bin/vip-init --server --domain=??
@shadyvb
shadyvb / webgrind-raise-important-queries.js
Created May 15, 2014 11:33
Bring up functions in theme files to the top in Webgrind
jQuery('a[title=Open file]').filter( function() { return jQuery(this).attr('href').match(/www\/wp-content\/themes\/vip\/shaw-globalnews\//) ; } ).each( function(){ jQuery(this).parents('tr').eq(0).prependTo( jQuery('table#function_table tbody') ); } )
@shadyvb
shadyvb / packer-install.sh
Last active August 29, 2015 14:01
Install packer for Archlinux
pacman -S base-devel fakeroot jshon expac git wget
wget https://aur.archlinux.org/packages/pa/packer/PKGBUILD
makepkg
pacman -U packer-*.pkg.tar.gz
@shadyvb
shadyvb / mu-plugin-profile-actions.php
Created May 19, 2014 12:57
mu-plugin to track timing of all actions/filters of a whitelisted list of tags ( or all of them! )
<?php
$xteam_profile_whitelisted_tags = array(
'save_post'
);
// Do action hack
function xteam_profile_all_action( $value ) {
global $wp_filter, $merged_filters, $wp_current_filter, $xteam_profile_whitelisted_tags;
$tag = end( $wp_current_filter );
@shadyvb
shadyvb / wp-globals.php
Created July 13, 2014 00:33
Globals in WordPress
<?php
$globals = array(
'comment',
'comment_alt',
'comment_depth',
'comment_thread_alt',
'wp_rewrite',
'in_comment_loop',
'wp_query',
@shadyvb
shadyvb / keybase.md
Last active August 29, 2015 14:04
keybase.md

Keybase proof

I hereby claim:

  • I am shadyvb on github.
  • I am shadysharaf (https://keybase.io/shadysharaf) on keybase.
  • I have a public key whose fingerprint is 0881 D3FC 2A71 1C95 01F4 C05C 61D6 DA92 65F2 1F5F

To claim this, I am signing this object:

@shadyvb
shadyvb / connector
Created September 8, 2014 17:33
Using reflections to add actions/filters from class methods
<?php
class Connector {
protected function __construct() {
$this->add_class_hooks();
}
/**
* Add actions/filters from the methods of this class based on doc blocks
@shadyvb
shadyvb / deploy.php
Created September 25, 2014 08:20
GitHub Webhook Deployment handler
<?php
header("Content-Type: text/plain");
// Decode the payload
$payload = json_decode( $_POST );
# Include config file if found
@include( __DIR__ . '/deploy-config.php' );
// Ability to choose a custom branch to track / deploy from, in the webhook registered URL
@shadyvb
shadyvb / .gitconfig
Created September 26, 2014 16:31
git preview
[alias]
preview ="!f() { git branch -D preview; git fetch; git checkout preview; git merge -; git push; /path/to/wp-vip-preview/bin/deploy-preview.sh > /dev/null 2>&1; git checkout -; }; f"
@shadyvb
shadyvb / .gitconfig
Created October 1, 2014 12:12
Git / SVN
# switch to vip git branch
git checkout vip
# pull updates
svn up
# reset working tree
svn revert --recursive .
# try to merge the previous branch ( ie: GNDEV-88 ), but do not auto commit
git merge - --no-commit --no-ff
# see the svn diff, before committing
svn diff | more