Skip to content

Instantly share code, notes, and snippets.

View MarceloBonifazio's full-sized avatar
🇧🇷
Engineer

Marcelo Bonifazio MarceloBonifazio

🇧🇷
Engineer
View GitHub Profile
@MarceloBonifazio
MarceloBonifazio / code.php
Last active March 29, 2017 22:01
Função para testar informaçoes dentro de um array
<?php
// $_POST["teste"] = "algo";
// $_POST["valor1"] = "algo";
// $_POST["valor2"] = "algo";
$array = array("teste",array("valor2","validar2"),array("valor1","validar1"),array("validar"),array("validar","isso"));
$fields = test_informations($array);
if(!empty($fields)){
echo json_encode($fields);
}
function test_informations(array $array){
@MarceloBonifazio
MarceloBonifazio / requisicao_randomica.php
Last active May 26, 2017 22:46
Teste com limite para que função que faz uma requisição em um serviço terceiro traga um retorno valido
<?php
$controle = 1;
for($i = 1; $i <= 100; $i++){
$retorno = requisicao($i);
echo "<div style='background-color:".($retorno == null ? ( $controle == 3 ? "blue; opacity: .6;'>fatal error no retorno $i" : "red; opacity: .6;'>erro no retorno $i" ) : "green; opacity: .6;'>retorno ".$retorno." valido" )."</div><hr/>";
if ($retorno != null || $controle == 3){
$controle = 1;
}else{
$i--;
$controle++;
<?php
$numero = rand(1,20); // Entre com seu numero aqui
?>
<table border=1>
<tr>
<th>
Decimal
</th>
<th>
Hexadecimal
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});