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
| -- Using Foreign Key with MySql and Constraint: | |
| alter table <name_table> | |
| add constraint <fk_name_constraint_1> | |
| foreign key (<column_name_this_table>) | |
| references <table_references> (<column_name_table_references>); | |
| -- Not tested: | |
| alter table <name_table> | |
| add constraint <fk_name_constraint> |
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 | |
| /** | |
| * | |
| * Função que faz a validação de CPF, verificando se ele está no formato certo, exemplo 'xxx.xxx.xxx-xx' ou 'xxxxxxxxxxx', e se | |
| * ele é válido, caso as duas verificação sejam verdadeiras será retornado TRUE ou FALSE caso contrario. | |
| * | |
| * @param c: String CNPJ a se validado. | |
| * @return Boolean | |
| * |
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
| //Selector: #selector_id option:selected | |
| var select = $('#selector_id option:selected'); | |
| console.log(select.text()); |
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
| //With ternary operator: | |
| $(document).keypress(function(e){ | |
| var keycode = e.keyCode ? e.keyCode : e.which; | |
| if(keycode === 13){ | |
| //Code action here. | |
| } | |
| }); |
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 | |
| //Example: 1: | |
| $csrf_token_name = $this->security->get_csrf_token_name(); | |
| $get_csrf_hash = $this->security->get_csrf_hash(); | |
| ?> | |
| <input | |
| type="hidden" |
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 attrClass = (function() { | |
| var _element = null, | |
| _listener = []; | |
| var setElement = function(element) { | |
| _element = element; | |
| _listener = _element.className.split(' '); | |
| }; |
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 j = jQuery.noConflict(); | |
| var loadingImage = (function ($) { | |
| var loadImage = $('body img.load-image'); | |
| var configDefault = { | |
| callbacks: { | |
| show: function() {}, | |
| hide: function() {} |
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
| /** | |
| * Converte código HTML hexadecimal para decimal. | |
| * | |
| * @param $code String código HTML hexadecimal. | |
| * | |
| * @return Array | |
| */ | |
| function hexaHtmlToDecimal($code) { | |
| if (strlen($code) == 7) { |
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 MyModal = (function() { | |
| var alert = function(options) { | |
| var modalConfirm = $('#modal_alert'), | |
| titleModal = modalConfirm.find('.title-modal') | |
| messageModal = modalConfirm.find('.message-modal'), | |
| buttonOk = modalConfirm.find('.model-button-ok'); | |
| titleModal.text(options.title); |
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 | |
| $dt = new DateTime(); | |
| echo $dt->format('Y-d-m'); |