Skip to content

Instantly share code, notes, and snippets.

View jarbaspsf's full-sized avatar

Jarbas Pereira da Silva FIlho jarbaspsf

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jarbaspsf on github.
  • I am jarbaspsf (https://keybase.io/jarbaspsf) on keybase.
  • I have a public key ASDXF1vflAFBBItt5gR_zOn7GDBKaGLBET6SJxwaTf7PJgo

To claim this, I am signing this object:

@jarbaspsf
jarbaspsf / passandoFuncaoComoArgumento.js
Created February 4, 2018 23:13
passando funcao como argumento
let exibirResultado = (resultado) => console.log(`O Resultado da soma é: ${resultado}`);
let soma = (a, b, callback) => {
let resultado = a = b;
if(callback){
callback(resultado);
}
}
soma(14, 16, exibirResultado)
let soma = (a, b) => a + b;
soma(1,5)
//6
@jarbaspsf
jarbaspsf / somaSalarios.js
Created February 3, 2018 01:09
Exemplo filter, map reduce
let profissionais = [
{nome: "João", salario: 5000, idade: 27},
{nome: "Lucas", salario: 7000, idade: 37},
{nome: "Pedro", salario: 5500, idade: 35},
{nome: "Thiago", salario: 4500, idade: 24},
{nome: "Felipe", salario: 4500, idade: 23},
{nome: "Alexandre", salario: 4000, idade: 20},
]
let somaSalariosAte30Anos = profissionais
let numeros = [1,2,3,4]
let soma = numeros.reduce((valorAnterior, valorAtual) => valorAnterior + valorAtual, 30);
@jarbaspsf
jarbaspsf / reduceSoma.js
Created February 3, 2018 00:36
exemplo reduce ES6
let numeros = [1,2,3,4]
let soma = numeros.reduce((valorAnterior, valorAtual) => valorAnterior + valorAtual);
@jarbaspsf
jarbaspsf / mapRaizQuadrada.js
Created February 3, 2018 00:23
exemplo map ES6
let numeros = [9,16,25,36,49];
let numerosRaiz = numeros.map(n => Math.sqrt(n))
@jarbaspsf
jarbaspsf / filterPares.js
Created January 31, 2018 17:06
exemplo filter ES6
let numeros = [1,2,3,4,5,6,7,8,9,10];
let pares = numeros.filter(n => n%2 == 0)
@jarbaspsf
jarbaspsf / Rantera Web-Sockets
Last active May 17, 2016 11:35
Criando web-sockets no rantera (Grails)
//Eventos recebendo objeto
var gSonServerEvent0 = function() {
websocketClient.subscribe("/topic/atividades", function(message) {
var run = function(data) {
return gs.mc($("#teste"),"append",[gs.plus((gs.plus("<p>", data)), "</p>")]);
};
run(gs.toGroovy(jQuery.parseJSON(message.body), null));
});
};
BETHEA, Cooper. EXPERIENCES DEPLOYING MONGODB ON AWS. Disponí-
vel em: <http://www.mongodb.com/presentations/experiences-deploying-mongodb-aws>.
Acesso em: 17 de fevereiro de 2015.
COLEMAN, Tom. GREIF, Sasha. DISCOVER METEOR: Building Real-Time
JavaScript Web Apps. Disponível em: <https://book.discovermeteor.com/> Acesso em:
15 de março de 2015.
DEBERGALIS, Matt . Introducing DDP. Disponível em: <https://www.meteor.
com/blog/2012/03/21/introducing-ddp>. Acesso em: 15 de fevereiro de 2015.