Skip to content

Instantly share code, notes, and snippets.

View geraldotech's full-sized avatar
🎯
Focusing

Geraldo Costa Filho geraldotech

🎯
Focusing
View GitHub Profile
@geraldotech
geraldotech / AngularJS.html
Last active June 18, 2022 16:00
AngularJS
<li>np-app</li>
<li>ng-model</li>
<li>ng-bind</li>
<li>ng-init</li>
<li>ng-controller (if exist ng-app :before it doest work!)</li>
<li>parent</li>
<li>ng-show</li>
<li>ng-hide</li>
<li>ng-if</li>
@geraldotech
geraldotech / fetch-async-await.js
Last active July 27, 2022 22:40
parse response.json to json obj
const api = 'http://127.0.0.1/Dev/Javascript/JSON/my_local_json/dados2.json';
async function essaurl(url){
const response = await fetch(url);
const data = await response.json();
if(response){
show(data)
}
@geraldotech
geraldotech / filter.js
Created June 19, 2022 19:58
Filter Obj Array && console.warn
busca2 = animais.filter((value)=> value.tipo === 'gato');
busca2.length != 0 ? console.log(busca2) : console.warn('404')
const n = [2,4,6,1,7];
x = n.reduce(function (total,el,ind,arr) {
console.log(`index: ${ind}`)
console.log(`total: ${total}`)
console.log(`el: ${el}`)
console.log(`Arr: ${arr}`)
return total+= el;
},0);
console.log(x) //20
@geraldotech
geraldotech / hasAttribute_setAttribute.html
Created June 20, 2022 01:45
reduce && hasAttribute_setAttribute
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
code {
font-size: 2rem;
@geraldotech
geraldotech / search.js
Last active August 7, 2022 17:22
Listener Search
//html
<input type="text" />
<div id="esu">
<span id="res"></span>
</div>
//css
#esu{
display: none;
@geraldotech
geraldotech / fetch_repo_map.js
Created June 26, 2022 01:47
fetch_repo_map
const api = "https://gh-pinned-repos.egoist.sh/?username=geraldotech";
loadE = document.querySelector("#loading");
container = document.querySelector("#container");
async function get(url){
response = await fetch(url)
console.log(response)
data = await response.json();
console.log(data)
@geraldotech
geraldotech / Special.js
Last active December 17, 2022 14:56
exercicios special
//first class function
const ano = [1992,1995,2000,2006,2008];
function idade(age){
let d = new Date();
return d.getFullYear() - age;
}
function Calc(ano,fun){ // declarando dois parâmetros, os anos e a função que calcula a idade baseado nos anos
let gets = []; // array vazio vai armazerar os resultados
// get all questions || or gararito answers
const title = document.querySelectorAll("[data-testid='question-typography']:first-child")
for(const i of title){
console.log(i.textContent)
console.log("=============")
}
// get all answers
const resp = document.querySelectorAll("[data-element='link_resposta'] [data-testid='question-typography']")
@geraldotech
geraldotech / calculadora-notas.js
Last active October 9, 2022 19:18
Calculadora notas laço while - JavaScript - Video
let [cont,sum,qt] = [1,0,2]; //contador, soma e quantidade de notas
while(cont <= qt){
const notas = +prompt(`Digite a nota ${cont}`);
if(notas > 10) { alert('nota invalida!'); break; } // verifica se a nota for maior que 10 cancela a operacao
sum += (notas) //faz a soma
document.write(`Nota ${cont} => ${notas}`);
document.write('<br>');
cont++;
}