Skip to content

Instantly share code, notes, and snippets.

View jconroy's full-sized avatar

Jason Conroy jconroy

  • Automattic
  • Australia
View GitHub Profile
// Examples can be found here: http://boedesign.com/misc/outer_setters.html
// Discussed here: http://forum.jquery.com/topic/outerheight-int-sets-the-height-taking-into-account-padding-and-border
(function($){
function _outerSetter(direction, args){
var $el = $(this),
$sec_el = $(args[0]),
dir = (direction == 'Height') ? ['Top', 'Bottom'] : ['Left', 'Right'],
@amereservant
amereservant / auth.php
Created October 22, 2011 23:10
phpFlickr API Detailed Example HowTo
<?php
/* Last updated with phpFlickr 3.1
*
* Edit these variables to reflect the values you need. $default_redirect
* and $permissions are only important if you are linking here instead of
* using phpFlickr::auth() from another page or if you set the remember_uri
* argument to false.
*/
// Include configuration file
@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

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.

Twitter

@JimWestergren
JimWestergren / index-with-redis.php
Last active February 11, 2023 18:28
Redis as a Frontend Cache for WordPress
<?php
/*
Author: Jim Westergren & Jeedo Aquino
File: index-with-redis.php
Updated: 2012-10-25
This is a redis caching system for wordpress.
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
@mikejolley
mikejolley / gist:3097073
Last active January 18, 2024 17:54
WooCommerce - Unhook/Disable emails
/**
* Code goes in functions.php or a custom plugin.
*/
add_action( 'woocommerce_email', 'unhook_those_pesky_emails' );
function unhook_those_pesky_emails( $email_class ) {
/**
* Hooks for sending emails during store events
**/
@mikejolley
mikejolley / gist:3709371
Created September 12, 2012 19:41
Remove WooCommerce Generator Tag
function my_woocommerce_loaded_function() {
global $woocommerce;
// remove WC generator tag from <head>
remove_action( 'wp_head', array( $woocommerce, 'generator' ) );
}
// called only after woocommerce has finished loading
add_action( 'woocommerce_init', 'my_woocommerce_loaded_function' );
@stephenharris
stephenharris / debugging-main-query.php
Created March 24, 2013 16:18
Very simple script for debugging queries
<?php
/**
* Will print to the page the main query used for that page. It will do this only for admins.
* This can be put in your theme's functions.php, but should be removed when its no longer needed.
*/
add_action( 'posts_request', 'debug_post_request', 10, 2 );
function debug_post_request( $r, $query ){
if( current_user_can( 'manage_options' ) && $query->is_main_query() ){
@BronsonQuick
BronsonQuick / saas_gravity_forms.scss
Last active December 15, 2015 22:39
A Saas file I use for generating custom Gravity Forms styles for clients sites.
/*!
----------------------------------------------------------------
Gravity Forms Front End Form Styles
Version 1.0
http: //www.gravityforms.com
Based on the original forms.css that ships with Gravity Forms
----------------------------------------------------------------
*/
@chrisdigital
chrisdigital / Frontend user profile in WordPress
Created May 6, 2013 13:27
Setting up a editable user profile in WordPress on the frontend.
//How to edit a user profile on the front end?
//http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end
//Forcing nickname as display_name in custom edit profile template
//http://wordpress.stackexchange.com/questions/35403/forcing-nickname-as-display-name-in-custom-edit-profile-template
///////
<?php