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 <iostream> | |
int main() { | |
bool* pFlag = new bool(false); // Allocate memory for the boolean and initialize it to false | |
std::cout << "Initial value of flag: " << std::boolalpha << *pFlag << std::endl; | |
*pFlag = true; // Modify the value of the boolean through the pointer | |
std::cout << "New value of flag: " << std::boolalpha << *pFlag << std::endl; |
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; |
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) |
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 | |
*/ |
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"]); |