-
-
Posts recentes
Comentários
Arquivos
- setembro 2023
- junho 2023
- janeiro 2023
- agosto 2022
- julho 2022
- dezembro 2021
- março 2021
- fevereiro 2021
- outubro 2020
- agosto 2020
- julho 2020
- junho 2020
- maio 2020
- março 2020
- fevereiro 2020
- agosto 2019
- janeiro 2019
- dezembro 2018
- novembro 2018
- setembro 2018
- junho 2018
- dezembro 2017
- setembro 2017
- agosto 2017
- maio 2017
- abril 2017
- dezembro 2016
- novembro 2016
- julho 2016
- agosto 2015
- julho 2015
- março 2015
- janeiro 2015
- julho 2014
- junho 2014
- maio 2014
- abril 2014
- dezembro 2013
- setembro 2013
- janeiro 2013
- dezembro 2012
- agosto 2012
- julho 2012
- junho 2012
- maio 2012
- abril 2012
- março 2012
- fevereiro 2012
Categorias
Tag Archives: JavaScript
Verificar se valor existe na String Javascript
Algumas formas de verificar se valor existe em uma string utilizando JavaScript. 1. (ES6) includes [js] var string = “foo”, substring = “oo”; string.includes(substring); [/js] 2. search [js] var string = “foo”, expr = “/oo/”; string.search(expr); [/js] 3. lodash includes [js] var string = “foo”, substring = “oo”; _.includes(string, substring); [/js] 4. RegExp [js] var […]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> JavaScript
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> Include JavaScript, JavaScript
Leave a comment
Remover DIV pelo texto ou title
Simples forma de remover uma div pelo text ou title. [js] $(“[title=’Criar novo site de projeto’]”).remove(); $(“[text=’Criar novo site de projeto’]”).remove(); [/js]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> JavaScript, JQuery
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> JavaScript, Jquery
Leave a comment
Função JavaScript para validação de CPF
Função para validação de CPF. [js] /*Função que valida Cpf*/ function validarCPF( campo ){ var cpf = campo.value; cpf = remove(cpf, “.”); cpf = remove(cpf, “-“); if(cpf.length != 11 || cpf == “00000000000” || cpf == “11111111111” || cpf == “22222222222” || cpf == “33333333333” || cpf == “44444444444” || cpf == “55555555555” || cpf […]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> JavaScript
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> JavaScript
Leave a comment
Sleep “Thread” em JavaScript
O exemplo que mostro a seguir mostra como fazer uma “thread sleep” via JavaScript. [js] function sleepFor( sleepDuration ){ var now = new Date().getTime(); while(new Date().getTime() < now + sleepDuration){ /* do nothing */ } } [/js] Exemplo de uso [js] function demo(){ sleepFor(2000); console.log("Olá! Eu sou um teste."); } demo(); [/js] Prático!
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> AngularJS, JavaScript
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> JavaScript
Leave a comment