View pairs-combinatorial.php
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 | |
// Dada una lista de numeros que se pueden repetir en valor, crear las posibles combinaciones de pares A,B, pero | |
// no permitir un A,B y un C,A si B y C son iguales en valor, y tampoco permitir A,B y B,A en una misma solucion. | |
// El orden de las parejas no es relevante de manera que la solucion P1,P2,P3 es igual a P2,P1,P3. | |
$elements = [1,2,2]; | |
$totalElements = count($elements); | |
$pairs = []; | |
$weight = 0; |
View IpCheck.php
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 | |
/** | |
* Check if a IP exists in a storage with concurrency control for several HTTP requests | |
* | |
* Based in divengine\nodes::waitAndDo() queue algorithm | |
* | |
* @author rafageist | |
*/ | |
function IpCheck($ip) |
View Enum.php
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 | |
/** | |
* This is a trick or solution for create enumerations in PHP using classes | |
* If you are curious you will realize that you can build a hierarchy of | |
* enumerations, even give other uses to those classes. | |
* | |
* @author rafageist | |
*/ |
View index.php
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 "div.php"; | |
echo new div("index.tpl", ["world" => "Earth"]); |