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
| //Um simples array com valores para se fazer uma média aritmética simples. | |
| var mediaAritmetica = new Array(8, 7, 10, 9);// [8, 7, 10, 9] | |
| //Percorrendo com laço FOR simples em Javascript puro: | |
| for (var i = 0, l = mediaAritmetica.length; i < l; i++) { | |
| console.log(mediaAritmetica[i]); | |
| } |
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 myCheckbox = $('#my_checkbox:checked'); | |
| //Checando com o selector :checked | |
| if (myCheckbox.val()) { | |
| console.log('Checked!'); | |
| } else { | |
| console.log('Not checked!'); | |
| } |
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
| -- Template to use transaction in SQL Server | |
| GO | |
| USE your_database_name; | |
| GO | |
| BEGIN TRANSACTION tran_your_transaction_name; |
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
| /** | |
| * | |
| * 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 | |
| * | |
| */ | |
| function validCPF(c) { |
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
| /** | |
| * Função que faz a validação de DATA verificando se ela está no formato mm/dd/aaaa, assim retornando TRUE caso esteja | |
| * e FALSE caso contrario. | |
| */ | |
| function validateDateBrazil(c) { | |
| if (c.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[1-9]{1}[0-9]{3}$/)){ | |
| var day = c.replace(/([0-9]{1,2})\/[0-9]{1,2}\/[0-9]{4}/,'$1'), |
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
| /** | |
| * Função para criar constantes no JavaScript (ECMAScript 5). | |
| * | |
| * @param name {string} nome da constante. | |
| * @param value {*} valor da constante. | |
| * | |
| */ | |
| function define(name, value) { | |
| Object.defineProperty(window, name, { |
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
| //Adicionar validação do CNPJ. | |
| function adicionarValidacaoCNPJ(valid) { | |
| var cnpjEmpresa = $('#cliente_prop_cli_nr_cnpj_empresa'); | |
| cnpjEmpresa.rules('remove', 'remote'); | |
| if (valid) { | |
| cnpjEmpresa.rules('add', { |
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
| /** | |
| * Number Generator JavaScript | |
| * | |
| * @param min {Integer} Number start | |
| * @param max {Integer] Number finish | |
| * | |
| * @return {Integer} | |
| * | |
| */ | |
| function randomNumber(min, max) { |
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
| /** | |
| * Verifica se determinado valor (value) está dentro de um determinado Array (Vector). | |
| * | |
| * @param value Any Valor a ser pesquisado. | |
| * @param vector Array Vetor onde será pesquisado um valor passado por parâmetro. | |
| */ | |
| function inArray(value, vector) { | |
| var count = 0, | |
| length = vector.length; |
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 i18nBr = { | |
| //previousMonth : 'Previous Month', | |
| previousMonth : 'Mês anterior', | |
| //nextMonth : 'Next Month', | |
| nextMonth : 'Próximo mês', | |
| //months : ['January','February','March','April','May','June','July','August','September','October','November','December'], | |
| months : ['Janeiro','Maio', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], | |
| //weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], |
OlderNewer