Skip to content

Instantly share code, notes, and snippets.

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

Fabian Gutierrez fega

🏠
Working from home
View GitHub Profile
@fega
fega / iso-3166-2.js
Created September 19, 2020 14:58
Countries and States ISO 3166 Codes
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',
@fega
fega / deploy.sh
Last active August 9, 2021 21:00
Quick deploy nuxt to heroku
# 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 / pager-solution.js
Created April 8, 2020 16:42
Pager solution
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 January 26, 2019 04:40
FLUSH DOCKER REDIS, with auth
docker exec -it container-name redis-cli -a pass FLUSHALL
@fega
fega / gist:e3643393552f18b46511fb23cb192986
Last active December 23, 2018 14:06
Quick deploy moser to Heroku
# 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 / setting-up-babel-nodemon.md
Created April 30, 2017 05:42 — forked from sam-artuso/setting-up-babel-nodemon.md
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
@fega
fega / no-extension.sh
Created August 12, 2018 04:46
Replace al import "" from "" for require in javascript
# 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