Skip to content

Instantly share code, notes, and snippets.

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

Herman Andres Figueroa heanfig

🏠
Working from home
View GitHub Profile
function sym(...args) {
return args.reduce( (a,b,i) => {
const valoresA = a.filter(item => !b.find(aux=>aux===item));
const valoresB = b.filter(item => !a.find(aux=>aux===item));
const resultado = new Set([...valoresA, ...valoresB]);
return [...resultado]
},[]);
}
console.log(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6])); //[1, 7, 4, 6]
function sym(...args) {
return args.reduce( (a,b,i) => {
const valoresA = a.filter(item => !b.find(aux=>aux===item));
const valoresB = b.filter(item => !a.find(aux=>aux===item));
return [...valoresA, ...valoresB]
},[]);
}
console.log(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6])); //[1, 7, 4, 6, 6]
@heanfig
heanfig / symetric-3.js
Created November 2, 2020 23:31
symetric 3
function sym(...args) {
return args.reduce( (a,b,i) => {
const valoresA = a.filter(item => !b.find(aux=>aux===item));
console.log(valoresA) // []
return valoresA
},[]);
}
@heanfig
heanfig / symetric-2.js
Created November 2, 2020 23:21
symetric differnce
function sym(...args) {
return args.reduce( (a,b,i) => {
console.log('compara',a,'con',b);
// Ciclo 1 => Compara [] con [3, 3, 3, 2, 5],
// Ciclo 2 => Compara [] con [2, 1, 5, 7],
// Ciclo 3 => Compara [] con [3, 4, 6, 6],
return [];
},[]);
}
@heanfig
heanfig / symetric-1.js
Last active November 2, 2020 23:11
Simetric difference 1
function sym(...args) {
console.log(args) // [[3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6]]
}
sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6]);
@heanfig
heanfig / options-in-typescript.ts
Created March 1, 2020 15:47 — forked from bcherny/options-in-typescript.ts
Options in TypeScript
type None = {
flatMap<U>(f: (value: null) => Option<U>): None
getOrElse<U>(def: U): U
isEmpty(): true
map<U>(f: (value: null) => U): None
nonEmpty(): false
orElse<U>(alternative: Option<U>): Option<U>
}
type Some<T> = {
@heanfig
heanfig / gilbreath.hs
Created February 19, 2019 22:54
Resolucion de la conjetura de gilbreath
-- ---------------------------------------------------------------------
-- Librerías auxiliares
-- ---------------------------------------------------------------------
import Graphics.Gnuplot.Simple
import Data.Numbers.Primes (isPrime, primes)
import qualified Data.Map as M
-- ---------------------------------------------------------------------
-- Ejercicio 1. Definir la función
@heanfig
heanfig / nuxt.config.json
Created February 1, 2019 16:51
Avoid decode HTML entities con generation
dev: true,
build: {
html: {
minify: {
collapseBooleanAttributes: false,
decodeEntities: false,
minifyCSS: false,
minifyJS: false,
processConditionalComments: false,
@heanfig
heanfig / sass-7-1-pattern.scss
Created December 19, 2018 11:24 — forked from rveitch/sass-7-1-pattern.scss
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@heanfig
heanfig / SassMeister-input.scss
Created October 23, 2018 05:21 — forked from pdaoust/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
// 'map', 'transform', 'select', or 'project' function. Iterate over a list,
// performing a function on each item, and collecting the new items. Each
// function takes an item as a first argument and returns a transformed item.
// You can pass additional arguments to the function too, which is a decent poor
// man's function composition.