This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/plugins/achievements/includes/core/functions.php b/plugins/achievements/includes/core/functions.php | |
index 3ccd9e7..97e1c76 100644 | |
--- a/plugins/achievements/includes/core/functions.php | |
+++ b/plugins/achievements/includes/core/functions.php | |
@@ -212,7 +212,7 @@ function dpa_handle_event() { | |
'ach_populate_progress' => $user_id, // Fetch Progress posts for this user ID | |
'no_found_rows' => true, // Disable SQL_CALC_FOUND_ROWS | |
'nopaging' => true, // No pagination | |
- 'post_status' => 'publish', // We only want active achievements | |
+ 'post_status' => 'any', // We only want published/private achievements, but need to compensate (see below) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include './Requests.php'; | |
Requests::register_autoloader(); | |
header('Content-Type: text/plain'); | |
class WPAPI { | |
public $base = ''; | |
protected $collections = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include pear | |
#### | |
# Make sure we're up-to-date | |
#### | |
exec { "apt-update": | |
command => "/usr/bin/apt-get update", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class { 'mysql::server': | |
config_hash => { 'root_password' => 'password' }, | |
} | |
mysql::db { 'store': | |
user => 'root', | |
password => 'password', | |
host => 'localhost', | |
grant => ['all'], | |
sql => '/vagrant/baikonur/schema.sql', | |
require => Class['mysql::server'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (function_exists('get_called_class')) { | |
$class = get_called_class(); | |
} | |
else { | |
$backtrace = debug_backtrace(); | |
$num = count($backtrace); | |
for ($i = 0; $i < $num; $i++) { | |
// Ignore the current class, as it's abstract and is never called | |
if (!empty($backtrace[$i]['class']) && $backtrace[$i]['class'] !== __CLASS__) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Querying hundreds of products, limiting to 25 per page | |
query_posts(array( | |
'post_type' => 'wpsc-product', | |
'author' => $user->ID, | |
'post_status' => 'any', | |
'paged' => get_query_var('paged'), | |
'posts_per_page' => 25, | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imp | |
import os.path | |
import inspect | |
from collections import defaultdict | |
def get_classes_from_file(filename): | |
name, _ = os.path.splitext(os.path.basename(filename)) | |
fp = file(filename) | |
module = imp.load_module(name, fp, filename, ('.py', 'U', imp.PY_SOURCE)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" | |
brew install python | |
# /usr/bin is higher in PATH than /usr/local/bin, so you need to do this to ensure `python` is the right one | |
sudo mv /usr/bin/python /usr/bin/python-old |