This file contains hidden or 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
const $watch = document.querySelector("#relogio") | |
const $timeout = document.querySelector("#delay") | |
const showCurrentTime = () => { | |
const date = new Date() | |
$watch.innerHTML = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}` | |
} | |
setTimeout(() => { | |
$timeout.innerHTML = `setTimeout foi executado com sucesso.`; |
This file contains hidden or 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
// Executa o evento a cada 10 segundos | |
setInterval(() => console.log('setInterval'), 10000); | |
// Executa o evento depois de 5 segundos | |
setTimeout(() => console.log('setTimeout'), 5000); |
This file contains hidden or 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
<div id="relogio">Aguardando o setInterval ser Executado</div> | |
<div id="delay">Aguardando o setTimeout ser Executado</div> |
This file contains hidden or 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 | |
function validaData($date, $format = 'Y-m-d H:i:s') | |
{ | |
if (!empty($date) && $v_date = date_create_from_format($format, $date)) { | |
$v_date = date_format($v_date, $format); | |
return ($v_date && $v_date == $date); | |
} | |
return false; | |
} |
This file contains hidden or 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 | |
function converteData($format, $to_format, $date, $timezone = null) | |
{ | |
if (!empty($date)) { | |
$timezone = $timezone ? $timezone : new DateTimeZone(date_default_timezone_get()); | |
$f_date = date_create_from_format($format, $date, $timezone); | |
return date_format($f_date, $to_format); | |
} | |
return false; | |
} |
This file contains hidden or 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 Utilitarios = require('./utilitarios'), | |
util = new Utilitarios(), | |
saldo = null; | |
if (util.isNull(saldo)) { | |
console.log("Seu saldo é 0"); | |
} |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Minha aplicação</title> | |
<script src="utilitarios.js"></script> | |
<script> | |
var util = new Utilitarios(), | |
saldo = null; |
This file contains hidden or 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 Utilitarios = (function() { | |
var Utilitarios = function(options) { | |
}; | |
Utilitarios.prototype.isNull = function(obj) { | |
return obj === null; | |
}; | |
Utilitarios.prototype.isUndefined = function(obj) { | |
return obj === void 0; |
This file contains hidden or 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() { | |
var Utilitarios = (function() { | |
var Utilitarios = function(options) { | |
}; | |
Utilitarios.prototype.isNull = function(obj) { | |
return obj === null; | |
}; | |
Utilitarios.prototype.isUndefined = function(obj) { |
This file contains hidden or 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
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | |
module.exports = Utilitarios; | |
} else if (typeof define === 'function' && define.amd) { | |
define([], function() { | |
return Utilitarios; | |
}); | |
} else { | |
window.Utilitarios = Utilitarios; | |
} |
OlderNewer