Skip to content

Instantly share code, notes, and snippets.

@katanacrimson
katanacrimson / ci_lower_bound.sql
Created July 6, 2017 15:55 — forked from favila/ci_lower_bound.sql
MySQL stored functions for calculating confidence intervals using Wilson scores: more precisely "Lower bound of Wilson score confidence interval for a Bernoulli parameter". Includes a P(qn) function (inverse normal distribution). See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html This describes a way to rank items based on a ve…
# Francis Avila 2009-07-04
# See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
# These functions calculate "Lower bound of Wilson score confidence interval for a Bernoulli parameter"
# Two stored functions:
# CI_LOWER_BOUND(pos, trials, confidence) calculate a wilson score given POS positive votes in TRIALS number of trials
# PNORM(qn) calculate P(qn) (inverse normal distribution); needed by CI_LOWER_BOUND
delimiter ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `ci_lower_bound`(pos INTEGER, trials INTEGER, confidence DOUBLE) RETURNS double
NO SQL
@katanacrimson
katanacrimson / pass.js
Created August 22, 2012 02:33
Football season is here
$ node pass.js
99.3
@katanacrimson
katanacrimson / bootstrap.php
Created May 12, 2011 20:03 — forked from samt/bootstrap.php
OpenFlame Framework Session example
<?php
use \OpenFlame\Framework\Core;
use OpenFlame\Framework\Event\Instance as Event;
use OpenFlame\Framework\Utility\JSON;
$dispatcher = Core::setObject('dispatcher', new \OpenFlame\Framework\Event\Dispatcher());
$session = Core::setObject('session', new \OpenFlame\Framework\Session\Driver());
$header = Core::setObject('header', new \OpenFlame\Framework\Header\Manager());
$input = Core::setObject('input', new \OpenFlame\Framework\Input\Handler());
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.413892 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.419085 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.428959 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.440547 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.430267 seconds