Skip to content

Instantly share code, notes, and snippets.

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

Geronimo Ezequiel Perez Salas GeroSalas

🏠
Working from home
View GitHub Profile
@GeroSalas
GeroSalas / .editorconfig
Created June 5, 2018 12:54
EditorConfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
@GeroSalas
GeroSalas / elasticsearch-example.js
Created June 2, 2018 12:52 — forked from StephanHoyer/elasticsearch-example.js
Simple example how to use elastic search with node.js
'use strict';
var elasticsearch = require('elasticsearch');
var Promise = require('bluebird');
var log = console.log.bind(console);
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
@GeroSalas
GeroSalas / ELK-install.sh
Created June 2, 2018 12:45 — forked from sniper7kills/ELK-install.sh
ELK-Install-Ubuntu-16.04
#/bin/bash
#Ask some info
echo -n "Enter ELK Server IP or FQDN: "
read eip
echo -n "Enter Admin Web Password: "
read adpwd
#Update System
sudo apt-get update
sudo apt-get upgrade -y
@GeroSalas
GeroSalas / readme.md
Last active May 1, 2018 22:31
TypeScript Style Guide

Typescript Style Guide

@GeroSalas
GeroSalas / .nycrc
Created May 1, 2018 22:16
Istanbul NYC Sample (for TypeScript)
{
"check-coverage": true,
"statements": 95,
"lines": 95,
"functions": 95,
"branches": 95,
"watermarks": {
"statements": [60, 95],
"lines": [60, 95],
"functions": [60, 95],
@GeroSalas
GeroSalas / snail.js
Created May 1, 2018 22:00
Snail Sort
// Snail Sort
snail = (array) => {
const result = []
const n = array.length
let x = n // column pointer
let y = n // row pointer
if (n === 1) {
return array[0] // single value
}
@GeroSalas
GeroSalas / paginator.js
Created May 1, 2018 21:59
Paginator Helper
// Paginator Helper Class
class PaginationHelper {
constructor(collection, itemsPerPage) {
this.collection = collection
this.itemsPerPage = itemsPerPage
}
itemCount() {
return this.collection.length
@GeroSalas
GeroSalas / api.js
Created May 1, 2018 21:58
Simple API REST (NodeJS - Express - MongoDB)
// Simple API REST (NodeJS - Express - MongoDB)
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const mongoose = require('mongoose')
const bcrypt = require('bcrypt')
const salt = bcrypt.genSaltSync(10) // fixed salt
// Tokens Blacklist (a very straightforward alternative to some STS)
const revokedTokens = new Set()