Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Fabian Gutierrez fega

🏠
Working from home
View GitHub Profile
@fega
fega / iso-3166-2.js
Created Sep 19, 2020
Countries and States ISO 3166 Codes
View iso-3166-2.js
module.exports = {
AF: {
name: 'Afghanistan',
divisions: {
'AF-BDS': 'Badakhshān',
'AF-BDG': 'Bādghīs',
'AF-BGL': 'Baghlān',
'AF-BAL': 'Balkh',
'AF-BAM': 'Bāmīān',
'AF-FRA': 'Farāh',
View pager-solution.js
const Hapi = require('@hapi/hapi');
const MongoClient = require('mongodb').MongoClient;
const Boom = require('@hapi/boom');
const totalAmountReducer = (userItems) => (prev, item) => {
const itemsPrice = item.price * userItems.find(v => v.itemId === item.itemId).quantity
return prev + itemsPrice;
};
const server = Hapi.server({
@fega
fega / hello.sh
Created Jan 26, 2019
FLUSH DOCKER REDIS, with auth
View hello.sh
docker exec -it container-name redis-cli -a pass FLUSHALL
@fega
fega / gist:e3643393552f18b46511fb23cb192986
Last active Dec 23, 2018
Quick deploy moser to Heroku
View gist:e3643393552f18b46511fb23cb192986
# in the folder
# Create the config file
module.exports{
port: process.env.PORT || 3000,
db: process.env.MONGO_URI
}
# Create package.json
npm init -y
@fega
fega / deploy.sh
Last active Oct 29, 2020
Quick deploy nuxt to heroku
View deploy.sh
# in the nuxt app directory
heroku create
# Set ENV_VARS
heroku config:set NPM_CONFIG_PRODUCTION=false HOST=0.0.0.0 NODE_ENV=production
# CREATE Procfile
echo 'web: npm run start' > Procfile
# ADD JSON script
@fega
fega / no-extension.sh
Created Aug 12, 2018
Replace al import "" from "" for require in javascript
View no-extension.sh
# time saving when you want to get rid babel.js
regex: import (\w+) from "((\w|\-)+)"; # this will match import export
const $1 = require("$2"); # this will replace them with require
View setting-up-babel-nodemon.md

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y