Skip to content

Instantly share code, notes, and snippets.


Jonny MacEachern jonnymaceachern

View GitHub Profile
scribu / gist:906872
Created Apr 7, 2011
'price' sortable column example
View gist:906872
// Register the column
function price_column_register( $columns ) {
$columns['price'] = __( 'Price', 'my-plugin' );
return $columns;
add_filter( 'manage_edit-post_columns', 'price_column_register' );
pksunkara / config
Last active Apr 20, 2021
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
View config
name = Pavan Kumar Sunkara
email =
username = pksunkara
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
smtpencryption = tls
kopiro / get-social-counts.php
Created Oct 29, 2011
Get social counts from Facebook, Twitter, GPlus
View get-social-counts.php
/* Return object of shared counts */
function get_social_count( $link ) {
$r = (object)array();
$r->facebook = get_social_count_facebook($link);
$r->twitter = get_social_count_twitter($link);
$r->gplus = get_social_count_gplus($link);
return $r;
jaygooby / strip_related_videos.php
Created Nov 4, 2011
Always put a rel=0 attribute on Youtube embedded videos so that related videos aren't shown at the end
View strip_related_videos.php
boucher / webhook-mailer.php
Created Jan 31, 2012
Stripe Webhook PHP Example
View webhook-mailer.php
// 1. Customize all the settings (stripe api key, email settings, email text)
// 2. Put this code somewhere where it's accessible by a URL on your server.
// 3. Add the URL of that location to the settings at
// 4. Have fun!
// set your secret key: remember to change this to your live secret key in production
// see your keys here
oodavid /
Last active Apr 5, 2021 — forked from aronwoost/
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
    • apache's home directory is /var/www/
View wp-query-ref.php
// This gist is now maintained on github at
* WordPress Query Comprehensive Reference
* Compiled by luetkemj -
* Source:
mikejolley / gist:2044101
Last active Mar 12, 2021
WooCommerce - Show number of and total
View gist:2044101
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
sindresorhus /
Created May 7, 2012
Git merge squash author commit and push - cheatsheet
git checkout master
git checkout -b bug123
git pull http://repourl.git branch
git log | grep "Author" | head -1 # get the author
git checkout master
git merge --squash bug123
git commit -a --author="Author" --message="Close #1: Title. Fixes #666"
git push origin master
jonathanmoore / gist:2640302
Created May 8, 2012
Get the share counts from various APIs
View gist:2640302

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.