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 GetDateDiffFromNow($date1, $date2) | |
{ | |
$unixOriginalDate = strtotime($date1); | |
$unixNowDate = strtotime($date2); | |
$difference = $unixNowDate - $unixOriginalDate ; | |
$days = (int)($difference / 86400); | |
$hours = (int)($difference / 3600); | |
$minutes = (int)($difference / 60); | |
$seconds = $difference; | |
$atrasado = false; |
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
No need to create Makefile or something related, just copy "vendor/twitter/bootstrap/dist/css" and paste it into your "public/packages/" folder or simply run | |
php artisan asset:publish --path="vendor/twitter/bootstrap/dist/css" bootstrap/css | |
it worked for me. |
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 resizeImage($file, $savePath){ | |
define ('MAX_WIDTH', 2500);//max image width | |
define ('MAX_HEIGHT', 2500);//max image height | |
define ('MAX_FILE_SIZE', 10485760); | |
//iamge save path | |
$path = $savePath.'/'; | |
//size of the resize image |
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
<!-- ATUALIZANDO A QUERY PARA VERSÃO 5.7 --> | |
-- Seleciona a cada dia | |
SELECT a.* | |
FROM tb_dados a | |
INNER JOIN ( | |
SELECT DATE(dt_criacao) date, DAY(dt_criacao) day, MIN(dt_criacao) min_date | |
FROM tb_dados GROUP BY DATE(dt_criacao),DAY(dt_criacao) ) b | |
ON DATE(a.dt_criacao) = b.date AND DAY(a.dt_criacao) = b.day AND a.dt_criacao = b.min_date |
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
SELECT UNIX_TIMESTAMP(dt_criacao) AS 'dt_criacao' | |
FROM ( | |
SELECT | |
@row := @row +1 AS rownum, dt_criacao | |
FROM ( | |
SELECT @row :=0) r, tb_dados WHERE num_sim = '1' AND dt_criacao BETWEEN '2017-02-01' AND '2017-02-09' | |
) ranked | |
WHERE rownum %30 =1 |
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 | |
//var_dump($modelo->respDate); | |
//var_dump($modelo->respData); | |
//CARREGAR TODAS AS DATAS DO PERIODO SELECIONADO | |
//var_dump($modelo->respRawDate); | |
$dataUnix = $modelo->respRawDate; | |
$j = 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
/* | |
* Valida se a data fina é maior que a data inicio | |
*/ | |
jQuery.validator.addMethod("greaterThan", | |
function(value, element, params) { | |
var temp = value.split("/"); | |
var temp2 = $(params).val().split("/"); | |
if (!/Invalid|NaN/.test(new Date(temp[2], (temp[1] - 1), temp[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
jQuery.validator.addMethod("greaterThan", | |
function(value, element, params) { | |
if (!/Invalid|NaN/.test(new Date(value))) { | |
return new Date(value) > new Date($(params).val()); | |
} | |
return isNaN(value) && isNaN($(params).val()) | |
|| (Number(value) > Number($(params).val())); | |
},'Must be greater than {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
jQuery.validator.addMethod("cnpj", function(cnpj, element) { | |
cnpj = jQuery.trim(cnpj);// retira espaços em branco | |
// DEIXA APENAS OS NÚMEROS | |
cnpj = cnpj.replace('/',''); | |
cnpj = cnpj.replace('.',''); | |
cnpj = cnpj.replace('.',''); | |
cnpj = cnpj.replace('-',''); | |
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais; | |
digitos_iguais = 1; |
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
jQuery.validator.addMethod("verificaCPF", function(value, element) { | |
value = value.replace('.',''); | |
value = value.replace('.',''); | |
cpf = value.replace('-',''); | |
while(cpf.length < 11) cpf = "0"+ cpf; |
NewerOlder