Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan McCue rmccue

View GitHub Profile
View gist:4584739
<?php
//get the review type based on page custom meta field
function oswc_get_review_meta($postid) {
//try every reasonble conceivable variation that the user my enter to make this as user friendly as possible
$possible = array(
'Review Type',
'review type',
'reviewtype',
'Reviewtype',
View gist:3075102
// http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
// http://gist.github.com/raw/63002/b53853727856bad494dcbb7ffed4fc17f289af92/gistfile1.rb
// $z is the pnormaldist with power = 0.05. I.e., pnormaldist(1-power/2)
function score($pos, $n) {
if ($n == 0) { return 0; }
$z = 1.95996397158435;
$phat = 1.0*$pos/$n;
return ($phat + $z*$z/(2*$n) - $z * sqrt(($phat*(1-$phat)+$z*$z/(4*$n))/$n))/(1+$z*$z/$n);
}
@rmccue
rmccue / find-local-vars.php
Created Jan 22, 2012 — forked from nacin/find-local-vars.php
Find Unset Local Variables
View find-local-vars.php
<?php
/**
* Find unset PHP variables
*
* Deals with scope fairly correctly.
*
* Known bugs:
* - Does not yet support `if: ... endif;` (etc)
* - Does not yet support {$a}/${a} (coming soon)
*/
@rmccue
rmccue / plugin-file.php
Created Jan 17, 2012 — forked from kovshenin/plugin-file.php
Improved class concept
View plugin-file.php
<?php
/*****
All new versions will be posted at
https://github.com/rmccue/Rotor_WPPlugin
Please use that repository instead of this Gist.
******/
View gist:591135
<?php
/*
Plugin Name: Taxononmy Navigation Dropdown
Version: 0.1
Plugin URI: http://anthonycole.me/wordpress/taxonomy-nav-dropdown/
Description: This plugin allows you to add a simple widget linking all of your taxonomies together.
Author: Anthony Cole
Author URI: http://anthonycole.me/
Copyright 2010 Anthony Cole ( email: anthony@radiopicture.com.au )
@rmccue
rmccue / aggregate-feed.php
Created Apr 22, 2010 — forked from smajda/aggregate-feed.php
An improved version of the RSS merger
View aggregate-feed.php
<?php
/* Merge multiple RSS feeds with SimplePie
*
* Just modify the path to SimplePie and
* modify the $feeds array with the feeds you want
*
* You should probably also change the channel title, link and description,
* plus I added a CC license you may not want
*
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/