Skip to content

Instantly share code, notes, and snippets.

View juanlatorre's full-sized avatar

Juan Latorre juanlatorre

View GitHub Profile
@juanlatorre
juanlatorre / multiFilter.js
Created October 14, 2018 21:51 — forked from diegochavez/multiFilter.js
Multi filters an array of objects
/**
* Multi-filter an array of objects
* @param {Array} array : list of elements to apply a multiple criteria filter
* @param {Object} filters: Contains multiple criteria filters by the property names of the objects to filter
* @return {Array}
*/
function multiFilter(array, filters) {
let filterKeys = Object.keys(filters);
// filters all elements passing the criteria
return array.filter((item) => filterKeys.every((key) => (filters[key].indexOf(item[key]) !== -1)));
@juanlatorre
juanlatorre / Batman.md
Last active March 9, 2022 02:48
Mi lista de comics para entender la línea temporal completa de Batman

Primera Parte

  • Batman: Año Uno (1987)
  • El Hombre Que Cae (1989)
  • Catwoman, Her Sister’s Keeper (1989)
  • Batman: Año Dos (1987)
  • El Caso del Sindicato Químico (1939)
  • Batman y los Hombres Monstruo (2007)
  • Presa (1990)
  • Batman y el Monje Loco (2007)
  • El Hombre Que Ríe (2005)
@juanlatorre
juanlatorre / pyenv+virtualenv.md
Created March 11, 2019 15:26 — forked from eliangcs/pyenv+virtualenv.md
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv
@juanlatorre
juanlatorre / gist:40092fc6f777fa2f1877e2ff229f0db1
Created April 20, 2019 12:38 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@juanlatorre
juanlatorre / namecheap SSL.md
Created June 15, 2019 14:14 — forked from Shourai/namecheap SSL.md
Letsencrypt SSL certificate with namecheap hosting

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.

@juanlatorre
juanlatorre / iterifyArray.js
Last active June 21, 2019 16:53
wrapper to add .next() and .prev() and current() to array, without prototype
const iterifyArr = function(arr) {
var cur = 0;
arr.next = function() {
if (++cur <= this.length - 1) {
return this[cur];
} else {
cur = 0;
return this[cur];
}
};
const imageData = [ 'image1.png', 'img2.png', 'img3.png' ];
const currentImage = 0;
const handleImageChange = (direction) => {
if (direction == 'forward')
currentImage = (currentImage + 1) % imageData.length;
else
currentImage = (currentImage - 1 + imageData.length) % imageData.length;
}
@juanlatorre
juanlatorre / README-Template.md
Created February 13, 2020 19:21 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@juanlatorre
juanlatorre / particles.json
Created May 14, 2020 04:40
JSON config for particles.json
{
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
@juanlatorre
juanlatorre / adb.md
Last active July 29, 2020 18:31
Fix ADB version not matching
$ adb kill-server
$ sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin/adb
$ sudo chmod +x /usr/bin/adb
$ adb start-server