Skip to content

Instantly share code, notes, and snippets.

View suissa's full-sized avatar
🏠
Working from home

Jean Carlo Nascimento suissa

🏠
Working from home
  • Suissa Corp
  • Brasil
View GitHub Profile
@suissa
suissa / operationsWithMatrixV2.js
Last active March 26, 2018 02:11 — forked from Woodsphreaker/operationsWithMatrixV2.js
Operations with Matrix V2
const plus = ( a = 0 ) => ( b = 0 ) => a + b
const times = ( a = 1 ) => ( b = 1 ) => a * b
const minus = ( a = 0 ) => ( b = 0 ) => a - b
const division = ( a = 1 ) => ( b = 1 ) => a / b
const getNumByIndex = ( num, index ) => num[index]
const applyFn = ( fn ) => ( x, y ) => fn( x )( y)
const applyVerticalOperation = ( fn) => ( acc, cur) =>
$(function() {
const medida_el = document.querySelector('#validacao_medida_id_val')
const dimensao_el = document.querySelector('#validacao_dimensao_id_val')
console.log(medida_el)
console.log(dimensao_el)
const changeMedida = (event) => {
$(function() {
var dimensoes_val, medidas_val;
$('#validacao_medida_id_val').parent().hide();
$('#validacao_dimensao_id_val').parent().hide();
medidas_val = $('#validacao_medida_id_val').html();
dimensoes_val = $('#validacao_dimensao_id_val').html();
console.log("medidas: "+medidas_val);
console.log("dimensoes: "+dimensoes_val);
@suissa
suissa / estatistica.js
Created May 25, 2017 02:12 — forked from emanuelgsouza/estatistica.js
Resumos de estudos que fiz durante o segundo semestre do Curso de Sistemas de Informação
// Variables
const numbers = [8, 6, 9];
const weights = [3, 1, 6];
// Helpers
const sum = (val1, val2) => val1 + val2;
const reduce = (numbers, fn) => numbers.reduce(fn);
const rtnLength = array => array.length;
const compareNumbers = (n1, n2) => n1 - n2;
@suissa
suissa / cps.js
Created May 1, 2017 18:36 — forked from trdarr/cps.js
"Thunks, Trampolines, and Continuation Passing" in JavaScript
/* "Thunks, Trampolines, and Continuation Passing"
* Python implementation from http://jtauber.com/blog/2008/03/30/
* JavaScript implementation by Thomas Darr <me@trdarr.com>.
*/
// thunk = lambda name: lambda *args: lambda: name(*args)
var thunk = function thunk(fn) {
return function _thunk() {
var splat = Array.prototype.slice.apply(arguments);
return function __thunk() { return fn.apply(this, splat); };
@suissa
suissa / Calisthenics.md
Last active September 4, 2023 19:55 — forked from bobuss/Calisthenics.md
As 9 Regras do Object Calisthenics

Object Calisthenics descreve 9 regras básicas - pt-br

  1. Um nível de recuo por método.
  2. Não use a palavra-chave ELSE.
  3. Envolver todos os primitivos e Strings em classes. (em JS nao eh necessario)
  4. Funções de primeira classe // mudei p/ Function em vez de Class
  5. Um ponto por linha.
  6. Não abrevie.
  7. Mantenha todas os módulos com menos de 50 linhas.
  8. Nenhuma função com mais de dois parâmetros.
@suissa
suissa / code.js
Last active April 17, 2017 03:55 — forked from samverneck/code.js
const mensagem = prompt('Digite sua mensagem');
const cifra = parseInt(prompt('Digite o valor da cifra'));
let mensagemCodificada = ''
for (var i = 0, length = mensagem.length; i < length; i++) {
mensagemCodificada += String.fromCharCode(mensagem.charCodeAt(i) + cifra);
}
alert(mensagemCodificada);
@suissa
suissa / criaArrayPrimos.js
Created March 18, 2017 18:07 — forked from anabastos/criaArrayPrimos.js
Dado um número aleatório, retornar todos os números PRIMOS entre 0 e o número escolhido
function criaArrayPrimos(x) {
return [...Array(x).keys()].slice(2).filter(ehPrimo)
}
function ehPrimo(x){
return [...Array(Math.ceil(Math.sqrt(x + 1))).keys()].slice(2).every(y => x % y !== 0)
}
console.log(criaArrayPrimos(40)) //[ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 ]
@suissa
suissa / criaArrayPrimos.js
Created March 18, 2017 18:07 — forked from anabastos/criaArrayPrimos.js
Dado um número aleatório, retornar todos os números PRIMOS entre 0 e o número escolhido
function criaArrayPrimos(x) {
return [...Array(x).keys()].slice(2).filter(ehPrimo)
}
function ehPrimo(x){
return [...Array(Math.ceil(Math.sqrt(x + 1))).keys()].slice(2).every(y => x % y !== 0)
}
console.log(criaArrayPrimos(40)) //[ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 ]
const matrix = [[2,4,6,8],[12,14,16,18],[20,24,28,32],[32,34,36,38],[42,44,46,48]];
const exp = matrix[0];
const arrNumbers = matrix.slice(1);
const props = [
(number, _i) => (number * exp[_i]),
(number, _i) => (number / exp[_i]),
(number, _i) => (number - exp[_i]),
(number, _i) => (number + exp[_i])
];
const op = (arr, _i) => arr.map(_a => props[_i](_a, _i));