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
server { | |
server_name api.seusite.com.br; | |
location / { | |
proxy_pass http://127.0.0.1:3333; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; |
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
$url = 'http://192.168.0.90:8088/asterisk/mxml'; | |
$data = 'Action=Login&Username=dashboard_enel&Secret=enel890678'; | |
$fp = fopen("cookie.txt", "w"); | |
fclose($fp); | |
$login = curl_init(); | |
curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt"); | |
curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt"); | |
curl_setopt($login, CURLOPT_TIMEOUT, 40000); | |
curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($login, CURLOPT_URL, $url); |
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
var nota_final_resultado = 0; | |
var subtrair_nota_final_resultado = 0; | |
var falhas_graves_resultado = 0; | |
var id_1 = 0; | |
var id_2 = 0; | |
var id_3 = 0; | |
var id_4 = 0; | |
var id_5 = 0; | |
var id_6 = 0; | |
var id_7 = 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
// Calcula Tempo Médio de Resposta em Horas | |
// Formato do valor esperado em $tempo = "03:00:00" | |
// Formato do valor esperado em $registros = 3 | |
// Resultado = "01:00:00" | |
function calcula_tmr($tempo,$registros) | |
{ | |
if(!empty($tempo)){ | |
$hora = 0; $minuto = 0; $segundo = 0; | |
sscanf($tempo, "%d:%d:%d", $hora, $minuto, $segundo); |
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
function diasCorridos($code) | |
{ | |
if(!empty($code)){ | |
date_default_timezone_set('America/Sao_Paulo'); | |
$now = Carbon::now()->parse()->format('Y-m-d'); | |
$date = Carbon::parse($code)->format('Y-m-d'); | |
$date1 = Carbon::createFromFormat('Y-m-d', $date); | |
$date2 = Carbon::createFromFormat('Y-m-d', $now); |
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 | |
$datatime1 = new DateTime('2015/04/15 00:00:00'); | |
$datatime2 = new DateTime('2015/05/16 00:00:00'); | |
$data1 = $datatime1->format('Y-m-d H:i:s'); | |
$data2 = $datatime2->format('Y-m-d H:i:s'); | |
$diff = $datatime1->diff($datatime2); | |
$horas = $diff->h + ($diff->days * 24); | |
echo "A diferença de horas entre {$data1} e {$data2} é {$horas} horas"; |