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 | |
namespace Bernard\Driver; | |
class BeanstalkDriver implements \Bernard\Driver | |
{ | |
private | |
$_beanstalk, | |
$_config | |
; |
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
from __future__ import division | |
from math import * | |
from random import random, gauss | |
def p_smooth(c, n): | |
return (c + 1) / (n + 2) | |
def binomial(c, n): | |
p = p_smooth(c, n) | |
return 2*sqrt((1/n if n > 0 else 1) * p * (1-p)) |
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 | |
// Find files of all classes loaded.. | |
$loader = require('vendor/autoload.php'); | |
$files = array_filter(array_map(function($c) use ($loader) { | |
return $loader->findfile($c); | |
}, get_declared_classes())); | |
// Better solution.. find all required files | |
array_map(function($f) use ($i) { |
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 | |
function wilson($p, $n) { | |
$z = 1.9599; | |
$z2 = pow($z, 2); | |
return array( | |
($p + $z2/(2*$n) - $z * sqrt(($p*(1-$p) + $z2/(4*$n)) / $n)) / (1 + $z2/$n), | |
($p + $z2/(2*$n) + $z * sqrt(($p*(1-$p) + $z2/(4*$n)) / $n)) / (1 + $z2/$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 | |
// Parse HTTP HOST header hostname and port according to http://tools.ietf.org/html/rfc3986.html | |
$h16 = '[[:xdigit:]]{1,4}'; | |
$subDelims = "[!$&'()*+,;=]"; | |
$pctEncoded = '%[[:xdigit]][[:xdigit]]'; | |
$unreserved = '[-._~[:alpha:][:digit:]]'; | |
$decOctet = <<<EOS | |
(?: |
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/lib/Pheasant/DomainObject.php b/lib/Pheasant/DomainObject.php | |
index 41a103c..be04890 100755 | |
--- a/lib/Pheasant/DomainObject.php | |
+++ b/lib/Pheasant/DomainObject.php | |
@@ -65,9 +65,9 @@ class DomainObject | |
* Used by the default initialize() method, returns the table name to use | |
* @return string | |
*/ | |
- public function tableName() | |
+ public static function tableName() |
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
pallete = Array(String, 93) | |
i = 1 | |
for bg = 232:(255-1) | |
for char in [" ", "░", "▒", "▓"] | |
pallete[i] = "\e[38;5;$(bg+1)m\e[48;5;$(bg)m$(char)\e[0m" | |
i += 1 | |
end | |
end | |
pallete[93] = "\e[48;5;$(255)m \e[0m" |
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
# ccv_dense_matrix_t* image = 0 | |
image = Array(Ptr{Void},0) | |
# int ccv_read_impl(const void* in, ccv_dense_matrix_t** x, int type, int rows, int cols, int scanline); | |
r = ccall( | |
(:ccv_read_impl, "libccv"), | |
Int32, | |
(Ptr{Uint8}, Ptr{Ptr{Void}}, Int, Int, Int, Int), | |
"/home/vagrant/dev/julia/test.png", image, 0x100 | 0x020, 0, 0, 0) |
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 | |
// Instructions: save this file to the base diretory of the kumite-moa repo.. | |
require 'vendor/autoload.php'; | |
/** | |
* Calculates the statistical significance of a boolean experiment over | |
* multiple events (e.g. contests), where the result for each event is | |
* a true/false outcome (e.g. contest was or was not refunded). |
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 | |
use Symfony\Component\HttpFoundation\Request; | |
class KelpieSymfonyAdaptor | |
{ | |
public function __construct($app) | |
{ | |
$this->_app = $app; | |
} |